mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-28 19:54:04 +00:00
Update cheatsheets
This commit is contained in:
42
cargo-rustc
Normal file
42
cargo-rustc
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# cargo rustc
|
||||
|
||||
> Compile a Rust package. Similar to `cargo build`, but you can pass extra options to the compiler.
|
||||
> See `rustc --help` for all available options.
|
||||
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-rustc.html>.
|
||||
|
||||
- Build the package and pass options to `rustc`:
|
||||
|
||||
`cargo rustc -- {{rustc_options}}`
|
||||
|
||||
- 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 optimizations:
|
||||
|
||||
`cargo rustc -- -C opt-level {{1|2|3}}`
|
||||
|
||||
- Compile with [s]ize optimizations (`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}}`
|
||||
Reference in New Issue
Block a user