mirror of
https://github.com/tldr-pages/tldr.git
synced 2026-08-28 20:11:19 +08:00
5786fedb43
Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
1.0 KiB
1.0 KiB
cargo rustc
編譯一個 Rust 套件。類似於
cargo build,但您可以向編譯器傳遞額外的選項。 查看rustc --help獲取所有可用選項。 另請參閱:rustc。 更多資訊:https://doc.rust-lang.org/cargo/commands/cargo-rustc.html。
- 組建套件並向
rustc傳遞選項:
cargo rustc -- {{rustc_options}}
- 在 release 模式下組建,啟用最佳化:
cargo rustc {{[-r|--release]}}
- 使用針對目前 CPU 的特定架構最佳化編譯:
cargo rustc {{[-r|--release]}} -- {{[-C|--codegen]}} target-cpu=native
- 使用速度最佳化編譯:
cargo rustc -- {{[-C|--codegen]}} opt-level={{1|2|3}}
- 使用體積([s]ize)最佳化編譯(
z也會關閉迴圈向量化):
cargo rustc -- {{[-C|--codegen]}} opt-level={{s|z}}
- 檢查您的套件是否使用了不安全的程式碼:
cargo rustc --lib -- -D unsafe-code
- 組建特定的套件:
cargo rustc {{[-p|--package]}} {{套件}}
- 僅組建指定的二進位檔案:
cargo rustc --bin {{名稱}}