RUSTFLAGS — A space-separated list of custom flags to pass to all compiler invocations that Cargo performs. In contrast with cargo rustc, this is useful for passing a flag to all compiler instances. See build.rustflags for some more ways to set flags. This string is split by whitespace.

target-cpu

This instructs rustc to generate code specifically for particular processor. You can run rustc --print target-cpus to see the valid options to pass here. Each target has a default base CPU. Special values include: native can be passed to use the processor of the host machine. generic refers to an LLVM target with minimal features but modern tuning.

opt-level

This flag controls the optimization level.
0: no optimizations, also turns on cfg(debug_assertions) (the default).
1: basic optimizations.
2: some optimizations.
3: all optimizations.
s: optimize for binary size.
z: optimize for binary size, but also turn off loop vectorization.
Note: The -O flag is an alias for -C opt-level=2. The default is 0.

pgo

help-circle