Edition migration and feature stabilization
Quick answer
Rust editions allow coordinated language changes across crate boundaries. A compiler release and an edition are different: a crate can use an older edition with a newer compiler.
Migration and compatibility evidence
Rust 1.85.0 is the baseline for edition 2024 in this track. A crate's edition is set in Cargo.toml, while rust-version documents its declared minimum supported compiler. A nightly feature gate, an accepted RFC and a stabilized feature are distinct states. Review edition compatibility lints, inspect cargo fix changes, change the edition field, and run tests on supported targets. Some macros, generated code and documentation require manual migration.
fn r#gen() -> u32 { 4 }fn main() { println!("{}", r#gen()); }Expected stdout (not executed):
4The raw identifier permits this name even though gen is reserved in edition 2024.
# In a clean, trusted scratch project currently using edition 2021:cargo +1.85.0 testcargo +1.85.0 fix --edition --all-targetsgit diff# Review changes, then manually set edition = "2024" in Cargo.toml.cargo +1.85.0 testManual terminal step; not executed. Expected behavior (environment dependent):
Migration suggestions and test results; review manually before accepting changes.Keep the project under version control; a successful automated edit alone is not proof of compatibility.
Common mistake
Do not enable a nightly-only feature in a stable-baseline tutorial or infer stability from an RFC's acceptance.
Try it yourself
Choose one API used in a library and record its stabilization version, declared MSRV and a test plan separately.
Static examples for Rust 1.85.0, edition 2024. Run them locally in a disposable project; ByteMind execution support and these outputs have not been verified.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Edition migration and feature stabilization — practice quiz
Choose one answer per question. Code examples are predictions; review explanations after attempting them.
An RFC is accepted for a proposed language feature. Does that mean stable users can use it immediately?
Edition migration and feature stabilization — example 1. Read the code; do not execute it for this question. Assume the lesson’s stated setup, compatible dependencies and toolchain, and a fresh disposable directory for file-creating examples. ```rust fn r#gen() -> u32 { 4 } fn main() { println!("{}", r#gen()); } ``` What standard output should the program produce if its run succeeds? Ignore Cargo and diagnostic messages.
Edition migration and feature stabilization — example 2. Read the code; do not execute it for this question. Assume the lesson’s stated setup, compatible dependencies and toolchain, and a fresh disposable directory for file-creating examples. ```bash # In a clean, trusted scratch project currently using edition 2021: cargo +1.85.0 test cargo +1.85.0 fix --edition --all-targets git diff # Review changes, then manually set edition = "2024" in Cargo.toml. cargo +1.85.0 test ``` Which outcome or interpretation best matches this example?