Rust versions / 1.82
Rust release · Oct 17, 2024
Rust 1.82: what's new, what was stabilized
Short answerRust 1.82 was released on Oct 17, 2024: 7 language stabilizations (Stabilize + use<'lt> opaque type precise capturing (RFC 3617)); 76 newly stable APIs (std::thread::Builder::spawn_unchecked, std::str::CharIndices::offset, std::option::Option::is_none_or, [T]::is_sorted, ...); 6 compatibility notes that can affect existing code.
← Rust 1.81All versionsRust 1.83 →
Language features stabilized
- Stabilize + use<'lt> opaque type precise capturing (RFC 3617)
- Stabilize &raw const and &raw mut operators (RFC 2582)
- Stabilize unsafe extern blocks (RFC 3484)
- Stabilize nested field access in offset_of!
- Stabilize const operands in inline assembly
- Stabilize floating-point arithmetic in const fn
- Stabilize explicit opt-in to unsafe attributes
76 APIs stabilized
std::thread::Builder::spawn_unchecked, std::str::CharIndices::offset, std::option::Option::is_none_or, [T]::is_sorted, [T]::is_sorted_by, [T]::is_sorted_by_key, Iterator::is_sorted, Iterator::is_sorted_by, Iterator::is_sorted_by_key, std::future::Ready::into_inner, std::iter::repeat_n, impl<T: Clone> DoubleEndedIterator for Take<Repeat<T>>, impl<T: Clone> ExactSizeIterator for Take<Repeat<T>>, impl<T: Clone> ExactSizeIterator for Take<RepeatWith<T>>, impl Default for std::collections::binary_heap::Iter, impl Default for std::collections::btree_map::RangeMut, impl Default for std::collections::btree_map::ValuesMut, impl Default for std::collections::vec_deque::Iter, impl Default for std::collections::vec_deque::IterMut, Rc<T>::new_uninit, Rc<MaybeUninit<T>>::assume_init, Rc<[T]>::new_uninit_slice, Rc<[MaybeUninit<T>]>::assume_init, Arc<T>::new_uninit, Arc<MaybeUninit<T>>::assume_init, Arc<[T]>::new_uninit_slice, Arc<[MaybeUninit<T>]>::assume_init, Box<T>::new_uninit, Box<MaybeUninit<T>>::assume_init, Box<[T]>::new_uninit_slice, Box<[MaybeUninit<T>]>::assume_init, core::arch::x86_64::_bextri_u64, core::arch::x86_64::_bextri_u32, core::arch::x86::_mm_broadcastsi128_si256, core::arch::x86::_mm256_stream_load_si256, core::arch::x86::_tzcnt_u16, core::arch::x86::_mm_extracti_si64, core::arch::x86::_mm_inserti_si64, core::arch::x86::_mm_storeu_si16, core::arch::x86::_mm_storeu_si32, core::arch::x86::_mm_storeu_si64, core::arch::x86::_mm_loadu_si16, core::arch::x86::_mm_loadu_si32, core::arch::wasm32::u8x16_relaxed_swizzle, core::arch::wasm32::i8x16_relaxed_swizzle, core::arch::wasm32::i32x4_relaxed_trunc_f32x4, core::arch::wasm32::u32x4_relaxed_trunc_f32x4, core::arch::wasm32::i32x4_relaxed_trunc_f64x2_zero, core::arch::wasm32::u32x4_relaxed_trunc_f64x2_zero, core::arch::wasm32::f32x4_relaxed_madd, core::arch::wasm32::f32x4_relaxed_nmadd, core::arch::wasm32::f64x2_relaxed_madd, core::arch::wasm32::f64x2_relaxed_nmadd, core::arch::wasm32::i8x16_relaxed_laneselect, core::arch::wasm32::u8x16_relaxed_laneselect, core::arch::wasm32::i16x8_relaxed_laneselect, core::arch::wasm32::u16x8_relaxed_laneselect, core::arch::wasm32::i32x4_relaxed_laneselect, core::arch::wasm32::u32x4_relaxed_laneselect, core::arch::wasm32::i64x2_relaxed_laneselect, core::arch::wasm32::u64x2_relaxed_laneselect, core::arch::wasm32::f32x4_relaxed_min, core::arch::wasm32::f32x4_relaxed_max, core::arch::wasm32::f64x2_relaxed_min, core::arch::wasm32::f64x2_relaxed_max, core::arch::wasm32::i16x8_relaxed_q15mulr, core::arch::wasm32::u16x8_relaxed_q15mulr, core::arch::wasm32::i16x8_relaxed_dot_i8x16_i7x16, core::arch::wasm32::u16x8_relaxed_dot_i8x16_i7x16, core::arch::wasm32::i32x4_relaxed_dot_i8x16_i7x16_add, core::arch::wasm32::u32x4_relaxed_dot_i8x16_i7x16_add, std::task::Waker::from_raw, std::task::Context::from_waker, std::task::Context::waker, {integer}::from_str_radix, std::num::ParseIntError::kind
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:
- We now disallow setting some built-in cfgs via the command-line with the newly added
explicit_builtin_cfgs_in_flagslint in order to prevent incoherent state, eg.windowscfg active but target is Linux based. The appropriaterustcflag should be used instead. - The standard library has a new implementation of
binary_searchwhich significantly improves performance (#128254). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation. - illumos/Solaris now sets
MSG_NOSIGNALwhen writing to sockets. This avoids killing the process with SIGPIPE when writing to a closed socket, which matches the existing behavior on other UNIX targets. - Removes a problematic hack that always passed the --whole-archive linker flag for tests, which may cause linker errors for code accidentally relying on it.
- The WebAssembly target features
multivalueandreference-typesare now - Rust now raises unsafety errors for union patterns in parameter-position
Use it
rustup update stable # get the newest release
rustup install 1.82 # or exactly this one
rustup override set 1.82 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.82" 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
- Don't make statement nonterminals match pattern nonterminals
- Patterns matching empty types can now be omitted in common cases
- Enforce supertrait outlives obligations when using trait impls
addr_of(_mut)!macros and the newly stabilized&raw (const|mut)are now safe to use with all static items- size_of_val_raw: for length 0 this is safe to call
- Reorder trait bound modifiers *after*
for<...>binder in trait bounds - Stabilize
+ use<'lt>opaque type precise capturing (RFC 3617) - Stabilize
&raw constand&raw mutoperators (RFC 2582) - Stabilize unsafe extern blocks (RFC 3484)
- Stabilize nested field access in
offset_of! - [Do not require
Tto be live when dropping[T; 0]](https://github.com/rust-lang/rust/pull/128438) - Stabilize
constoperands in inline assembly - Stabilize floating-point arithmetic in
const fn - Stabilize explicit opt-in to unsafe attributes
- Document NaN bit patterns guarantees
<a id="1.82.0-Compiler"></a>
Compiler
- Promote riscv64gc-unknown-linux-musl to tier 2
- Promote Mac Catalyst targets
aarch64-apple-ios-macabiandx86_64-apple-ios-macabito Tier 2, and ship them with rustup - Add tier 3 NuttX based targets for RISC-V and ARM
- Add tier 3 powerpc-unknown-linux-muslspe target
- Improved diagnostics to explain why a pattern is unreachable
- The compiler now triggers the unreachable code warning properly for async functions that don't return/are
-> ! - Promote
aarch64-apple-darwinto Tier 1 - Add Trusty OS target
aarch64-unknown-trustyandarmv7-unknown-trustyas tier 3 targets - Promote
wasm32-wasip2to Tier 2.
<a id="1.82.0-Libraries"></a>
Libraries
<a id="1.82.0-Stabilized-APIs"></a>
Stabilized APIs
std::thread::Builder::spawn_uncheckedstd::str::CharIndices::offsetstd::option::Option::is_none_or- [
[T]::is_sorted](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted) - [
[T]::is_sorted_by](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by) - [
[T]::is_sorted_by_key](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by_key) Iterator::is_sortedIterator::is_sorted_byIterator::is_sorted_by_keystd::future::Ready::into_innerstd::iter::repeat_nimpl<T: Clone> DoubleEndedIterator for Take<Repeat<T>>impl<T: Clone> ExactSizeIterator for Take<Repeat<T>>impl<T: Clone> ExactSizeIterator for Take<RepeatWith<T>>impl Default for std::collections::binary_heap::Iterimpl Default for std::collections::btree_map::RangeMutimpl Default for std::collections::btree_map::ValuesMutimpl Default for std::collections::vec_deque::Iterimpl Default for std::collections::vec_deque::IterMutRc<T>::new_uninitRc<MaybeUninit<T>>::assume_init- [
Rc<[T]>::new_uninit_slice](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit_slice) - [
Rc<[MaybeUninit<T>]>::assume_init](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init-1) Arc<T>::new_uninitArc<MaybeUninit<T>>::assume_init- [
Arc<[T]>::new_uninit_slice](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit_slice) - [
Arc<[MaybeUninit<T>]>::assume_init](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init-1) Box<T>::new_uninitBox<MaybeUninit<T>>::assume_init- [
Box<[T]>::new_uninit_slice](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit_slice) - [
Box<[MaybeUninit<T>]>::assume_init](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init-1) core::arch::x86_64::_bextri_u64core::arch::x86_64::_bextri_u32core::arch::x86::_mm_broadcastsi128_si256core::arch::x86::_mm256_stream_load_si256core::arch::x86::_tzcnt_u16core::arch::x86::_mm_extracti_si64core::arch::x86::_mm_inserti_si64core::arch::x86::_mm_storeu_si16core::arch::x86::_mm_storeu_si32core::arch::x86::_mm_storeu_si64core::arch::x86::_mm_loadu_si16core::arch::x86::_mm_loadu_si32core::arch::wasm32::u8x16_relaxed_swizzlecore::arch::wasm32::i8x16_relaxed_swizzlecore::arch::wasm32::i32x4_relaxed_trunc_f32x4core::arch::wasm32::u32x4_relaxed_trunc_f32x4core::arch::wasm32::i32x4_relaxed_trunc_f64x2_zerocore::arch::wasm32::u32x4_relaxed_trunc_f64x2_zerocore::arch::wasm32::f32x4_relaxed_maddcore::arch::wasm32::f32x4_relaxed_nmaddcore::arch::wasm32::f64x2_relaxed_maddcore::arch::wasm32::f64x2_relaxed_nmaddcore::arch::wasm32::i8x16_relaxed_laneselectcore::arch::wasm32::u8x16_relaxed_laneselectcore::arch::wasm32::i16x8_relaxed_laneselectcore::arch::wasm32::u16x8_relaxed_laneselectcore::arch::wasm32::i32x4_relaxed_laneselectcore::arch::wasm32::u32x4_relaxed_laneselectcore::arch::wasm32::i64x2_relaxed_laneselectcore::arch::wasm32::u64x2_relaxed_laneselectcore::arch::wasm32::f32x4_relaxed_mincore::arch::wasm32::f32x4_relaxed_maxcore::arch::wasm32::f64x2_relaxed_mincore::arch::wasm32::f64x2_relaxed_maxcore::arch::wasm32::i16x8_relaxed_q15mulrcore::arch::wasm32::u16x8_relaxed_q15mulrcore::arch::wasm32::i16x8_relaxed_dot_i8x16_i7x16core::arch::wasm32::u16x8_relaxed_dot_i8x16_i7x16core::arch::wasm32::i32x4_relaxed_dot_i8x16_i7x16_addcore::arch::wasm32::u32x4_relaxed_dot_i8x16_i7x16_add
These APIs are now stable in const contexts:
std::task::Waker::from_rawstd::task::Context::from_wakerstd::task::Context::waker{integer}::from_str_radixstd::num::ParseIntError::kind
<a id="1.82.0-Cargo"></a>
Cargo
<a id="1.82.0-Compatibility-Notes"></a>
Compatibility Notes
- We now disallow setting some built-in cfgs via the command-line with the newly added
explicit_builtin_cfgs_in_flagslint in order to prevent incoherent state, eg.windowscfg active but target is Linux based. The appropriaterustcflag should be used instead. - The standard library has a new implementation of
binary_searchwhich significantly improves performance (#128254). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation. - illumos/Solaris now sets
MSG_NOSIGNALwhen writing to sockets. This avoids killing the process with SIGPIPE when writing to a closed socket, which matches the existing behavior on other UNIX targets. - Removes a problematic hack that always passed the --whole-archive linker flag for tests, which may cause linker errors for code accidentally relying on it.
- The WebAssembly target features
multivalueandreference-typesare now both enabled by default. These two features both have subtle changes implied for generated WebAssembly binaries. For themultivaluefeature, WebAssembly target support has changed when upgrading to LLVM 19. Support for generating functions with multiple returns no longer works and-Ctarget-feature=+multivaluehas a different meaning than it did in LLVM 18 and prior. There is no longer any supported means to generate a module that has a function with multiple returns in WebAssembly from Rust source code. For thereference-typesfeature the encoding of immediates in thecall_indirect, a commonly used instruction by the WebAssembly backend, has changed. Validators and parsers which don't understand thereference-typesproposal will no longer accept modules produced by LLVM due to this change in encoding of immediates. Additionally these features being enabled are encoded in thetarget_featurescustom section and may affect downstream tooling such aswasm-optconsuming the module. Generating a WebAssembly module that disables default features requires-Zbuild-stdsupport from Cargo and more information can be found at rust-lang/rust#128511. - Rust now raises unsafety errors for union patterns in parameter-position
<a id="1.82.0-Internal-Changes"></a>
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.83Released Nov 28, 2024.Read it next →Also worth your time
Did this answer your question?