编译器参数
$ rustc [OPTIONS] INPUTfn main() { if cfg!(hello) { println!("world!"); } }$ rustc --cfg hello hello.rs// myhello.rs /// 这个函数仅仅向标签输出打印 Hello World! /// 不要忘记要把它标记为 pub 哦。 pub fn print_hello() { println!("Hello World!"); }$ rustc --crate-type staticlib myhello.rs// main.rs // 指定链接库 myhello extern crate myhello; fn main() { // 调用库函数 myhello::print_hello(); }$ rustc -L. -lmyhello main.rs$ rustc --crate-name foo main.rs$ rustc --emit asm,llvm-ir,obj main.rs$ rustc --emit asm=output.S,llvm-ir=output.ir main.rsfn main() { f }main.rs:2:5: 2:6 error: unresolved name `f` [E0425] main.rs:2 f ^ main.rs:2:5: 2:6 help: run `rustc --explain E0425` to see a detailed explanation error: aborting due to previous error$ rustc --explain E0425 // 编译器打印的说明## 64位OS X $ rustc --target x86_64-apple-darwin
Last updated