是的,您可以将特殊标志传递给 rustc ,名为 --pretty=expanded :
% cat test.rs
fn main() {
println!("Hello world");
}
% rustc -Z unstable-options --pretty=expanded test.rs
#![feature(no_std)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate "std" as std;
fn main() {
::std::old_io::stdio::println_args(::std::fmt::Arguments::new_v1({
static __STATIC_FMTSTR:
&'static [&'static str]
=
&["Hello world"];
__STATIC_FMTSTR
},
&match ()
{
()
=>
[],
}));
}
但是,您需要先通过 -Z unstable-options 来允许它 .
从Rust 1.1开始,您可以将这些参数传递给Cargo,如下所示:
cargo rustc -- -Z unstable-options --pretty=expanded