Skip to content

Commit 266474a

Browse files
committed
Update suggested config to expand proc macros
1 parent eb83839 commit 266474a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Diff for: src/building/suggested.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
3838
],
3939
"rust-analyzer.procMacro.enable": true,
4040
"rust-analyzer.cargo.buildScripts.enable": true,
41+
"rust-analyzer.cargo.buildScripts.useRustcWrapper": true,
4142
"rust-analyzer.cargo.buildScripts.overrideCommand": [
42-
"cargo",
43+
"./build/$TARGET_TRIPLE/stage0/bin/cargo",
4344
"check",
4445
"-p",
4546
"rustc_driver",
@@ -56,10 +57,10 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
5657
in your `.vscode/settings.json` file. This will ask `rust-analyzer` to use
5758
`./x.py check` to check the sources, and the stage 0 rustfmt to format them.
5859

59-
> NOTE: Make sure to replace `TARGET_TRIPLE` in the `rust-analyzer.rustfmt.overrideCommand`
60-
> setting with the appropriate target triple for your machine. An example of such
61-
> a triple is `x86_64-unknown-linux-gnu`. An easy way to check your target triple
62-
> is to run `rustc -vV` and checking the `host` value of its output.
60+
> NOTE: Make sure to replace `TARGET_TRIPLE` with the appropriate target triple
61+
> for your machine. An example of such a triple is `x86_64-unknown-linux-gnu`.
62+
> An easy way to check your target triple is to run `rustc -vV` and checking the
63+
> `host` value of its output.
6364
6465
If you have enough free disk space and you would like to be able to run `x.py` commands while
6566
rust-analyzer runs in the background, you can also add `--build-dir build-rust-analyzer` to the
@@ -70,6 +71,17 @@ If you're running `coc.nvim`, you can use `:CocLocalConfig` to create a
7071
`editor.formatOnSave: true,` with
7172
`"coc.preferences.formatOnSaveFiletypes": ["rust"],`.
7273

74+
> NOTE: The configuration once suggested disabling build scripts, but after
75+
> the version `2022-04-14` this was fixed by introducing an option for customizing
76+
> the command rust-analyzer uses to run build scripts. Please ensure that `rust-analyzer`
77+
> is up to date before enabling these options. If you do not wish to enable
78+
> `rust-analyzer.cargo.useRustcWrapperForBuildScripts`, the
79+
> `rust-analyzer.cargo.buildScripts.overrideCommand` option should be set as same as
80+
> `rust-analyzer.checkOnSave.overrideCommand` instead of the suggested value.
81+
>
82+
> If you are not developing for the compiler, you do not need to configure the build scripts
83+
> like in the configuration and you can disable proc macros and build scripts.
84+
7385
If running `./x.py check` on save is inconvenient, in VS Code you can use a [Build
7486
Task] instead:
7587

0 commit comments

Comments
 (0)