Skip to content

Commit 3d1b4a1

Browse files
committed
Update suggested config to expand proc macros
1 parent 03fafb5 commit 3d1b4a1

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
@@ -39,30 +39,42 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
3939
"editor.formatOnSave": true,
4040
"rust-analyzer.cargo.buildScripts.enable": true,
4141
"rust-analyzer.cargo.buildScripts.overrideCommand": [
42-
"cargo",
42+
"./build/$TARGET_TRIPLE/stage0/bin/cargo",
4343
"check",
4444
"-p",
4545
"rustc_driver",
4646
"--message-format=json"
4747
],
4848
"rust-analyzer.rustc.source": "./Cargo.toml",
4949
"rust-analyzer.procMacro.enable": true,
50+
"rust-analyzer.cargo.useRustcWrapperForBuildScripts": true
5051
}
5152
```
5253

5354
in your `.vscode/settings.json` file. This will ask `rust-analyzer` to use
5455
`./x.py check` to check the sources, and the stage 0 rustfmt to format them.
5556

56-
> NOTE: Make sure to replace `TARGET_TRIPLE` in the `rust-analyzer.rustfmt.overrideCommand`
57-
> setting with the appropriate target triple for your machine. An example of such
58-
> a triple is `x86_64-unknown-linux-gnu`. An easy way to check your target triple
59-
> is to run `rustc -vV` and checking the `host` value of its output.
57+
> NOTE: Make sure to replace `TARGET_TRIPLE` with the appropriate target triple
58+
> for your machine. An example of such a triple is `x86_64-unknown-linux-gnu`.
59+
> An easy way to check your target triple is to run `rustc -vV` and checking the
60+
> `host` value of its output.
6061
6162
If you're running `coc.nvim`, you can use `:CocLocalConfig` to create a
6263
`.vim/coc-settings.json` and enter the same settings as above, but replacing
6364
`editor.formatOnSave: true,` with
6465
`"coc.preferences.formatOnSaveFiletypes": ["rust"],`.
6566

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

0 commit comments

Comments
 (0)