Skip to content

Commit 9bb47c7

Browse files
committed
merge main
2 parents 60bdb2d + 8365cf8 commit 9bb47c7

File tree

873 files changed

+30225
-37017
lines changed

Some content is hidden

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

873 files changed

+30225
-37017
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ indent_size = 2
1515

1616
[*.{yml,yaml}]
1717
indent_size = 2
18+
19+
[COMMIT_EDITMSG]
20+
max_line_length = unset

.github/workflows/ci.yaml

+129-75
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,23 +32,46 @@ jobs:
3432
filters: |
3533
typescript:
3634
- 'editors/code/**'
37-
proc_macros:
38-
- 'crates/proc-macro-api/**'
39-
- 'crates/proc-macro-srv/**'
40-
- 'crates/proc-macro-srv-cli/**'
35+
36+
proc-macro-srv:
37+
if: github.repository == 'rust-lang/rust-analyzer'
38+
name: proc-macro-srv
39+
runs-on: ubuntu-latest
40+
env:
41+
RUSTFLAGS: "-D warnings"
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
with:
47+
ref: ${{ github.event.pull_request.head.sha }}
48+
49+
- name: Install Rust toolchain
50+
run: |
51+
rustup update --no-self-update nightly
52+
rustup default nightly
53+
rustup component add --toolchain nightly rust-src rustfmt
54+
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
55+
- name: Install Rust Problem Matcher
56+
run: echo "::add-matcher::.github/rust.json"
57+
58+
# We don't cache this job, as it will be invalidated every day due to nightly usage
59+
60+
- name: Test
61+
run: cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
62+
63+
- name: Check salsa dependency
64+
run: "! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"
4165

4266
rust:
43-
needs: changes
4467
if: github.repository == 'rust-lang/rust-analyzer'
4568
name: Rust
4669
runs-on: ${{ matrix.os }}
4770
env:
71+
RUSTFLAGS: "-Dwarnings"
4872
CC: deny_c
49-
RUST_CHANNEL: "${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable' }}"
50-
USE_SYSROOT_ABI: "${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || '' }}"
5173

5274
strategy:
53-
fail-fast: false
5475
matrix:
5576
os: [ubuntu-latest, windows-latest, macos-latest]
5677

@@ -62,77 +83,121 @@ jobs:
6283

6384
- name: Install Rust toolchain
6485
run: |
65-
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
66-
rustup default ${{ env.RUST_CHANNEL }}
67-
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rust-src
86+
rustup update --no-self-update stable
87+
rustup default stable
88+
rustup component add --toolchain stable rust-src clippy
6889
# We always use a nightly rustfmt, regardless of channel, because we need
6990
# --file-lines.
70-
rustup toolchain add nightly --profile minimal
71-
rustup component add --toolchain nightly rustfmt
91+
rustup toolchain install nightly --profile minimal --component rustfmt
7292
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
7393
- name: Install Rust Problem Matcher
7494
if: matrix.os == 'ubuntu-latest'
7595
run: echo "::add-matcher::.github/rust.json"
7696

77-
- name: Cache Dependencies
78-
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
79-
with:
80-
key: ${{ env.RUST_CHANNEL }}
97+
# - name: Cache Dependencies
98+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
99+
# with:
100+
# workspaces: |
101+
# . -> target
102+
# ./crates/proc-macro-srv/proc-macro-test/imp -> target
81103

82-
- name: Bump opt-level
83-
if: matrix.os == 'ubuntu-latest'
84-
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
104+
- uses: taiki-e/install-action@nextest
85105

86106
- name: Codegen checks (rust-analyzer)
107+
if: matrix.os == 'ubuntu-latest'
87108
run: cargo codegen --check
88109

89110
- name: Compile (tests)
90-
run: cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
91-
92-
# It's faster to `test` before `build` ¯\_(ツ)_/¯
93-
- name: Compile (rust-analyzer)
94-
if: matrix.os == 'ubuntu-latest'
95-
run: cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
111+
run: cargo test --no-run
96112

97113
- name: Test
98-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
99-
run: cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
114+
run: cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail
115+
116+
- name: clippy
117+
if: matrix.os == 'macos-latest'
118+
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
119+
120+
analysis-stats:
121+
if: github.repository == 'rust-lang/rust-analyzer'
122+
runs-on: ubuntu-latest
123+
env:
124+
RUSTC_BOOTSTRAP: 1
100125

101-
- name: Switch to stable toolchain
126+
steps:
127+
- name: Checkout repository
128+
uses: actions/checkout@v4
129+
130+
- name: Install Rust toolchain
102131
run: |
103132
rustup update --no-self-update stable
104-
rustup component add --toolchain stable rust-src clippy
105133
rustup default stable
134+
rustup component add rustfmt
106135
107-
- name: Run analysis-stats on rust-analyzer
108-
if: matrix.os == 'ubuntu-latest'
109-
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
136+
# - name: Cache Dependencies
137+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
110138

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

117-
- name: clippy
118-
if: matrix.os == 'windows-latest'
119-
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
142+
- run: cargo build -p rust-analyzer
120143

