Editions & Compiler

This map covers Rust edition selection, Rust 2024 migration concerns, rustc invocation, lint configuration, cfg checking, compilation targets, and code generation flags.

Concepts

Patterns

Antipatterns

Example

fn main() {
    println!("compile with: rustc --edition=2024 main.rs");
}

Best practice

Pitfalls

  • ⚠️ Treating edition migration as only a manifest edit; review lint-driven changes.
  • ⚠️ Guessing target cfg values instead of inspecting the active Target Triples configuration.
  • ⚠️ Hiding warnings that are meant to flag future-incompatible behavior.
  • ⚠️ Applying compiler flags globally when a Cargo profile or manifest setting is the better home.

See also

Cargo.toml Manifest · Cargo Workspaces · Feature Flags · Build Scripts (build.rs) · Profiles and Optimization Settings · MSRV Policy · Panic Unwinding and Abort · Integer Overflow

Sources