cargo rustc for passing arbitrary flags to rustc
cargo rustc
is a new subcommand for Cargo that allows you to pass arbitraryrustc
flags through Cargo.
For example, Cargo does not have a way to pass unstable flags built-in. Butif we'd like to use print-type-sizes
to see what layout information ourtypes have, we can run this:
$ cargo rustc -- -Z print-type-sizes
And we'll get a bunch of output describing the size of our types.
Note
cargo rustc
only passes these flags to invocations of your crate, and not to any rustc
invocations used to build dependencies. If you'd like to do that, see $RUSTFLAGS
.