121-
- name: rustfmt
122-
if: matrix.os == 'ubuntu-latest'
123-
run: cargo fmt -- --check
144+
- name: ./rust-analyzer
145+
run: ./target/debug/rust-analyzer analysis-stats . -q
146+
147+
- name: sysroot/lib/rustlib/src/rust/library/
148+
run: ./target/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/ -q
149+
150+
rustfmt:
151+
if: github.repository == 'rust-lang/rust-analyzer'
152+
runs-on: ubuntu-latest
153+
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v4
157+
158+
- name: Install Rust toolchain
159+
run: |
160+
rustup update --no-self-update stable
161+
rustup default stable
162+
rustup component add rustfmt
163+
164+
- run: cargo fmt -- --check
165+
166+
miri:
167+
if: github.repository == 'rust-lang/rust-analyzer'
168+
runs-on: ubuntu-latest
169+
170+
steps:
171+
- name: Checkout repository
172+
uses: actions/checkout@v4
173+
174+
- name: Install Rust toolchain
175+
run: |
176+
rustup update --no-self-update nightly
177+
rustup default nightly
178+
rustup component add miri
179+
180+
# - name: Cache Dependencies
181+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
182+
183+
- run: cargo miri test -p intern
124184

125185
# Weird targets to catch non-portable code
126186
rust-cross:
127187
if: github.repository == 'rust-lang/rust-analyzer'
128188
name: Rust Cross
129189
runs-on: ubuntu-latest
130190

191+
strategy:
192+
matrix:
193+
target: [powerpc-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-unknown]
194+
include:
195+
# The rust-analyzer binary is not expected to compile on WASM, but the IDE
196+
# crate should
197+
- target: wasm32-unknown-unknown
198+
ide-only: true
131199
env:
132-
targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
133-
# The rust-analyzer binary is not expected to compile on WASM, but the IDE
134-
# crate should
135-
targets_ide: "wasm32-unknown-unknown"
200+
RUSTFLAGS: "-Dwarnings"
136201

137202
steps:
138203
- name: Checkout repository
@@ -141,23 +206,19 @@ jobs:
141206
- name: Install Rust toolchain
142207
run: |
143208
rustup update --no-self-update stable
144-
rustup target add ${{ env.targets }} ${{ env.targets_ide }}
209+
rustup target add ${{ matrix.target }}
145210
146-
- name: Cache Dependencies
147-
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
211+
# - name: Cache Dependencies
212+
# uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
148213

149-
- name: Check
150-
run: |
151-
for target in ${{ env.targets }}; do
152-
cargo check --target=$target --all-targets
153-
done
154-
for target in ${{ env.targets_ide }}; do
155-
cargo check -p ide --target=$target --all-targets
156-
done
214+
- run: cargo check --target=${{ matrix.target }} --all-targets -p ide
215+
if: ${{ matrix.ide-only }}
216+
- run: cargo check --target=${{ matrix.target }} --all-targets
217+
if: ${{ !matrix.ide-only }}
157218

158219
typescript:
159220
needs: changes
160-
if: github.repository == 'rust-lang/rust-analyzer'
221+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
161222
name: TypeScript
162223
strategy:
163224
fail-fast: false
@@ -169,21 +230,18 @@ jobs:
169230
steps:
170231
- name: Checkout repository
171232
uses: actions/checkout@v4
172-
if: needs.changes.outputs.typescript == 'true'
173233

174234
- name: Install Nodejs
175235
uses: actions/setup-node@v4
176236
with:
177237
node-version: 22
178-
if: needs.changes.outputs.typescript == 'true'
179238

180239
- name: Install xvfb
181-
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
240+
if: matrix.os == 'ubuntu-latest'
182241
run: sudo apt-get install -y xvfb
183242

184243
- run: npm ci
185244
working-directory: ./editors/code
186-
if: needs.changes.outputs.typescript == 'true'
187245

188246
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
189247
# if: runner.os == 'Linux'
@@ -192,35 +250,31 @@ jobs:
192250
# If this steps fails, your code's type integrity might be wrong at some places at TypeScript level.
193251
- run: npm run typecheck
194252
working-directory: ./editors/code
195-
if: needs.changes.outputs.typescript == 'true'
196253

197254
# You may fix the code automatically by running `npm run lint:fix` if this steps fails.
198255
- run: npm run lint
199256
working-directory: ./editors/code
200-
if: needs.changes.outputs.typescript == 'true'
201257

202258
# To fix this steps, please run `npm run format`.
203259
- run: npm run format:check
204260
working-directory: ./editors/code
205-
if: needs.changes.outputs.typescript == 'true'
206261

207262
- name: Run VS Code tests (Linux)
208-
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
263+
if: matrix.os == 'ubuntu-latest'
209264
env:
210265
VSCODE_CLI: 1
211266
run: xvfb-run npm test
212267
working-directory: ./editors/code
213268

214269
- name: Run VS Code tests (Windows)
215-
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
270+
if: matrix.os == 'windows-latest'
216271
env:
217272
VSCODE_CLI: 1
218273
run: npm test
219274
working-directory: ./editors/code
220275

221276
- run: npm run package --scripts-prepend-node-path
222277
working-directory: ./editors/code
223-
if: needs.changes.outputs.typescript == 'true'
224278

225279
typo-check:
226280
name: Typo Check
@@ -242,7 +296,7 @@ jobs:
242296
run: typos
243297

244298
conclusion:
245-
needs: [rust, rust-cross, typescript, typo-check]
299+
needs: [rust, rust-cross, typescript, typo-check, proc-macro-srv, miri, rustfmt, analysis-stats]
246300
# We need to ensure this job does *not* get skipped if its dependencies fail,
247301
# because a skipped job is considered a success by GitHub. So we have to
248302
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -257,5 +311,5 @@ jobs:
257311
run: |
258312
# Print the dependent jobs to see them in the CI log
259313
jq -C <<< '${{ toJson(needs) }}'
260-
# Check if all jobs that we depend on (in the needs array) were successful.
261-
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
314+
# Check if all jobs that we depend on (in the needs array) were successful (or have been skipped).
315+
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)