@@ -107,6 +107,41 @@ There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
107
107
` ./run-test.py ` in there to execute it. Like ` ./miri test ` , this respects the
108
108
` MIRI_TEST_TARGET ` environment variable to execute the test for another target.
109
109
110
+ ## Configuring ` rust-analyzer `
111
+
112
+ To configure ` rust-analyzer ` and VS Code for working on Miri, save the following
113
+ to ` .vscode/settings.json ` in your local Miri clone:
114
+
115
+ ``` json
116
+ {
117
+ "rust-analyzer.checkOnSave.overrideCommand" : [
118
+ " ./miri" ,
119
+ " check" ,
120
+ " --message-format=json"
121
+ ],
122
+ "rust-analyzer.rustfmt.extraArgs" : [
123
+ " +nightly"
124
+ ],
125
+ "rust-analyzer.rustcSource" : " discover" ,
126
+ "rust-analyzer.linkedProjects" : [
127
+ " ./Cargo.toml" ,
128
+ " ./cargo-miri/Cargo.toml"
129
+ ]
130
+ }
131
+ ```
132
+
133
+ > #### Note
134
+ >
135
+ > If you are [ building Miri with a locally built rustc] [ ] , set
136
+ > ` rust-analyzer.rustcSource ` to the relative path from your Miri clone to the
137
+ > root ` Cargo.toml ` of the locally built rustc. For example, the path might look
138
+ > like ` ../rust/Cargo.toml ` .
139
+
140
+ See the rustc-dev-guide's docs on [ "Configuring ` rust-analyzer ` for ` rustc ` "] [ rdg-r-a ]
141
+ for more information about configuring VS Code and ` rust-analyzer ` .
142
+
143
+ [ rdg-r-a ] : https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc
144
+
110
145
## Advanced topic: other build environments
111
146
112
147
We described above the simplest way to get a working build environment for Miri,
@@ -132,6 +167,8 @@ rustc. This avoids blocking all Miri development on landing a big PR.
132
167
133
168
### Building Miri with a locally built rustc
134
169
170
+ [ building Miri with a locally built rustc ] : #building-miri-with-a-locally-built-rustc
171
+
135
172
A big part of the Miri driver lives in rustc, so working on Miri will sometimes
136
173
require using a locally built rustc. The bug you want to fix may actually be on
137
174
the rustc side, or you just need to get more detailed trace of the execution
0 commit comments