Rust versions / 1.83
Rust release · Nov 28, 2024
Rust 1.83: what's new, what was stabilized
Short answerRust 1.83 was released on Nov 28, 2024: 2 language stabilizations (Stabilize &mut, *mut, &Cell, and *const Cell in const.); 113 newly stable APIs (BufRead::skip_until, ControlFlow::break_value, ControlFlow::continue_value, ControlFlow::map_break, ...); 15 compatibility notes that can affect existing code.
← Rust 1.82All versionsRust 1.84 →
Language features stabilized
- Stabilize &mut, *mut, &Cell, and *const Cell in const.
- Stabilize expr_2021 macro fragment specifier in all editions.
113 APIs stabilized
BufRead::skip_until, ControlFlow::break_value, ControlFlow::continue_value, ControlFlow::map_break, ControlFlow::map_continue, DebugList::finish_non_exhaustive, DebugMap::finish_non_exhaustive, DebugSet::finish_non_exhaustive, DebugTuple::finish_non_exhaustive, ErrorKind::ArgumentListTooLong, ErrorKind::Deadlock, ErrorKind::DirectoryNotEmpty, ErrorKind::ExecutableFileBusy, ErrorKind::FileTooLarge, ErrorKind::HostUnreachable, ErrorKind::IsADirectory, ErrorKind::NetworkDown, ErrorKind::NetworkUnreachable, ErrorKind::NotADirectory, ErrorKind::NotSeekable, ErrorKind::ReadOnlyFilesystem, ErrorKind::ResourceBusy, ErrorKind::StaleNetworkFileHandle, ErrorKind::StorageFull, ErrorKind::TooManyLinks, Option::get_or_insert_default, Waker::data, Waker::new, Waker::vtable, char::MIN, hash_map::Entry::insert_entry, hash_map::VacantEntry::insert_entry, Cell::into_inner, Duration::as_secs_f32, Duration::as_secs_f64, Duration::div_duration_f32, Duration::div_duration_f64, MaybeUninit::as_mut_ptr, NonNull::as_mut, NonNull::copy_from, NonNull::copy_from_nonoverlapping, NonNull::copy_to, NonNull::copy_to_nonoverlapping, NonNull::slice_from_raw_parts, NonNull::write, NonNull::write_bytes, NonNull::write_unaligned, OnceCell::into_inner, Option::as_mut, Option::expect, Option::replace, Option::take, Option::unwrap, Option::unwrap_unchecked, Option::<&_>::copied, Option::<&mut _>::copied, Option::<Option<_>>::flatten, Option::<Result<_, _>>::transpose, RefCell::into_inner, Result::as_mut, Result::<&_, _>::copied, Result::<&mut _, _>::copied, Result::<Option<_>, _>::transpose, UnsafeCell::get_mut, UnsafeCell::into_inner, array::from_mut, char::encode_utf8, {float}::classify, {float}::is_finite, {float}::is_infinite, {float}::is_nan, {float}::is_normal, {float}::is_sign_negative, {float}::is_sign_positive, {float}::is_subnormal, {float}::from_bits, {float}::from_be_bytes, {float}::from_le_bytes, {float}::from_ne_bytes, {float}::to_bits, {float}::to_be_bytes, {float}::to_le_bytes, {float}::to_ne_bytes, mem::replace, ptr::replace, ptr::slice_from_raw_parts_mut, ptr::write, ptr::write_unaligned, <*const _>::copy_to, <*const _>::copy_to_nonoverlapping, <*mut _>::copy_from, <*mut _>::copy_from_nonoverlapping, <*mut _>::copy_to, <*mut _>::copy_to_nonoverlapping, <*mut _>::write, <*mut _>::write_bytes, <*mut _>::write_unaligned, slice::from_mut, slice::from_raw_parts_mut, <[_]>::first_mut, <[_]>::last_mut, <[_]>::first_chunk_mut, <[_]>::last_chunk_mut, <[_]>::split_at_mut, <[_]>::split_at_mut_checked, <[_]>::split_at_mut_unchecked, <[_]>::split_first_mut, <[_]>::split_last_mut, <[_]>::split_first_chunk_mut, <[_]>::split_last_chunk_mut, str::as_bytes_mut, str::as_mut_ptr, str::from_utf8_unchecked_mut
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- Warn against function pointers using unsupported ABI strings.
- Check well-formedness of the source type's signature in fn pointer casts. This partly closes a soundness hole that comes when casting a function item to function pointer
- Use equality instead of subtyping when resolving type dependent paths.
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass
MACOSX_DEPLOYMENT_TARGETor fix your#[link]attributes to point to the correct frameworks. See <https://github.com/rust-lang/rust/pull/129369>. - Rust will now correctly raise an error for
repr(Rust)written on non-struct/enum/unionitems, since it previously did not have any effect. - The future incompatibility lint
deprecated_cfg_attr_crate_type_namehas been made into a hard error. It was used to deny usage of#![crate_type]and#![crate_name]attributes in#![cfg_attr], which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion. - Until now, paths into the sysroot were always prefixed with
/rustc/$hashin diagnostics, codegen, backtrace, e.g. - The allow-by-default
missing_docslint used to disable itself when invoked throughrustc --test/cargo test, resulting in#[expect(missing_docs)]emitting false positives due to the expectation being wrongly unfulfilled. This behavior has now been removed, which allows#[expect(missing_docs)]to be fulfilled in all scenarios, but will also report newmissing_docsdiagnostics for publicly reachable#[cfg(test)]items, integration test crate-level documentation, and publicly reachable items in integration tests. - The
armv8r-none-eabihftarget now uses the Armv8-R required set of floating-point features. - Fix a soundness bug where rustc wouldn't detect unconstrained higher-ranked lifetimes in a
dyn Trait's associated types that occur due to supertraits. - Update the minimum external LLVM version to 18.
- Remove
aarch64-fuchsiaandx86_64-fuchsiatarget aliases in favor ofaarch64-unknown-fuchsiaandx86_64-unknown-fuchsiarespectively. - The ABI-level exception class of a Rust panic is now encoded with native-endian bytes, so it is legible in hex dumps.
- Visual Studio 2013 is no longer supported for MSVC targets.
- The sysroot no longer contains the
stddynamic library in its top-levellib/dir.
Use it
rustup update stable # get the newest release
rustup install 1.83 # or exactly this one
rustup override set 1.83 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.83" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- Stabilize
&mut,*mut,&Cell, and*const Cellin const. - Allow creating references to statics in
constinitializers. - Implement raw lifetimes and labels (
'r#ident). - Define behavior when atomic and non-atomic reads race.
- Non-exhaustive structs may now be empty.
- Disallow implicit coercions from places of type
! const externfunctions can now be defined for other calling conventions.- Stabilize
expr_2021macro fragment specifier in all editions. - The
non_local_definitionslint now fires on less code and warns by default.
<a id="1.83.0-Compiler"></a>
Compiler
- Deprecate unsound
-Csoft-floatflag. - Add many new tier 3 targets:
aarch64_unknown_nto_qnx700arm64e-apple-tvosarmv7-rtems-eabihfloongarch64-unknown-linux-ohosriscv32-wrs-vxworksandriscv64-wrs-vxworksriscv32{e|em|emc}-unknown-none-elfx86_64-unknown-hurd-gnux86_64-unknown-trusty
Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
<a id="1.83.0-Libraries"></a>
Libraries
- Implement
PartialEqforExitCode. - Document that
catch_unwindcan deal with foreign exceptions without UB, although the exact behavior is unspecified. - Implement
DefaultforHashMap/HashSetiterators that don't already have it. - Bump Unicode to version 16.0.0.
- Change documentation of
ptr::add/subto not claim equivalence withoffset.
<a id="1.83.0-Stabilized-APIs"></a>
Stabilized APIs
BufRead::skip_untilControlFlow::break_valueControlFlow::continue_valueControlFlow::map_breakControlFlow::map_continueDebugList::finish_non_exhaustiveDebugMap::finish_non_exhaustiveDebugSet::finish_non_exhaustiveDebugTuple::finish_non_exhaustiveErrorKind::ArgumentListTooLongErrorKind::DeadlockErrorKind::DirectoryNotEmptyErrorKind::ExecutableFileBusyErrorKind::FileTooLargeErrorKind::HostUnreachableErrorKind::IsADirectoryErrorKind::NetworkDownErrorKind::NetworkUnreachableErrorKind::NotADirectoryErrorKind::NotSeekableErrorKind::ReadOnlyFilesystemErrorKind::ResourceBusyErrorKind::StaleNetworkFileHandleErrorKind::StorageFullErrorKind::TooManyLinksOption::get_or_insert_defaultWaker::dataWaker::newWaker::vtablechar::MINhash_map::Entry::insert_entryhash_map::VacantEntry::insert_entry
These APIs are now stable in const contexts:
Cell::into_innerDuration::as_secs_f32Duration::as_secs_f64Duration::div_duration_f32Duration::div_duration_f64MaybeUninit::as_mut_ptrNonNull::as_mutNonNull::copy_fromNonNull::copy_from_nonoverlappingNonNull::copy_toNonNull::copy_to_nonoverlappingNonNull::slice_from_raw_partsNonNull::writeNonNull::write_bytesNonNull::write_unalignedOnceCell::into_innerOption::as_mutOption::expectOption::replaceOption::takeOption::unwrapOption::unwrap_uncheckedOption::<&_>::copiedOption::<&mut _>::copiedOption::<Option<_>>::flattenOption::<Result<_, _>>::transposeRefCell::into_innerResult::as_mutResult::<&_, _>::copiedResult::<&mut _, _>::copiedResult::<Option<_>, _>::transposeUnsafeCell::get_mutUnsafeCell::into_innerarray::from_mutchar::encode_utf8{float}::classify{float}::is_finite{float}::is_infinite{float}::is_nan{float}::is_normal{float}::is_sign_negative{float}::is_sign_positive{float}::is_subnormal{float}::from_bits{float}::from_be_bytes{float}::from_le_bytes{float}::from_ne_bytes{float}::to_bits{float}::to_be_bytes{float}::to_le_bytes{float}::to_ne_bytesmem::replaceptr::replaceptr::slice_from_raw_parts_mutptr::writeptr::write_unaligned<*const _>::copy_to<*const _>::copy_to_nonoverlapping<*mut _>::copy_from<*mut _>::copy_from_nonoverlapping<*mut _>::copy_to<*mut _>::copy_to_nonoverlapping<*mut _>::write<*mut _>::write_bytes<*mut _>::write_unalignedslice::from_mutslice::from_raw_parts_mut- [
<[_]>::first_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_mut) - [
<[_]>::last_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_mut) - [
<[_]>::first_chunk_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_chunk_mut) - [
<[_]>::last_chunk_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_chunk_mut) - [
<[_]>::split_at_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut) - [
<[_]>::split_at_mut_checked](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_checked) - [
<[_]>::split_at_mut_unchecked](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked) - [
<[_]>::split_first_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_mut) - [
<[_]>::split_last_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_mut) - [
<[_]>::split_first_chunk_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_chunk_mut) - [
<[_]>::split_last_chunk_mut](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_chunk_mut) str::as_bytes_mutstr::as_mut_ptrstr::from_utf8_unchecked_mut
<a id="1.83.0-Cargo"></a>
Cargo
- Introduced a new
CARGO_MANIFEST_PATHenvironment variable, similar toCARGO_MANIFEST_DIRbut pointing directly to the manifest file. - [Added
package.autolibto the manifest, allowing[lib]auto-discovery to be disabled.](https://github.com/rust-lang/cargo/pull/14591/) - Declare support level for each crate in Cargo's Charter / crate docs.
- Declare new Intentional Artifacts as 'small' changes.
<a id="1.83-Rustdoc"></a>
Rustdoc
- The sidebar / hamburger menu table of contents now includes the
# headersfrom the main item's doc comment. This is similar to a third-party feature provided by the rustdoc-search-enhancements browser extension.
<a id="1.83.0-Compatibility-Notes"></a>
Compatibility Notes
- Warn against function pointers using unsupported ABI strings.
- Check well-formedness of the source type's signature in fn pointer casts. This partly closes a soundness hole that comes when casting a function item to function pointer
- Use equality instead of subtyping when resolving type dependent paths.
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass
MACOSX_DEPLOYMENT_TARGETor fix your#[link]attributes to point to the correct frameworks. See <https://github.com/rust-lang/rust/pull/129369>. - Rust will now correctly raise an error for
repr(Rust)written on non-struct/enum/unionitems, since it previously did not have any effect. - The future incompatibility lint
deprecated_cfg_attr_crate_type_namehas been made into a hard error. It was used to deny usage of#![crate_type]and#![crate_name]attributes in#![cfg_attr], which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion. Users can use--crate-typeinstead of#![cfg_attr(..., crate_type = "...")]and--crate-nameinstead of#![cfg_attr(..., crate_name = "...")]when runningrustc/cargo rustcon the command line. Use of those two attributes outside of#![cfg_attr]continue to be fully supported. - Until now, paths into the sysroot were always prefixed with
/rustc/$hashin diagnostics, codegen, backtrace, e.g. ``thread 'main' panicked at 'hello world', map-panic.rs:2:50 stack backtrace: 0: std::panicking::begin_panic at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12 1: map_panic::main::{{closure}} at ./map-panic.rs:2:50 2: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 3: map_panic::main at ./map-panic.rs:2:30 4: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run withRUST_BACKTRACE=fullfor a verbose backtrace.`RFC 3127 said > We want to change this behaviour such that, whenrust-srcsource files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a--remap-path-prefix` that causes this local path to be remapped in the usual way.
#129687 implements this behaviour, when rust-src is present at compile time, rustc replaces /rustc/$hash with a real path into the local rust-src component with best effort. To sanitize this, users must explicitly supply --remap-path-prefix=<path to rust-src>=foo or not have the rust-src component installed.
- The allow-by-default
missing_docslint used to disable itself when invoked throughrustc --test/cargo test, resulting in#[expect(missing_docs)]emitting false positives due to the expectation being wrongly unfulfilled. This behavior has now been removed, which allows#[expect(missing_docs)]to be fulfilled in all scenarios, but will also report newmissing_docsdiagnostics for publicly reachable#[cfg(test)]items, integration test crate-level documentation, and publicly reachable items in integration tests. - The
armv8r-none-eabihftarget now uses the Armv8-R required set of floating-point features. - Fix a soundness bug where rustc wouldn't detect unconstrained higher-ranked lifetimes in a
dyn Trait's associated types that occur due to supertraits. - Update the minimum external LLVM version to 18.
- Remove
aarch64-fuchsiaandx86_64-fuchsiatarget aliases in favor ofaarch64-unknown-fuchsiaandx86_64-unknown-fuchsiarespectively. - The ABI-level exception class of a Rust panic is now encoded with native-endian bytes, so it is legible in hex dumps.
- Visual Studio 2013 is no longer supported for MSVC targets.
- The sysroot no longer contains the
stddynamic library in its top-levellib/dir.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.84Released Jan 9, 2025.Read it next →Also worth your time
Did this answer your question?