@@ -50,7 +50,7 @@ program, and cannot run all programs:
5050[ `copy_nonoverlapping` ] : https://doc.rust-lang.org/stable/std/ptr/fn.copy_nonoverlapping.html
5151
5252
53- ## Running Miri on your own project (and its test suite)
53+ ## Using Miri
5454
5555Install Miri via ` rustup ` :
5656
@@ -183,131 +183,12 @@ Moreover, Miri recognizes some environment variables:
183183 architecture to test against. ` miri ` and ` cargo miri ` accept the ` --target `
184184 flag for the same purpose.
185185
186- ## Development and Debugging
187-
188- If you want to hack on miri yourself, great! Here are some resources you might
189- find useful.
190-
191- ### Using a nightly rustc
192-
193- Miri heavily relies on internal rustc interfaces to execute MIR. Still, some
194- things (like adding support for a new intrinsic or a shim for an external
195- function being called) can be done by working just on the Miri side.
196-
197- To prepare, make sure you are using a nightly Rust compiler. Then you should be
198- able to just ` cargo build ` Miri.
199-
200- In case this fails, your nightly might be incompatible with Miri master. The
201- ` rust-version ` file contains the commit hash of rustc that Miri is currently
202- tested against; you can use that to find a nightly that works or you might have
203- to wait for the next nightly to get released. You can also use
204- [ ` rustup-toolchain-install-master ` ] ( https://github.com/kennytm/rustup-toolchain-install-master )
205- to install that exact version of rustc as a toolchain:
206- ```
207- rustup-toolchain-install-master $(cat rust-version) -c rust-src
208- ```
209-
210- Another common problem is outdated dependencies: Miri does not come with a
211- lockfile (it cannot, due to how it gets embedded into the rustc build). So you
212- have to run ` cargo update ` every now and then yourself to make sure you are
213- using the latest versions of everything (which is what gets tested on CI).
214-
215- ### Testing the Miri driver
216- [ testing-miri ] : #testing-the-miri-driver
217-
218- The Miri driver in the ` miri ` binary is the "heart" of Miri: it is basically a
219- version of ` rustc ` that, instead of compiling your code, runs it. It accepts
220- all the same flags as ` rustc ` (though the ones only affecting code generation
221- and linking obviously will have no effect) [ and more] [ miri-flags ] .
222-
223- Running the Miri driver requires some fiddling with environment variables, so
224- the ` miri ` script helps you do that. For example, you can run the driver on a
225- particular file by doing
226-
227- ``` sh
228- ./miri run tests/run-pass/format.rs
229- ./miri run tests/run-pass/hello.rs --target i686-unknown-linux-gnu
230- ```
231-
232- and you can run the test suite using:
233-
234- ```
235- ./miri test
236- ```
237-
238- ` ./miri test FILTER ` only runs those tests that contain ` FILTER ` in their
239- filename (including the base directory, e.g. ` ./miri test fail ` will run all
240- compile-fail tests).
241-
242- You can get a trace of which MIR statements are being executed by setting the
243- ` MIRI_LOG ` environment variable. For example:
244-
245- ``` sh
246- MIRI_LOG=info ./miri run tests/run-pass/vecs.rs
247- ```
248-
249- Setting ` MIRI_LOG ` like this will configure logging for Miri itself as well as
250- the ` rustc::mir::interpret ` and ` rustc_mir::interpret ` modules in rustc. You
251- can also do more targeted configuration, e.g. the following helps debug the
252- stacked borrows implementation:
253-
254- ``` sh
255- MIRI_LOG=rustc_mir::interpret=info,miri::stacked_borrows ./miri run tests/run-pass/vecs.rs
256- ```
257-
258- In addition, you can set ` MIRI_BACKTRACE=1 ` to get a backtrace of where an
259- evaluation error was originally raised.
260-
261- ### Testing ` cargo miri `
262-
263- Working with the driver directly gives you full control, but you also lose all
264- the convenience provided by cargo. Once your test case depends on a crate, it
265- is probably easier to test it with the cargo wrapper. You can install your
266- development version of Miri using
267-
268- ```
269- ./miri install
270- ```
271-
272- and then you can use it as if it was installed by ` rustup ` . Make sure you use
273- the same toolchain when calling ` cargo miri ` that you used when installing Miri!
274-
275- There's a test for the cargo wrapper in the ` test-cargo-miri ` directory; run
276- ` ./run-test.py ` in there to execute it.
277-
278- ### Using a locally built rustc
279-
280- A big part of the Miri driver lives in rustc, so working on Miri will sometimes
281- require using a locally built rustc. The bug you want to fix may actually be on
282- the rustc side, or you just need to get more detailed trace of the execution
283- than what is possible with release builds -- in both cases, you should develop
284- miri against a rustc you compiled yourself, with debug assertions (and hence
285- tracing) enabled.
286-
287- The setup for a local rustc works as follows:
288- ``` sh
289- git clone https://github.com/rust-lang/rust/ rustc
290- cd rustc
291- cp config.toml.example config.toml
292- # Now edit `config.toml` and set `debug-assertions = true`.
293- # This step can take 30 minutes and more.
294- ./x.py build src/rustc
295- # If you change something, you can get a faster rebuild by doing
296- ./x.py --keep-stage 0 build src/rustc
297- # You may have to change the architecture in the next command
298- rustup toolchain link custom build/x86_64-unknown-linux-gnu/stage2
299- # Now cd to your Miri directory, then configure rustup
300- rustup override set custom
301- ```
302-
303- With this, you should now have a working development setup! See
304- [ above] [ testing-miri ] for how to proceed working with the Miri driver.
305-
306186## Contributing and getting help
307187
308- Check out the issues on this GitHub repository for some ideas. There's lots that
309- needs to be done that I haven't documented in the issues yet, however. For more
310- ideas or help with running or hacking on Miri, you can open an issue here on
188+ If you want to contribute to Miri, great! Please check out our
189+ [ contribution guide] ( CONTRIBUTING.md ) .
190+
191+ For help with running Miri, you can open an issue here on
311192GitHub or contact us (` oli-obk ` and ` RalfJ ` ) on the [ Rust Zulip] .
312193
313194[ Rust Zulip ] : https://rust-lang.zulipchat.com
0 commit comments