rustc

The Rust compiler.

Deny

#![deny(missing_docs)]
#![forbid(unsafe_code)]

See also High Assurance Rust#rustc.

Output LLVM

To output LLVM:

rustc --emit=llvm-ir file.rs
rustc --emit=llvm-bc file.rs

https://doc.rust-lang.org/rustc/command-line-arguments.html#--emit-specifies-the-types-of-output-files-to-generate

Sanitizing

See also cargo-careful.

More generally, see Sanitizers.

RUSTFLAGS="-Z sanitizer=address" cargo +nightly test --target x86_64-unknown-linux-gnu

Hacking

Fuzzing

Getting files:

mkdir rs
for repo in rust-lang/glacier; do
  git clone --jobs 4 --depth 1 https://github.com/$repo
  for f in ./$(basename ${repo})/**/*.rs; do 
    cp "${f}" rs/"$(basename "${repo}")-$(sha256sum "${f}" | head -c 5)-$(basename "${f}")"
  done
done