From 25effa9da656b3592075052041bf0c4b6c4edf7f Mon Sep 17 00:00:00 2001 From: Axel Navarro Date: Tue, 22 Sep 2020 13:56:18 -0300 Subject: [PATCH] cargo-rustc: add page (#4336) --- pages/common/cargo-rustc.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pages/common/cargo-rustc.md diff --git a/pages/common/cargo-rustc.md b/pages/common/cargo-rustc.md new file mode 100644 index 0000000000..21f65bb896 --- /dev/null +++ b/pages/common/cargo-rustc.md @@ -0,0 +1,36 @@ +# cargo rustc + +> Compile a Rust package, and pass extra options to the compiler. +> More information: . + +- Build the package or packages defined by the `Cargo.toml` manifest file in the current working directory: + +`cargo rustc` + +- Build artifacts in release mode, with optimizations: + +`cargo rustc --release` + +- Compile with architecture-specific optimizations for the current CPU: + +`cargo rustc --release -- -C target-cpu=native` + +- Compile with speed optimization: + +`cargo rustc -- -C opt-level {{1|2|3}}` + +- Compile with [s]ize optimization (`z` also turns off loop vectorization): + +`cargo rustc -- -C opt-level {{s|z}}` + +- Check if your package uses unsafe code: + +`cargo rustc --lib -- -D unsafe-code` + +- Build a specific package: + +`cargo rustc --package {{package}}` + +- Build only the specified binary: + +`cargo --bin {{name}}`