Skip to content

Commit 8d57763

Browse files
committed
make rust-analyzer settings use dedicated directory
This avoids rust-analyzer having to wait for a build lock due to ./x running other commands (and the other way around).
1 parent 1aa5b22 commit 8d57763

File tree

5 files changed

+41
-14
lines changed

5 files changed

+41
-14
lines changed

src/bootstrap/src/core/build_steps/setup.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,15 @@ Select which editor you would like to set up [default: None]: ";
587587
"631c837b0e98ae35fd48b0e5f743b1ca60adadf2d0a2b23566ba25df372cf1a9",
588588
"080955765db84bb6cbf178879f489c4e2369397626a6ecb3debedb94a9d0b3ce",
589589
"f501475c6654187091c924ae26187fa5791d74d4a8ab3fb61fbbe4c0275aade1",
590+
"e260553b71e4773c30a63c4b23b42b279fc73e72f95b775c47b7b7c511c51595",
590591
],
591592
EditorKind::Helix => &[
592593
"2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233",
593594
"6736d61409fbebba0933afd2e4c44ff2f97c1cb36cf0299a7f4a7819b8775040",
594595
"f252dcc30ca85a193a699581e5e929d5bd6c19d40d7a7ade5e257a9517a124a5",
595596
"198c195ed0c070d15907b279b8b4ea96198ca71b939f5376454f3d636ab54da5",
596597
"1c43ead340b20792b91d02b08494ee68708e7e09f56b6766629b4b72079208f1",
598+
"6ae2fecd7bc82d11dc4495f5c6a3084e0a2dfea11fede1ecc88327ee1e70aa07",
597599
],
598600
EditorKind::Vim | EditorKind::VsCode => &[
599601
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8",
@@ -610,13 +612,15 @@ Select which editor you would like to set up [default: None]: ";
610612
"f954316090936c7e590c253ca9d524008375882fa13c5b41d7e2547a896ff893",
611613
"701b73751efd7abd6487f2c79348dab698af7ac4427b79fa3d2087c867144b12",
612614
"a61df796c0c007cb6512127330564e49e57d558dec715703916a928b072a1054",
615+
"02a49ac2d31f00ef6e4531c44e00dac51cea895112e480553f1ba060b3942a47",
613616
],
614617
EditorKind::Zed => &[
615618
"bbce727c269d1bd0c98afef4d612eb4ce27aea3c3a8968c5f10b31affbc40b6c",
616619
"a5380cf5dd9328731aecc5dfb240d16dac46ed272126b9728006151ef42f5909",
617620
"2e96bf0d443852b12f016c8fc9840ab3d0a2b4fe0b0fb3a157e8d74d5e7e0e26",
618621
"4fadd4c87389a601a27db0d3d74a142fa3a2e656ae78982e934dbe24bee32ad6",
619622
"f0bb3d23ab1a49175ab0ef5c4071af95bb03d01d460776cdb716d91333443382",
623+
"5ef83292111d9a8bb63b6afc3abf42d0bc78fe24985f0d2e039e73258b5dab8f",
620624
],
621625
}
622626
}

