Morning Rustaceans,

I got some good news for you today: Sanitizer support (only for x86_64 Linux) landed a few hours ago and you can start using it right now. Yeah, that’s right; no need to wait for a new nightly.

First things first, here’s the documentation but the TL;DR is:

# sanitize your application $ RUSTFLAGS="-Z sanitizer=leak" cargo run --target x86_64-unknown-linux-gnu [--example foo] # sanitize your library (through its unit tests) $ RUSTFLAGS="-Z sanitizer=leak" cargo test --target x86_64-unknown-linux-gnu

You can use address , leak , memory or thread as the sanitizer argument.

Next, to use this today before it reaches a nightly.

One of the goodies from the new CI infrastructure is that we get build artifacts for every merged PR. There’s no nice, easy way to use these artifacts right now (I expect that rustup would eventually gain support for these per PR artifacts) but you can use them with some manual work and the help of rustup . Here are the commands to get a rustc binary that includes sanitizer support:

# The sha comes from here https://github.com/rust-lang/rust/pull/39677 # (some manual crawling was required) $ curl -LO https://s3.amazonaws.com/rust-lang-ci/rustc-builds/fd2f8a4536cb9b45abd72b8ff977ad48618602b3/rust-nightly-x86_64-unknown-linux-gnu.tar.gz $ tar xzf rust-nightly-x86_64-unknown-linux-gnu.tar.gz $ mv \ rust-nightly-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu \ rust-nightly-x86_64-unknown-linux-gnu/rustc/lib/rustlib $ rustup toolchain link san rust-nightly-x86_64-unknown-linux-gnu/rustc $ rustup default san # verify: you should get the same output $ rustc -V rustc 1.17.0-nightly (fd2f8a453 2017-02-09)

Now you have a toolchain with sanitizer support. At any time you can revert to an official channel by typing e.g. rustup default nightly .

Finally, I want to thank tmiasko for doing the initial work in this area. We wouldn’t have sanitizer support today without their hard work. Thanks tmiasko!

Happy sanitizing!

P.S. Please report sanitizer bugs (e.g. false positives) to the rust-lang/rust repo and report gotchas and workarounds to the japaric/rust-san repo.