Skip to content

Commit 1852945

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 852f15c commit 1852945

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,14 @@ Select which editor you would like to set up [default: None]: ";
586586
"b5dd299b93dca3ceeb9b335f929293cb3d4bf4977866fbe7ceeac2a8a9f99088",
587587
"631c837b0e98ae35fd48b0e5f743b1ca60adadf2d0a2b23566ba25df372cf1a9",
588588
"080955765db84bb6cbf178879f489c4e2369397626a6ecb3debedb94a9d0b3ce",
589+
"2e6f4ff014b12c953e106dab1cf4a0c17f8565edd8cfd545bfaf879ab6591db0",
589590
],
590591
EditorKind::Helix => &[
591592
"2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233",
592593
"6736d61409fbebba0933afd2e4c44ff2f97c1cb36cf0299a7f4a7819b8775040",
593594
"f252dcc30ca85a193a699581e5e929d5bd6c19d40d7a7ade5e257a9517a124a5",
594595
"198c195ed0c070d15907b279b8b4ea96198ca71b939f5376454f3d636ab54da5",
596+
"0534d7d551acae148b23b9612e6ad8bc85beed19d23449dea8573f76222792d1",
595597
],
596598
EditorKind::Vim | EditorKind::VsCode => &[
597599
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8",
@@ -607,12 +609,14 @@ Select which editor you would like to set up [default: None]: ";
607609
"e53e9129ca5ee5dcbd6ec8b68c2d87376474eb154992deba3c6d9ab1703e0717",
608610
"f954316090936c7e590c253ca9d524008375882fa13c5b41d7e2547a896ff893",
609611
"701b73751efd7abd6487f2c79348dab698af7ac4427b79fa3d2087c867144b12",
612+
"9a8b324881b8c0c5b2b6502160befc8f630446d334a7a42accfa158acb6ec8fc",
610613
],
611614
EditorKind::Zed => &[
612615
"bbce727c269d1bd0c98afef4d612eb4ce27aea3c3a8968c5f10b31affbc40b6c",
613616
"a5380cf5dd9328731aecc5dfb240d16dac46ed272126b9728006151ef42f5909",
614617
"2e96bf0d443852b12f016c8fc9840ab3d0a2b4fe0b0fb3a157e8d74d5e7e0e26",
615618
"4fadd4c87389a601a27db0d3d74a142fa3a2e656ae78982e934dbe24bee32ad6",
619+
"4412b1a95a7760acdd0eb1f38d767d352ee3321b60435e4d675d2444495b0942",
616620
],
617621
}
618622
}

src/etc/rust_analyzer_eglot.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
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"
@@ -15,14 +17,16 @@
1517
"src/tools/rust-analyzer/Cargo.toml"]
1618
:rustfmt ( :overrideCommand ["build/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
:sysrootSrc "./library"
2832
:extraEnv (:RUSTC_BOOTSTRAP "1"))

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]
@@ -58,5 +58,5 @@ overrideCommand = [
5858
"check",
5959
"--json-output",
6060
"--build-dir",
61-
"build/rust-analyzer",
61+
"build-rust-analyzer",
6262
]

src/etc/rust_analyzer_settings.json

Lines changed: 5 additions & 1 deletion
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": [
@@ -19,14 +21,16 @@
1921
"${workspaceFolder}/build/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
],
3236
"rust-analyzer.cargo.sysrootSrc": "./library",

src/etc/rust_analyzer_zed.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
"enable": true,
88
"invocationLocation": "root",
99
"invocationStrategy": "once",
10-
"overrideCommand": ["python3", "x.py", "check", "--json-output"]
10+
"overrideCommand": [
11+
"python3",
12+
"x.py",
13+
"check",
14+
"--json-output",
15+
"--build-dir",
16+
"build-rust-analyzer"
17+
]
1118
},
1219
"extraEnv": {
1320
"RUSTC_BOOTSTRAP": "1"
@@ -17,7 +24,14 @@
1724
"check": {
1825
"invocationLocation": "root",
1926
"invocationStrategy": "once",
20-
"overrideCommand": ["python3", "x.py", "check", "--json-output"]
27+
"overrideCommand": [
28+
"python3",
29+
"x.py",
30+
"check",
31+
"--json-output",
32+
"--build-dir",
33+
"build-rust-analyzer"
34+
]
2135
},
2236
"linkedProjects": [
2337
"Cargo.toml",
@@ -29,7 +43,7 @@
2943
],
3044
"procMacro": {
3145
"enable": true,
32-
"server": "build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
46+
"server": "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
3347
},
3448
"rustc": {
3549
"source": "./Cargo.toml"

0 commit comments

Comments
 (0)