src/etc/rust_analyzer_eglot.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@
66
:overrideCommand ["python3"
77
"x.py"
88
"check"
9+
"--build-dir"
10+
"build-rust-analyzer"
911
"--json-output"])
1012
:linkedProjects ["Cargo.toml"
1113
"compiler/rustc_codegen_cranelift/Cargo.toml"
1214
"compiler/rustc_codegen_gcc/Cargo.toml"
1315
"library/Cargo.toml"
1416
"src/bootstrap/Cargo.toml"
1517
"src/tools/rust-analyzer/Cargo.toml"]
16-
:rustfmt ( :overrideCommand ["build/host/rustfmt/bin/rustfmt"
18+
:rustfmt ( :overrideCommand ["build-rust-analyzer/host/rustfmt/bin/rustfmt"
1719
"--edition=2024"])
18-
:procMacro ( :server "build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
20+
:procMacro ( :server "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
1921
:enable t)
2022
:cargo ( :buildScripts ( :enable t
2123
:invocationLocation "root"
2224
:invocationStrategy "once"
2325
:overrideCommand ["python3"
2426
"x.py"
2527
"check"
28+
"--build-dir"
29+
"build-rust-analyzer"
2630
"--json-output"
2731
"--compile-time-deps"])]
2832
:sysrootSrc "./library"

src/etc/rust_analyzer_helix.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This config uses a separate build directory for rust-analyzer,
22
# so that r-a's checks don't block user `x` commands and vice-verse.
3-
# R-a's build directory is located in `build/rust-analyzer`.
3+
# R-a's build directory is located in `build-rust-analyzer`.
44
#
55
# To build rustfmt and proc macro server for r-a run the following command:
66
# ```
7-
# x b proc-macro-srv-cli rustfmt --stage 0 --build-dir build/rust-analyzer
7+
# x b proc-macro-srv-cli rustfmt --stage 0 --build-dir build-rust-analyzer
88
# ```
99

1010
[language-server.rust-analyzer.config]
@@ -26,17 +26,17 @@ overrideCommand = [
2626
"check",
2727
"--json-output",
2828
"--build-dir",
29-
"build/rust-analyzer",
29+
"build-rust-analyzer",
3030
]
3131

3232
[language-server.rust-analyzer.config.rustfmt]
3333
overrideCommand = [
34-
"build/rust-analyzer/host/rustfmt/bin/rustfmt",
34+
"build-rust-analyzer/host/rustfmt/bin/rustfmt",
3535
"--edition=2024"
3636
]
3737

3838
[language-server.rust-analyzer.config.procMacro]
39-
server = "build/rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
39+
server = "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
4040
enable = true
4141

4242
[language-server.rust-analyzer.config.rustc]
@@ -59,5 +59,5 @@ overrideCommand = [
5959
"--json-output",
6060
"--build-dir",
6161
"build/rust-analyzer",
62-
"--compile-time-deps"
62+
"--compile-time-deps",
6363
]

src/etc/rust_analyzer_settings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"python3",
66
"x.py",
77
"check",
8+
"--build-dir",
9+
"build-rust-analyzer",
810
"--json-output"
911
],
1012
"rust-analyzer.linkedProjects": [
@@ -16,17 +18,19 @@
1618
"src/tools/rust-analyzer/Cargo.toml"
1719
],
1820
"rust-analyzer.rustfmt.overrideCommand": [
19-
"${workspaceFolder}/build/host/rustfmt/bin/rustfmt",
21+
"${workspaceFolder}/build-rust-analyzer/host/rustfmt/bin/rustfmt",
2022
"--edition=2024"
2123
],
22-
"rust-analyzer.procMacro.server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv",
24+
"rust-analyzer.procMacro.server": "${workspaceFolder}/build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv",
2325
"rust-analyzer.procMacro.enable": true,
2426
"rust-analyzer.cargo.buildScripts.enable": true,
2527
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
2628
"rust-analyzer.cargo.buildScripts.overrideCommand": [
2729
"python3",
2830
"x.py",
2931
"check",
32+
"--build-dir",
33+
"build-rust-analyzer",
3034
"--json-output",
3135
"--compile-time-deps"
3236
],

src/etc/rust_analyzer_zed.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
"enable": true,
88
"invocationLocation": "root",
99
"invocationStrategy": "once",
10-
"overrideCommand": ["python3", "x.py", "check", "--json-output", "--compile-time-deps"]
10+
"overrideCommand": [
11+
"python3",
12+
"x.py",
13+
"check",
14+
"--build-dir",
15+
"build-rust-analyzer",
16+
"--compile-time-deps",
17+
"--json-output"
18+
]
1119
},
1220
"extraEnv": {
1321
"RUSTC_BOOTSTRAP": "1"
@@ -17,7 +25,14 @@
1725
"check": {
1826
"invocationLocation": "root",
1927
"invocationStrategy": "once",
20-
"overrideCommand": ["python3", "x.py", "check", "--json-output"]
28+
"overrideCommand": [
29+
"python3",
30+
"x.py",
31+
"check",
32+
"--json-output",
33+
"--build-dir",
34+
"build-rust-analyzer"
35+
]
2136
},
2237
"linkedProjects": [
2338
"Cargo.toml",
@@ -29,14 +44,14 @@
2944
],
3045
"procMacro": {
3146
"enable": true,
32-
"server": "build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
47+
"server": "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
3348
},
3449
"rustc": {
3550
"source": "./Cargo.toml"
3651
},
3752
"rustfmt": {
3853
"overrideCommand": [
39-
"build/host/rustfmt/bin/rustfmt",
54+
"build-rust-analyzer/host/rustfmt/bin/rustfmt",
4055
"--edition=2024"
4156
]
4257
},

0 commit comments

Comments
 (0)