Match ergonomics reservations Summary • Writing mut, ref, or ref mut on a binding is only allowed within a pattern when the pattern leading up to that binding is fully explicit (i.e. when it does not use match ergonomics). • Put differently...
Unsafe extern blocks Summary • extern blocks must now be marked with the unsafe keyword. Details Rust 1.82 added the ability in all editions to mark extern blocks with the unsafe keyword.[^RFC3484] Adding the unsafe keyword helps to emphasi...
Unsafe attributes Summary • The following attributes must now be marked as unsafe: • export_name • link_section • no_mangle Details Rust 1.82 added the ability in all editions to mark certain attributes as unsafe to indicate that they have...
unsafe_op_in_unsafe_fn warning Summary • The unsafe_op_in_unsafe_fn lint now warns by default. This warning detects calls to unsafe operations in unsafe functions without an explicit unsafe block. Details The unsafe_op_in_unsafe_fn lint wil...
Disallow references to static mut Summary • The static_mut_refs lint level is now deny by default. This checks for taking a shared or mutable reference to a static mut. Details The static_mut_refs lint detects taking a reference to a static...
Never type fallback change Summary • Never type (!) to any type ("never-to-any") coercions fall back to never type (!) rather than to unit type (()). • The never_type_fallback_flowing_into_unsafe lint is now deny by default. Details When th...
Macro Fragment Specifiers Summary • The expr fragment specifier now also supports const and _ expressions. • The expr_2021 fragment specifier has been added for backwards compatibility. Details As new syntax is added to Rust, existing macro...
Missing macro fragment specifiers NOTE: This was originally made a hard error only for the 2024 Edition. In Rust 1.89, released after Rust 2024, the lint was made into a hard error in all editions. Summary • The missing_fragment_specifier l...
gen keyword Summary • gen is a reserved keyword. Details The gen keyword has been reserved as part of RFC #3513 to introduce "gen blocks" in a future release of Rust. gen blocks will provide a way to make it easier to write certain kinds of...
Reserved syntax Summary • Unprefixed guarded strings of the form #"foo"# are reserved for future use. • Two or more # characters are reserved for future use. Details RFC 3593 reserved syntax in the 2024 Edition for guarded string literals t...
Standard library The following chapters detail changes to the standard library in the 2024 Edition.
Changes to the prelude Summary • The Future and IntoFuture traits are now part of the prelude. • This might make calls to trait methods ambiguous which could make some code fail to compile. Details The prelude of the standard library is the...
Add IntoIterator for Box<[T]> Summary • Boxed slices implement IntoIterator in all editions. • Calls to IntoIterator::into_iter are hidden in editions prior to 2024 when using method call syntax (i.e., boxed_slice.into_iter()). So, boxed_sl...
Unsafe functions Summary • The following functions are now marked unsafe: • std::env::set_var • std::env::remove_var • std::os::unix::process::CommandExt::before_exec Details Over time it has become evident that certain functions in the sta...
Cargo The following chapters detail changes to Cargo in the 2024 Edition.
Cargo: Rust-version aware resolver Summary • edition = "2024" implies resolver = "3" in Cargo.toml which enables a Rust-version aware dependency resolver. Details Since Rust 1.84.0, Cargo has opt-in support for compatibility with package.ru...
Cargo: Table and key name consistency Summary • Several table and key names in Cargo.toml have been removed where there were previously two ways to specify the same thing. • Removed [project]; use [package] instead. • Removed default_featur...
Cargo: Reject unused inherited default-features Summary • default-features = false is no longer allowed in an inherited workspace dependency if the workspace dependency specifies default-features = true (or does not specify default-features...
Rustdoc The following chapters detail changes to Rustdoc in the 2024 Edition.
Rustdoc combined tests Summary • Doctests are now combined into a single binary which should result in a significant performance improvement. Details Prior to the 2024 Edition, rustdoc's "test" mode would compile each code block in your doc...