File tree 2 files changed +11
-9
lines changed
2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 5
5
" cargo-miri/Cargo.toml" ,
6
6
" miri-script/Cargo.toml" ,
7
7
],
8
- "rust-analyzer.check.invocationLocation" : " root" ,
9
8
"rust-analyzer.check.invocationStrategy" : " once" ,
10
9
"rust-analyzer.check.overrideCommand" : [
11
- " env" ,
12
- " MIRI_AUTO_OPS=no" ,
13
10
" ./miri" ,
14
11
" clippy" , // make this `check` when working with a locally built rustc
15
12
" --message-format=json" ,
16
13
],
14
+ "rust-analyzer.cargo.extraEnv" : {
15
+ "MIRI_AUTO_OPS" : " no" ,
16
+ "MIRI_IN_RA" : " 1" ,
17
+ },
17
18
// Contrary to what the name suggests, this also affects proc macros.
18
- "rust-analyzer.cargo.buildScripts.invocationLocation" : " root" ,
19
19
"rust-analyzer.cargo.buildScripts.invocationStrategy" : " once" ,
20
20
"rust-analyzer.cargo.buildScripts.overrideCommand" : [
21
- " env" ,
22
- " MIRI_AUTO_OPS=no" ,
23
21
" ./miri" ,
24
22
" check" ,
25
23
" --message-format=json" ,
Original file line number Diff line number Diff line change 3
3
# We want to call the binary directly, so we need to know where it ends up.
4
4
ROOT_DIR=" $( dirname " $0 " ) "
5
5
MIRI_SCRIPT_TARGET_DIR=" $ROOT_DIR " /miri-script/target
6
- # If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output.
7
- if ! [ -t 1 ] && [ -z " $CI " ]; then
6
+ TOOLCHAIN=" +nightly"
7
+ # If we are being invoked for RA, use JSON output and the default toolchain (to make proc-macros
8
+ # work in RA). This needs a different target dir to avoid mixing up the builds.
9
+ if [ -n " $MIRI_IN_RA " ]; then
8
10
MESSAGE_FORMAT=" --message-format=json"
11
+ TOOLCHAIN=" "
12
+ MIRI_SCRIPT_TARGET_DIR=" $MIRI_SCRIPT_TARGET_DIR " /ra
9
13
fi
10
14
# We need a nightly toolchain, for `-Zroot-dir`.
11
- cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path " $ROOT_DIR " /miri-script/Cargo.toml \
15
+ cargo $TOOLCHAIN build $CARGO_EXTRA_FLAGS --manifest-path " $ROOT_DIR " /miri-script/Cargo.toml \
12
16
-Zroot-dir=" $ROOT_DIR " \
13
17
-q --target-dir " $MIRI_SCRIPT_TARGET_DIR " $MESSAGE_FORMAT || \
14
18
( echo " Failed to build miri-script. Is the 'nightly' toolchain installed?" ; exit 1 )
You can’t perform that action at this time.
0 commit comments