Skip to content

Commit 9dcdd47

Browse files
authored
Unrolled build for rust-lang#140385
Rollup merge of rust-lang#140385 - lnicola:sync-from-ra, r=Veykril Subtree update of `rust-analyzer` r? ````@ghost````
2 parents 251cda5 + ce6a066 commit 9dcdd47

File tree

866 files changed

+33096
-39405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

866 files changed

+33096
-39405
lines changed

src/tools/rust-analyzer/.github/ISSUE_TEMPLATE/bug_report.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
<!--
11-
Troubleshooting guide: https://rust-analyzer.github.io/manual.html#troubleshooting
11+
Troubleshooting guide: https://rust-analyzer.github.io/book/troubleshooting.html
1212
Forum for questions: https://users.rust-lang.org/c/ide/14
1313
1414
Before submitting, please make sure that you're not running into one of these known issues:
@@ -28,7 +28,7 @@ Otherwise please try to provide information which will help us to fix the issue
2828

2929
**repository link (if public, optional)**: (eg. [rust-analyzer](https://github.com/rust-lang/rust-analyzer))
3030

31-
**code snippet to reproduce**:
31+
**code snippet to reproduce**:
3232
```rust
3333
// add your code here
3434

src/tools/rust-analyzer/.github/ISSUE_TEMPLATE/critical_nightly_regression.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
<!--
11-
Troubleshooting guide: https://rust-analyzer.github.io/manual.html#troubleshooting
11+
Troubleshooting guide: https://rust-analyzer.github.io/book/troubleshooting.html
1212
1313
Please try to provide information which will help us to fix the issue faster. Minimal reproducible examples with few dependencies are especially lovely <3.
1414
-->

src/tools/rust-analyzer/.github/workflows/ci.yaml

+124-69
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ env:
1515
CARGO_NET_RETRY: 10
1616
CI: 1
1717
RUST_BACKTRACE: short
18-
RUSTFLAGS: "-D warnings -D elided_lifetimes_in_paths -D explicit_outlives_requirements -D unsafe_op_in_unsafe_fn -D unused_extern_crates -D unused_lifetimes -D unreachable_pub"
1918
RUSTUP_MAX_RETRIES: 10
2019

2120
jobs:
@@ -25,7 +24,6 @@ jobs:
2524
pull-requests: read
2625
outputs:
2726
typescript: ${{ steps.filter.outputs.typescript }}
28-
proc_macros: ${{ steps.filter.outputs.proc_macros }}
2927
steps:
3028
- uses: actions/checkout@v4
3129
- uses: dorny/paths-filter@1441771bbfdd59dcd748680ee64ebd8faab1a242
@@ -34,52 +32,54 @@ jobs:
3432
filters: |
3533
typescript:
3634
- 'editors/code/**'
37-
proc_macros:
38-
- 'crates/tt/**'
39-
- 'crates/proc-macro-api/**'
40-
- 'crates/proc-macro-srv/**'
41-
- 'crates/proc-macro-srv-cli/**'
4235
4336
proc-macro-srv:
44-
needs: changes
45-
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.proc_macros == 'true'
37+
if: github.repository == 'rust-lang/rust-analyzer'
4638
name: proc-macro-srv
4739
runs-on: ubuntu-latest
40+
env:
41+
RUSTFLAGS: "-D warnings"
42+
4843
steps:
4944
- name: Checkout repository
5045
uses: actions/checkout@v4
5146
with:
5247
ref: ${{ github.event.pull_request.head.sha }}
5348

49+
- name: Install rustup-toolchain-install-master
50+
run: cargo install rustup-toolchain-install-master@1.6.0
51+
52+
# Install a pinned rustc commit to avoid surprises
5453
- name: Install Rust toolchain
5554
run: |
56-
rustup update --no-self-update nightly
57-
rustup default nightly
58-
rustup component add --toolchain nightly rust-src rustfmt
55+
RUSTC_VERSION=`cat rust-version`
56+
rustup-toolchain-install-master ${RUSTC_VERSION} -c rust-src -c rustfmt
57+
rustup default ${RUSTC_VERSION}
58+
59+
# Emulate a nightly toolchain, because the toolchain installed above does not have "nightly"
60+
# in its version string.
61+
- name: Emulate a nightly toolchain
62+
run: echo "RUSTC_BOOTSTRAP=1" >> $GITHUB_ENV
63+
5964
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
6065
- name: Install Rust Problem Matcher
61-
if: matrix.os == 'ubuntu-latest'
6266
run: echo "::add-matcher::.github/rust.json"
6367

64-
- name: Cache Dependencies
65-
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
66-
67-
- name: Bump opt-level
68-
if: matrix.os == 'ubuntu-latest'
69-
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
70-
7168
- name: Test
72-
run: cargo test --features sysroot-abi -p rust-analyzer -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
69+
run: cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
70+
71+
- name: Check salsa dependency
72+
run: "! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"
7373

7474
rust:
7575
if: github.repository == 'rust-lang/rust-analyzer'
7676
name: Rust
7777
runs-on: ${{ matrix.os }}
7878
env:
79+
RUSTFLAGS: "-Dwarnings"
7980
CC: deny_c
8081

8182
strategy:
82-
fail-fast: false
8383
matrix:
8484
os: [ubuntu-latest, windows-latest, macos-latest]
8585

@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
rustup update --no-self-update stable
9595
rustup default stable
96-
rustup component add --toolchain stable rust-src
96+
rustup component add --toolchain stable rust-src clippy
9797
# We always use a nightly rustfmt, regardless of channel, because we need
9898
# --file-lines.
9999
rustup toolchain install nightly --profile minimal --component rustfmt
@@ -102,63 +102,122 @@ jobs:
102102
if: matrix.os == 'ubuntu-latest'
103103
run: echo "::add-matcher::.github/rust.json"
104104

105-
- name: Cache Dependencies
106-
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
105+
# - name: Cache Dependencies
106+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
107+
# with:
108+
# workspaces: |
109+
# . -> target
110+
# ./crates/proc-macro-srv/proc-macro-test/imp -> target
107111

108-
- name: Bump opt-level
109-
if: matrix.os == 'ubuntu-latest'
110-
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
112+
- name: Install nextest
113+
uses: taiki-e/install-action@nextest
111114

112115
- name: Codegen checks (rust-analyzer)
116+
if: matrix.os == 'ubuntu-latest'
113117
run: cargo codegen --check
114118

115-
- name: Compile (tests)
116-
run: cargo test --no-run --locked
119+
- name: Compile tests
120+
run: cargo test --no-run
117121

118-
# It's faster to `test` before `build` ¯\_(ツ)_/¯
119-
- name: Compile (rust-analyzer)
120-
if: matrix.os == 'ubuntu-latest'
121-
run: cargo build --quiet
122+
- name: Run tests
123+
run: cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail
122124

123-
- name: Test
124-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
125-
run: cargo test -- --quiet
125+
- name: Cancel parallel jobs
126+
if: failure()
127+
run: |
128+
# https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run
129+
curl -L \
130+
-X POST \
131+
-H "Accept: application/vnd.github.v3+json" \
132+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
133+
-H "X-GitHub-Api-Version: 2022-11-28" \
134+
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
135+
136+
- name: Run Clippy
137+
if: matrix.os == 'macos-latest'
138+
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
126139

127-
- name: Switch to stable toolchain
140+
analysis-stats:
141+
if: github.repository == 'rust-lang/rust-analyzer'
142+
runs-on: ubuntu-latest
143+
env:
144+
RUSTC_BOOTSTRAP: 1
145+
146+
steps:
147+
- name: Checkout repository
148+
uses: actions/checkout@v4
149+
150+
- name: Install Rust toolchain
128151
run: |
129152
rustup update --no-self-update stable
130-
rustup component add --toolchain stable rust-src clippy
131153
rustup default stable
154+
rustup component add rustfmt
132155
133-
- name: Run analysis-stats on rust-analyzer
134-
if: matrix.os == 'ubuntu-latest'
135-
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
156+
# - name: Cache Dependencies
157+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
136158

137-
- name: Run analysis-stats on the rust standard libraries
138-
if: matrix.os == 'ubuntu-latest'
139-
env:
140-
RUSTC_BOOTSTRAP: 1
141-
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/
159+
- name: Bump opt-level
160+
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
142161

143-
- name: clippy
144-
if: matrix.os == 'windows-latest'
145-
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
162+
- run: cargo build -p rust-analyzer
146163

147-
- name: rustfmt
148-
if: matrix.os == 'ubuntu-latest'
149-
run: cargo fmt -- --check
164+
- name: ./rust-analyzer
165+
run: ./target/debug/rust-analyzer analysis-stats . -q
166+
167+
- name: sysroot/lib/rustlib/src/rust/library/
168+
run: ./target/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/ -q
169+
170+
rustfmt:
171+
if: github.repository == 'rust-lang/rust-analyzer'
172+
runs-on: ubuntu-latest
173+
174+
steps:
175+
- name: Checkout repository
176+
uses: actions/checkout@v4
177+
178+
- name: Install Rust toolchain
179+
run: |
180+
rustup update --no-self-update stable
181+
rustup default stable
182+
rustup component add rustfmt
183+
184+
- run: cargo fmt -- --check
185+
186+
miri:
187+
if: github.repository == 'rust-lang/rust-analyzer'
188+
runs-on: ubuntu-latest
189+
190+
steps:
191+
- name: Checkout repository
192+
uses: actions/checkout@v4
193+
194+
- name: Install Rust toolchain
195+
run: |
196+
rustup update --no-self-update nightly
197+
rustup default nightly
198+
rustup component add miri
199+
200+
# - name: Cache Dependencies
201+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
202+
203+
- run: cargo miri test -p intern
150204

151205
# Weird targets to catch non-portable code
152206
rust-cross:
153207
if: github.repository == 'rust-lang/rust-analyzer'
154208
name: Rust Cross
155209
runs-on: ubuntu-latest
156210

211+
strategy:
212+
matrix:
213+
target: [powerpc-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-unknown]
214+
include:
215+
# The rust-analyzer binary is not expected to compile on WASM, but the IDE
216+
# crate should
217+
- target: wasm32-unknown-unknown
218+
ide-only: true
157219
env:
158-
targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
159-
# The rust-analyzer binary is not expected to compile on WASM, but the IDE
160-
# crate should
161-
targets_ide: "wasm32-unknown-unknown"
220+
RUSTFLAGS: "-Dwarnings"
162221

163222
steps:
164223
- name: Checkout repository
@@ -167,19 +226,15 @@ jobs:
167226
- name: Install Rust toolchain
168227
run: |
169228
rustup update --no-self-update stable
170-
rustup target add ${{ env.targets }} ${{ env.targets_ide }}
229+
rustup target add ${{ matrix.target }}
171230
172-
- name: Cache Dependencies
173-
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
231+
# - name: Cache Dependencies
232+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
174233

175-
- name: Check
176-
run: |
177-
for target in ${{ env.targets }}; do
178-
cargo check --target=$target --all-targets
179-
done
180-
for target in ${{ env.targets_ide }}; do
181-
cargo check -p ide --target=$target --all-targets
182-
done
234+
- run: cargo check --target=${{ matrix.target }} --all-targets -p ide
235+
if: ${{ matrix.ide-only }}
236+
- run: cargo check --target=${{ matrix.target }} --all-targets
237+
if: ${{ !matrix.ide-only }}
183238

184239
typescript:
185240
needs: changes
@@ -261,7 +316,7 @@ jobs:
261316
run: typos
262317

263318
conclusion:
264-
needs: [rust, rust-cross, typescript, typo-check, proc-macro-srv]
319+
needs: [rust, rust-cross, typescript, typo-check, proc-macro-srv, miri, rustfmt, analysis-stats]
265320
# We need to ensure this job does *not* get skipped if its dependencies fail,
266321
# because a skipped job is considered a success by GitHub. So we have to
267322
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run

src/tools/rust-analyzer/.github/workflows/release.yaml

+22-7
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,37 @@ jobs:
2929
- os: windows-latest
3030
target: x86_64-pc-windows-msvc
3131
code-target: win32-x64
32+
pgo: clap-rs/clap@v4.5.36
3233
- os: windows-latest
3334
target: i686-pc-windows-msvc
35+
pgo: clap-rs/clap@v4.5.36
3436
- os: windows-latest
3537
target: aarch64-pc-windows-msvc
3638
code-target: win32-arm64
3739
- os: ubuntu-latest
3840
target: x86_64-unknown-linux-gnu
39-
zig_target: x86_64-unknown-linux-gnu.2.28
41+
# Use a container with glibc 2.28
42+
# Zig is not used because it doesn't work with PGO
43+
container: quay.io/pypa/manylinux_2_28_x86_64
4044
code-target: linux-x64
41-
- os: ubuntu-latest
45+
pgo: clap-rs/clap@v4.5.36
46+
- os: ubuntu-24.04-arm
4247
target: aarch64-unknown-linux-gnu
43-
zig_target: aarch64-unknown-linux-gnu.2.28
48+
container: quay.io/pypa/manylinux_2_28_aarch64
4449
code-target: linux-arm64
50+
pgo: clap-rs/clap@v4.5.36
4551
- os: ubuntu-latest
4652
target: arm-unknown-linux-gnueabihf
4753
zig_target: arm-unknown-linux-gnueabihf.2.28
4854
code-target: linux-armhf
4955
- os: macos-13
5056
target: x86_64-apple-darwin
5157
code-target: darwin-x64
52-
- os: macos-13
58+
pgo: clap-rs/clap@v4.5.36
59+
- os: macos-14
5360
target: aarch64-apple-darwin
5461
code-target: darwin-arm64
62+
pgo: clap-rs/clap@v4.5.36
5563

5664
name: dist (${{ matrix.target }})
5765
runs-on: ${{ matrix.os }}
@@ -71,10 +79,17 @@ jobs:
7179
with:
7280
node-version: 22
7381

82+
- name: Install rustup
83+
if: ${{ matrix.container }}
84+
run: |
85+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
86+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
87+
7488
- name: Install Rust toolchain
7589
run: |
7690
rustup update --no-self-update stable
77-
rustup component add rust-src
91+
# llvm-tools contain the llvm-profdata tool which is needed for PGO
92+
rustup component add rust-src ${{ matrix.pgo && 'llvm-tools' || '' }}
7893
rustup target add ${{ matrix.target }}
7994
8095
- name: Install Zig toolchain
@@ -87,11 +102,11 @@ jobs:
87102
88103
- name: Dist (plain)
89104
if: ${{ !matrix.zig_target }}
90-
run: cargo xtask dist --client-patch-version ${{ github.run_number }}
105+
run: cargo xtask dist --client-patch-version ${{ github.run_number }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
91106

92107
- name: Dist (using zigbuild)
93108
if: ${{ matrix.zig_target }}
94-
run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig
109+
run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
95110

96111
- run: npm ci
97112
working-directory: editors/code

0 commit comments

Comments
 (0)