rust-syntax-edition-2024

Installation
SKILL.md
Contains Shell Commands

This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.

rust-syntax-edition-2024

Edition 2024 stabilized in Rust 1.85.0 (2025-02-20). It is the largest edition the Rust project has shipped: 13 language changes, library prelude additions, Cargo default shifts (cargo new defaults to edition = "2024" and resolver "3"), and Rustfmt rule updates. This skill is the authoritative reference every other syntax/impl skill in this package depends on. ALWAYS treat edition 2024 as the baseline; NEVER ship code in this package using pre-2024 idioms unless explicitly demonstrating a migration delta.

Quick Reference

Core rules (deterministic)

  1. ALWAYS migrate via cargo fix --edition on a clean working tree. NEVER hand-edit edition idioms before running the automated migration; you will miss lints that only the rustc driver emits.
  2. NEVER write extern "C" { ... } in edition 2024 code. ALWAYS write unsafe extern "C" { ... }; items inside are unsafe by default and may be opted into safe per item.
  3. NEVER use bare #[no_mangle], #[link_section = "..."], or #[export_name = "..."] in edition 2024. ALWAYS wrap them as #[unsafe(no_mangle)], #[unsafe(link_section = "...")], #[unsafe(export_name = "...")].
  4. ALWAYS wrap every unsafe operation inside an unsafe fn body in its own unsafe { ... } block. The 2024 default is #[warn(unsafe_op_in_unsafe_fn)]; pre-2024 code that calls unsafe ops bare inside an unsafe fn body breaks the lint.
  5. NEVER assume RPIT (-> impl Trait) does NOT capture an input lifetime in edition 2024. The 2024 default captures all in-scope generics and lifetimes. Opt out with + use<> (or list specific params with + use<'a, T>).
  6. NEVER rely on ! falling back to () in 2024. The fallback is ! itself; type-inference outcomes for ?-and-unwrap-only paths change. Annotate the turbofish (f::<()>()) at the call site when migration breaks.
  7. NEVER take a shared or mutable reference to a static mut. The static_mut_refs lint is deny-by-default in 2024. ALWAYS migrate to AtomicX, Mutex<T>, OnceLock<T>, LazyLock<T>, or &raw const/&raw mut.
  8. NEVER use gen as an identifier in edition 2024 code. ALWAYS rename, or escape as r#gen if you cannot. gen blocks themselves remain unstable.
  9. ALWAYS bind the result of a RefCell::borrow() / Mutex::lock() to a let before the tail expression dot-chains it. The tail_expr_drop_order change drops temporaries before locals in 2024.
  10. ALWAYS rewrite if let Some(x) = read_lock() { ... } else { write_lock() ... } patterns. In 2024 the scrutinee temporary drops BEFORE entering else, which fixes deadlocks but changes drop order observably.
Installs
2
GitHub Stars
1
First Seen
May 24, 2026