feature(generic_arg_infer))mismatched_lifetime_syntaxes lint.
This lint detects when the same lifetime is referred to by different syntax categories between function arguments and return values, which can be confusing to read, especially in unsafe code.
This lint supersedes the warn-by-default elided_named_lifetimes lint.unpredictable_function_pointer_comparisons to also lint on function pointer comparisons in external macrosdangerous_implicit_autorefs lint deny-by-defaultkl and widekl target features for x86sha512, sm3 and sm4 target features for x86f, d, frecipe, lasx, lbt, lsx, and lvzi128 and u128 from improper_ctypes_definitionsrepr128 (#[repr(u128)], #[repr(i128)])#![doc(test(attr(..)))] everywhereextern "C" functions on the wasm32-unknown-unknown target now have a standards compliant ABIloongarch32-unknown-none and loongarch32-unknown-none-softfloatx86_64-apple-darwin is in the process of being demoted to Tier 2 with host toolsRefer to Rust’s platform support page for more information on Rust’s tiered platform support.
file!format_args!() in a variable#[must_use] to [T; N]::mapDerefMut for Lazy{Cell,Lock}Default for array::IntoIterClone for slice::ChunkByio::Seek for io::TakeNonZero<char>File::lockFile::lock_sharedFile::try_lockFile::try_lock_sharedFile::unlockNonNull::from_refNonNull::from_mutNonNull::without_provenanceNonNull::with_exposed_provenanceNonNull::expose_provenanceOsString::leakPathBuf::leakResult::flattenstd::os::linux::net::TcpStreamExt::quickackstd::os::linux::net::TcpStreamExt::set_quickackThese previously stable APIs are now stable in const contexts:
cargo fix and cargo clippy --fix now default to the same Cargo target selection as other build commands. Previously it would apply to all targets (like binaries, examples, tests, etc.). The --edition flag still applies to all targets.runner setting to run the tests. If you need to disable tests for a target, you can use the ignore doctest attribute to specify the targets to ignore.missing_fragment_specifier an unconditional errorneon target feature on aarch64-unknown-none-softfloat causes a warning because mixing code with and without that target feature is not properly supported by LLVM?Sized bounds on impls on recursive types which contain associated type projections. It is not expected to affect any existing published crates. Can be fixed by refactoring the involved types or opting into the sized_hierarchy unstable feature. See the FCP report for a code example.elided_named_lifetimes lint is superseded by the warn-by-default mismatched_lifetime_syntaxes lint.Copy are now only available at the end of type checkingstd::intrinsics::{copy,copy_nonoverlapping,write_bytes} are now proper intrinsics. There are no debug assertions guarding against UB, and they cannot be coerced to function pointers.std::intrinsics::drop_in_place!) are now reported in dependenciesstd::ptr::copy_* intrinsics also perform the static self-init checksextern "C" functions on the wasm32-unknown-unknown target now have a standards compliant ABIThese changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
#![feature(let_chains)] in the 2024 edition.
This feature allows &&-chaining let statements inside if and while, allowing intermixture with boolean expressions. The patterns inside the let sub-expressions can be irrefutable or refutable.#![feature(naked_functions)].
Naked functions allow writing functions with no compiler-generated epilogue and prologue, allowing full control over the generated assembly for a particular function.#![feature(cfg_boolean_literals)].
This allows using boolean literals as cfg predicates, e.g. #[cfg(true)] and #[cfg(false)].#[bench] attribute. Usage of #[bench] without #![feature(custom_test_frameworks)] already triggered a deny-by-default future-incompatibility lint since Rust 1.77, but will now become a hard error.dangerous_implicit_autorefs lint against implicit autoref of raw pointer dereference.
The lint will be bumped to deny-by-default in the next version of Rust.invalid_null_arguments lint to prevent invalid usage of null pointers.
This lint is uplifted from clippy::invalid_null_ptr_usage.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
#[should_panic] test failure message.[T; N]::from_fn is generated in order of increasing indices., for those passing it a stateful closure.--nocapture is deprecated in favor of the more consistent --no-capture flag.{float}::NAN is a quiet NaN.Cell::updateimpl Default for *const Timpl Default for *mut THashMap::extract_ifHashSet::extract_ifhint::select_unpredictableproc_macro::Span::lineproc_macro::Span::columnproc_macro::Span::startproc_macro::Span::endproc_macro::Span::fileproc_macro::Span::local_file<[T]>::as_chunks<[T]>::as_chunks_mut<[T]>::as_chunks_unchecked<[T]>::as_chunks_unchecked_mut<[T]>::as_rchunks<[T]>::as_rchunks_mutmod ffi::c_strThese previously stable APIs are now stable in const contexts:
NonNull<T>::replace<*mut T>::replacestd::ptr::swap_nonoverlappingCell::replaceCell::getCell::get_mutCell::from_mutCell::as_slice_of_cellsignore-* attributes.--test-runtool and --test-runtool-arg CLI options to specify a program (like qemu) and its arguments to run a doctest.tt fragment specifier can often fix these macros.#[bench] attribute. Usage of #[bench] without #![feature(custom_test_frameworks)] already triggered a deny-by-default future-incompatibility lint since Rust 1.77, but will now become a hard error.asm_goto feature..EXPR) after unary operators !, -, and *.Self: Sized bounds in impls for unsized typesfeature(precise_capturing_in_traits) allowing use<...> bounds on return position impl Trait in traitsRefer to Rust’s platform support page for more information on Rust’s tiered platform support.
Debug impl of raw pointersVec::with_capacity guarantees it allocates with the amount requested, even if Vec::capacity returns a different number.std::arch intrinsics which don’t take pointer arguments can now be called from safe code if the caller has the appropriate target features already enabled (https://github.com/rust-lang/stdarch/pull/1714, https://github.com/rust-lang/stdarch/pull/1716, https://github.com/rust-lang/stdarch/pull/1717)env::home_dirControlFlow as #[must_use]assert_eq! and vec! now support const {...} expressionsVec::extract_ifvec::ExtractIfLinkedList::extract_iflinked_list::ExtractIf<[T]>::split_off<[T]>::split_off_mut<[T]>::split_off_first<[T]>::split_off_first_mut<[T]>::split_off_last<[T]>::split_off_last_mutString::extend_from_withinos_str::DisplayOsString::displayOsStr::displayio::pipeio::PipeReaderio::PipeWriterimpl From<PipeReader> for OwnedHandleimpl From<PipeWriter> for OwnedHandleimpl From<PipeReader> for Stdioimpl From<PipeWriter> for Stdioimpl From<PipeReader> for OwnedFdimpl From<PipeWriter> for OwnedFdBox<MaybeUninit<T>>::writeimpl TryFrom<Vec<u8>> for String<*const T>::offset_from_unsigned<*const T>::byte_offset_from_unsigned<*mut T>::offset_from_unsigned<*mut T>::byte_offset_from_unsignedNonNull::offset_from_unsignedNonNull::byte_offset_from_unsigned<uN>::cast_signedNonZero::<uN>::cast_signed.<iN>::cast_unsigned.NonZero::<iN>::cast_unsigned.<uN>::is_multiple_of<uN>::unbounded_shl<uN>::unbounded_shr<iN>::unbounded_shl<iN>::unbounded_shr<iN>::midpoint<str>::from_utf8<str>::from_utf8_mut<str>::from_utf8_unchecked<str>::from_utf8_unchecked_mutThese previously stable APIs are now stable in const contexts:
core::str::from_utf8_mut<[T]>::copy_from_sliceSocketAddr::set_ipSocketAddr::set_port,SocketAddrV4::set_ipSocketAddrV4::set_port,SocketAddrV6::set_ipSocketAddrV6::set_portSocketAddrV6::set_flowinfoSocketAddrV6::set_scope_idchar::is_digitchar::is_whitespace<[[T; N]]>::as_flattened<[[T; N]]>::as_flattened_mutString::into_bytesString::as_strString::capacityString::as_bytesString::lenString::is_emptyString::as_mut_strString::as_mut_vecVec::as_ptrVec::as_sliceVec::capacityVec::lenVec::is_emptyVec::as_mut_sliceVec::as_mut_ptr#![crate_name] attributeDebug impl of raw pointers print metadata if presentdyn types are no longer deduplicated.. inside of struct patterns (let Struct { #[attribute] .. }) =ptr_cast_add_auto_to_object lint into hard errorstd::arch intrinsics are now safe to call in some contexts, there may now be new unused_unsafe warnings in existing codebases.width and precision formatting options to 16 bits on all targetsControlFlow as #[must_use]advapi32, except on win7. Code such as C libraries that were relying on this assumption may need to explicitly link advapi32.cfg(true) attributes.tt fragment specifier can often fix these macros.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.
#[target_feature] attribute.missing_abi lint now warns-by-default.--x) as written in other languages. This was previously a clippy lint, clippy::double_neg, and is now available directly in Rust as double_negations.repr() attribute applied to invalid items are now correctly rejected.#![test] and #![rustfmt::skip] are no longer accepted in more places than intended.-O to mean -C opt-level=3 instead of -C opt-level=2 to match Cargo’s defaults.overflowing_literals under certain macro environments.i686-unknown-redox target with i586-unknown-redox.i686-unknown-hurd-gnu to Pentium 4.{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock.
For supporting Neutrino QNX 7.1 with io-socket network stack.{aarch64-unknown,x86_64-pc}-nto-qnx800.
For supporting Neutrino QNX 8.0 (no_std-only).{x86_64,i686}-win7-windows-gnu.
Intended for backwards compatibility with Windows 7. {x86_64,i686}-win7-windows-msvc are the Windows MSVC counterparts that already exist as Tier 3 targets.amdgcn-amd-amdhsa.x86_64-pc-cygwin.{mips,mipsel}-mti-none-elf.
Initial bare-metal support.m68k-unknown-none-elf.armv7a-nuttx-{eabi,eabihf}, aarch64-unknown-nuttx, and thumbv7a-nuttx-{eabi,eabihf}.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
FromBytesWithNulError in CStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError> was changed from an opaque struct to an enum, allowing users to examine why the conversion failed.RustcDecodable and RustcEncodable.--logfile option.std::fs::remove_file will now remove read-only files.{float}::next_down{float}::next_up<[_]>::get_disjoint_mut<[_]>::get_disjoint_unchecked_mutslice::GetDisjointMutErrorHashMap::get_disjoint_mutHashMap::get_disjoint_unchecked_mutNonZero::count_onesVec::pop_ifsync::Once::waitsync::Once::wait_forcesync::OnceLock::waitThese APIs are now stable in const contexts:
hint::black_boxio::Cursor::get_mutio::Cursor::set_positionstr::is_char_boundarystr::split_atstr::split_at_checkedstr::split_at_mutstr::split_at_mut_checked--package and --workspace are passed but the requested package is missing. This was previously silently ignored, which was considered a bug since missing packages should be reported.cargo login to avoid shell history leaks.SourceID comparisons. This may potentially change behavior if the canonicalized URL compares differently in alternative registries.wasm_c_abi future compatibility warning is now a hard error.
Users of wasm-bindgen should upgrade to at least version 0.2.89, otherwise compilation will fail.#![no_start] and #![crate_id].cenum_impl_drop_cast has been made into a hard error. This means it is now an error to cast a field-less enum to an integer if the enum implements Drop.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.
target_feature checks when generating docs.std::fs::rename on Windows 10, version 1607.cc to fix custom targets.#[diagnostic::do_not_recommend]unpredictable_function_pointer_comparisons lint to warn against function pointer comparisons#[no_mangle] and #[export_name] attributes.-Zpolymorphize has been removed, see https://github.com/rust-lang/compiler-team/issues/810 for some background.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Panics in the standard library now have a leading library/ in their path
std::env::home_dir() on Windows now ignores the non-standard $HOME environment variable
It will be un-deprecated in a subsequent release.
BuildHasherDefault::newptr::fn_addr_eqio::ErrorKind::QuotaExceededio::ErrorKind::CrossesDevices{float}::midpoint{integer}::midpointNonZeroU*::midpointstd::iter::Extend for tuples with arity 1 through 12FromIterator<(A, ...)> for tuples with arity 1 through 12std::task::Waker::noopThese APIs are now stable in const contexts:
mem::size_of_valmem::align_of_valLayout::for_valueLayout::align_toLayout::pad_to_alignLayout::extendLayout::arraystd::mem::swapstd::ptr::swapNonNull::newHashMap::with_hasherHashSet::with_hasherBuildHasherDefault::new<float>::recip<float>::to_degrees<float>::to_radians<float>::max<float>::min<float>::clamp<float>::abs<float>::signum<float>::copysignMaybeUninit::writeCARGO_CFG_FEATURE to build scriptsrustc no longer treats the test cfg as a well known check-cfg, instead it is up to the build systems and users of --check-cfg1 to set it as a well known cfg using --check-cfg=cfg(test).
This is done to enable build systems like Cargo to set it conditionally, as not all source files are suitable for unit tests.
Cargo (for now) unconditionally sets the test cfg as a well known cfg.
Disable potentially incorrect type inference if there are trivial and non-trivial where-clauses
std::env::home_dir() has been deprecated for years, because it can give surprising results in some Windows configurations if the HOME environment variable is set (which is not the normal configuration on Windows). We had previously avoided changing its behavior, out of concern for compatibility with code depending on this non-standard configuration. Given how long this function has been deprecated, we’re now fixing its behavior as a bugfix. A subsequent release will remove the deprecation for this function.
Make core::ffi::c_char signedness more closely match that of the platform-default char
This changed c_char from an i8 to u8 or vice versa on many Tier 2 and 3
targets (mostly Arm and RISC-V embedded targets). The new definition may
result in compilation failures but fixes compatibility issues with C.
The libc crate matches this change as of its 0.2.169 release.
Increase sparcv9-sun-solaris and x86_64-pc-solaris Solaris baseline to 11.4.
Show abi_unsupported_vector_types lint in future breakage reports
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.
#[deny] inside #[forbid] as a no-op-Ctarget-feature is used to toggle features that can lead to unsoundness due to ABI mismatches/ as the path separator for include!() in all cases on Windowsraw (const|mut)) of a deref of a pointer (*ptr) is now safeextern "C" function--print host-tuple flag to print the host target tuple and affirm the “target tuple” terminology over “target triple”loongarch64-unknown-linux-{musl,ohos}unexpected_cfgs lint to also warn in external macrosmultivalue, reference-types, and tail-call target featureswasm32v1-none targetFrom<&mut {slice}> for Box/Rc/Arc<{slice}><float>::copysign, <float>::abs, <float>::signum to coreLowerExp and UpperExp implementations to NonZeroFromStr for CString and TryFrom<CString> for Stringstd::os::darwin has been made publicIpv6Addr::is_unique_localIpv6Addr::is_unicast_link_localcore::ptr::with_exposed_provenancecore::ptr::with_exposed_provenance_mut<ptr>::addr<ptr>::expose_provenance<ptr>::with_addr<ptr>::map_addr<int>::isqrt<int>::checked_isqrt<uint>::isqrtNonZero::isqrtcore::ptr::without_provenancecore::ptr::without_provenance_mutcore::ptr::danglingcore::ptr::dangling_mutPin::as_deref_mutThese APIs are now stable in const contexts
AtomicBool::from_ptrAtomicPtr::from_ptrAtomicU8::from_ptrAtomicU16::from_ptrAtomicU32::from_ptrAtomicU64::from_ptrAtomicUsize::from_ptrAtomicI8::from_ptrAtomicI16::from_ptrAtomicI32::from_ptrAtomicI64::from_ptrAtomicIsize::from_ptr<ptr>::is_null<ptr>::as_ref<ptr>::as_mutPin::newPin::new_uncheckedPin::get_refPin::into_refPin::get_mutPin::get_unchecked_mutPin::static_refPin::static_mutLSX target feature for LoongArch Linux targets-Zprofile flag (“gcov-style” coverage instrumentation) has been removed. This does not affect the stable flags for coverage instrumentation (-Cinstrument-coverage) and profile-guided optimization (-Cprofile-generate, -Cprofile-use), which are unrelated and remain available.wasm32-wasi has been removed as the target is now named wasm32-wasip1. This completes the transition plan for this target following the introduction of wasm32-wasip1 in Rust 1.78. Compiler warnings on use of wasm32-wasi introduced in Rust 1.81 are now gone as well as the target is removed.&pin (mut|const) T is now parsed as a type which in theory could affect macro expansion results in some edge casesstd::arch functions is no longer permitted to declare items or bodies (such as closures, inline consts, or async blocks).&mut, *mut, &Cell, and *const Cell in const.const initializers.'r#ident).!const extern functions can now be defined for other calling conventions.expr_2021 macro fragment specifier in all editions.non_local_definitions lint now fires on less code and warns by default.-Csoft-float flag.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
PartialEq for ExitCode.catch_unwind can deal with foreign exceptions without UB, although the exact behavior is unspecified.Default for HashMap/HashSet iterators that don’t already have it.ptr::add/sub to not claim equivalence with offset.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_entryThese 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<[_]>::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_mutstr::as_bytes_mutstr::as_mut_ptrstr::from_utf8_unchecked_mutCARGO_MANIFEST_PATH environment variable, similar to CARGO_MANIFEST_DIR but pointing directly to the manifest file.package.autolib to the manifest, allowing [lib] auto-discovery to be disabled.# headers from the main item’s doc comment. This is similar to a third-party feature provided by the rustdoc-search-enhancements browser extension.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_TARGET or fix your #[link] attributes to point to the correct frameworks. See https://github.com/rust-lang/rust/pull/129369.
The future incompatibility lint deprecated_cfg_attr_crate_type_name has 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-type instead of #![cfg_attr(..., crate_type = "...")] and --crate-name instead of #![cfg_attr(..., crate_name = "...")] when running rustc/cargo rustc on 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/$hash in 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 with `RUST_BACKTRACE=full` for a verbose backtrace.We want to change this behaviour such that, when
rust-srcsource files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a--remap-path-prefixthat 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_docs lint used to disable itself when invoked through rustc --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 new missing_docs diagnostics for publicly reachable #[cfg(test)] items, integration test crate-level documentation, and publicly reachable items in integration tests.
The armv8r-none-eabihf target now uses the Armv8-R required set of floating-point features.
The sysroot no longer contains the std dynamic library in its top-level lib/ dir.
addr_of(_mut)! macros and the newly stabilized &raw (const|mut) are now safe to use with all static itemsfor<...> binder in trait bounds+ use<'lt> opaque type precise capturing (RFC 3617)&raw const and &raw mut operators (RFC 2582)offset_of!T to be live when dropping [T; 0]const operands in inline assemblyconst fnaarch64-apple-ios-macabi and x86_64-apple-ios-macabi to Tier 2, and ship them with rustup-> !aarch64-apple-darwin to Tier 1aarch64-unknown-trusty and armv7-unknown-trusty as tier 3 targetswasm32-wasip2 to Tier 2.std::thread::Builder::spawn_uncheckedstd::str::CharIndices::offsetstd::option::Option::is_none_or[T]::is_sorted[T]::is_sorted_by[T]::is_sorted_by_keyIterator::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_initRc<[T]>::new_uninit_sliceRc<[MaybeUninit<T>]>::assume_initArc<T>::new_uninitArc<MaybeUninit<T>>::assume_initArc<[T]>::new_uninit_sliceArc<[MaybeUninit<T>]>::assume_initBox<T>::new_uninitBox<MaybeUninit<T>>::assume_initBox<[T]>::new_uninit_sliceBox<[MaybeUninit<T>]>::assume_initcore::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_addThese 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::kindexplicit_builtin_cfgs_in_flags lint in order to prevent incoherent state, eg. windows cfg active but target is Linux based. The appropriate rustc flag should be used instead.binary_search which is 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.MSG_NOSIGNAL when 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.multivalue and reference-types are now
both enabled by default. These two features both have subtle changes implied
for generated WebAssembly binaries. For the multivalue feature, WebAssembly
target support has changed when upgrading to LLVM 19. Support for generating
functions with multiple returns no longer works and
-Ctarget-feature=+multivalue has 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 the
reference-types feature the encoding of immediates in the call_indirect, a
commonly used instruction by the WebAssembly backend, has changed. Validators
and parsers which don’t understand the reference-types proposal will no
longer accept modules produced by LLVM due to this change in encoding of
immediates. Additionally these features being enabled are encoded in the
target_features custom section and may affect downstream tooling such as
wasm-opt consuming the module. Generating a WebAssembly module that disables
default features requires -Zbuild-std support from Cargo and more information
can be found at
rust-lang/rust#128511.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.
extern "C" functions.& in elided self lifetimes.#[expect] for lints (RFC 2383), like #[allow] with a warning if the lint is not fulfilled.elided_lifetimes_in_associated_constant to deny.offset_from: always allow pointers to point to the same address.-Cinline-threshold=....transmute size checks.box_pointers lint.no_std Xtensa targets: xtensa-esp32-none-elf, xtensa-esp32s2-none-elf, xtensa-esp32s3-none-elfstd Xtensa targets: xtensa-esp32-espidf, xtensa-esp32s2-espidf, xtensa-esp32s3-espidfi686-unknown-redoxarm64ec-pc-windows-msvc to Tier 2.loongarch64-unknown-linux-musl to Tier 2 with host tools.wasm32-wasi. (see compatibility note below)PanicInfo and std’s PanicInfo. (see compatibility note below){Rc,Arc}::make_mut() to unsized types.driftsort and unstable ipnsort. All slice::sort* and slice::select_nth* methods are expected to see significant performance improvements. See the research project for more details.create_dir_all with respect to empty paths.Command’s batch files argument escaping not working when file name has trailing whitespace or periods (CVE-2024-43402).core::errorhint::assert_uncheckedfs::existsAtomicBool::fetch_notDuration::abs_diffIoSlice::advanceIoSlice::advance_slicesIoSliceMut::advanceIoSliceMut::advance_slicesPanicHookInfoPanicInfo::messagePanicMessageThese APIs are now stable in const contexts:
char::from_u32_unchecked (function)char::from_u32_unchecked (method)CStr::count_bytesCStr::from_ptr.cargo_vcs_info.json is always included, even when --allow-dirty is passed.package.license-file and package.readme pointing to non-existent files during packaging.--release/--debug flag along with the --profile flag.lib.plugin key support in Cargo.toml. Rust plugin support has been deprecated for four years and was removed in 1.75.0.Usage of the wasm32-wasi target will now issue a compiler warning and request users switch to the wasm32-wasip1 target instead. Both targets are the same, wasm32-wasi is only being renamed, and this change to the WASI target is being done to enable removing wasm32-wasi in January 2025.
We have renamed std::panic::PanicInfo to std::panic::PanicHookInfo. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.
core::panic::PanicInfo will remain unchanged, however, as this is now a different type.
The reason is that these types have different roles: std::panic::PanicHookInfo is the argument to the panic hook in std context (where panics can have an arbitrary payload), while core::panic::PanicInfo is the argument to the #[panic_handler] in no_std context (where panics always carry a formatted message). Separating these types allows us to add more useful methods to these types, such as std::panic::PanicHookInfo::payload_as_str() and core::panic::PanicInfo::message().
The new sort implementations may panic if a type’s implementation of Ord (or the given comparison function) does not implement a total order as the trait requires. Ord’s supertraits (PartialOrd, Eq, and PartialEq) must also be consistent. The previous implementations would not “notice” any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
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.
dead_code lint from 1.80.0exclusive_range_pattern featureResult in some scenariosrepr(packed(1))for_loops_over_fallibles lint to lint on fallibles behind references.-fuse-ld=lld on CCs that don’t support it...) as a type in trait bounds-fuse-ld=lldfoo.into_iter() resolving to &Box<[T]>: IntoIteratorsize_of and size_of_val and align_of and align_of_val to the preludePathBuf::set_extension would add a path separatorc_char on AIX to use the correct typeoffset_of! no longer returns a temporarystr.to_lowercase correctlyDEFAULT_MIN_STACK_SIZE to at least 64KiBimpl Default for Rc<CStr>impl Default for Rc<str>impl Default for Rc<[T]>impl Default for Arc<str>impl Default for Arc<CStr>impl Default for Arc<[T]>impl IntoIterator for Box<[T]>impl FromIterator<String> for Box<str>impl FromIterator<char> for Box<str>LazyCellLazyLockDuration::div_duration_f32Duration::div_duration_f64Option::take_ifSeek::seek_relativeBinaryHeap::as_sliceNonNull::offsetNonNull::byte_offsetNonNull::addNonNull::byte_addNonNull::subNonNull::byte_subNonNull::offset_fromNonNull::byte_offset_fromNonNull::readNonNull::read_volatileNonNull::read_unalignedNonNull::writeNonNull::write_volatileNonNull::write_unalignedNonNull::write_bytesNonNull::copy_toNonNull::copy_to_nonoverlappingNonNull::copy_fromNonNull::copy_from_nonoverlappingNonNull::replaceNonNull::swapNonNull::drop_in_placeNonNull::align_offset<[T]>::split_at_checked<[T]>::split_at_mut_checkedstr::split_at_checkedstr::split_at_mut_checkedstr::trim_asciistr::trim_ascii_startstr::trim_ascii_end<[u8]>::trim_ascii<[u8]>::trim_ascii_start<[u8]>::trim_ascii_endIpv4Addr::BITSIpv4Addr::to_bitsIpv4Addr::from_bitsIpv6Addr::BITSIpv6Addr::to_bitsIpv6Addr::from_bitsVec::<[T; N]>::into_flattened<[[T; N]]>::as_flattened<[[T; N]]>::as_flattened_mutThese APIs are now stable in const contexts:
-Zcheck-cfg as always enabledcheck-cfg lint config for the unexpected_cfgs lintcargo update --precise <yanked>Cargo.toml when using cargo addcargo fix on IPv6-only networkscustom_code_classes_in_docs feature-std::env::{set_var, remove_var} can no longer be converted to safe function pointers and no longer implement the Fn family of traitsSelf constructor from outer item is referenced in inner nested itemindirect_structural_match and pointer_structural_match lints into hard errorswhere_clause_object_safety lint a regular object safety violationproc_macro_back_compat lint into a hard error.std::sync::ReentrantLockGuard<T> is no longer Sync if T: !Sync which means std::io::StdoutLock and std::io::StderrLock are no longer SyncFromIterator for Box<str>.
Notably, this breaks versions of the time crate before 0.3.35, due to no longer inferring the implementation for Box<[_]>.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.
const {} expressions.redundant_lifetimes lint to detect lifetimes which are semantically redundant.unnameable_types lint for public types that can’t be named.-C collapse-macro-debuginfo and #[collapse_debuginfo].if and match expressions.const fn calls.refining_impl_trait lint.main from other modules or crates.impl Trait lifetime inference-C strip to only affect binaries, not artifacts like .pdb.-Crelro-level for controlling runtime link hardening.cfg names and values at compile-time with --check-cfg.
Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release.aarch64-apple-visionos and aarch64-apple-visionos-sim tier 3 targets.riscv32ima-unknown-none-elf tier 3 target.aarch64-pc-windows-gnullvm, i686-pc-windows-gnullvm, and x86_64-pc-windows-gnullvm.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
FromIterator for (impl Default + Extend, impl Default + Extend).{Div,Rem}Assign<NonZero<X>> on X.clone_from() in core/std.transmute between pointers and integers.{integer}::unchecked_add{integer}::unchecked_mul{integer}::unchecked_sub<[T]>::split_at_unchecked<[T]>::split_at_mut_unchecked<[u8]>::utf8_chunksstr::Utf8Chunksstr::Utf8Chunk<*const T>::is_aligned<*mut T>::is_alignedNonNull::is_aligned<*const [T]>::len<*mut [T]>::len<*const [T]>::is_empty<*mut [T]>::is_emptyNonNull::<[T]>::is_emptyCStr::count_bytesio::Error::downcastnum::NonZero<T>path::absoluteproc_macro::Literal::byte_characterproc_macro::Literal::c_stringThese APIs are now stable in const contexts:
Atomic*::into_innerio::Cursor::newio::Cursor::get_refio::Cursor::positionio::emptyio::repeatio::sinkpanic::Location::callerpanic::Location::filepanic::Location::linepanic::Location::columnlib.name, always normalizing to _.cargo add.gitoxide by default for listing files./ in docs to begin a search.RustcEncodable and RustcDecodable are soft-destabilized, to be removed
from the prelude in next edition.wasm_c_abi future-incompatibility lint will warn about use of the
non-spec-compliant C ABI.
Use wasm-bindgen v0.2.88 to generate forward-compatible bindings.#[cfg(target_abi = ...)]#[diagnostic] namespace and #[diagnostic::on_unimplemented] attributeillegal_floating_point_literal_patterninvalid_reference_casting to include references casting to bigger memory layoutnon_contiguous_range_endpoints lint for singleton gaps after exclusive rangeswasm_c_abi lint for use of older wasm-bindgen versions
This lint currently only works when using Cargo.indirect_structural_match and pointer_structural_match lints to match RFCPartialEq-typed consts as patterns a hard errorrefining_impl_trait lint into _reachable, _internal variantswhere-boundstrait Trait: Auto {}: allow upcasting from dyn Trait to dyn Trait + AutoINVALID_DOC_ATTRIBUTES lint deny by defaultuse checkingTarget changes:
wasm32-wasip1 tier 2 (without host tools) targetwasm32-wasip2 tier 3 targetwasm32-wasi-preview1-threads to wasm32-wasip1-threadsarm64ec-pc-windows-msvc tier 3 targetarmv8r-none-eabihf tier 3 target for the Cortex-R52loongarch64-unknown-linux-musl tier 3 targetRefer to Rust’s platform support page for more information on Rust’s tiered platform support.
RwLock with custom implementationchar::is_grapheme_extendedimpl Read for &Stdin'static lifetimes for several std::error::Error related implementationsimpl<Fd: AsFd> impl take ?Sizedimpl From<TryReserveError> for io::ErrorThese APIs are now stable in const contexts:
rust-version when generating lockfile--charset via auto-detecting config valuetarget.<triple>.rustdocflags officiallyimpl Traitarithmetic_overflow lintconst initializers
This code was accidentally accepted. The fix can break generic code that borrows a value of unknown type,
as there is currently no way to declare “this type has no interior mutability”. In the future, stabilizing
the Freeze trait will allow proper support for such code.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.
rustc with 1CGU on x86_64-pc-windows-msvcrustc with 1CGU on x86_64-apple-darwinrun-make V2 infrastructure, a run_make_support library and port over 2 tests as examplestatic_mut_refs to warn on references to mutable statics.unstable_features and make use of it in the compiler.soft_unstable in future breakage reports.i128 and u128 16-byte aligned on x86-based targets.--verbose in diagnostic output.unused_tuple_struct_fields lint into dead_code.fn/const items implied bounds and well-formedness check.riscv32{im|imafc}-unknown-none-elf targets to tier 2.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
array::each_refarray::each_mutcore::netf32::round_ties_evenf64::round_ties_evenmem::offset_of!slice::first_chunkslice::first_chunk_mutslice::split_first_chunkslice::split_first_chunk_mutslice::last_chunkslice::last_chunk_mutslice::split_last_chunkslice::split_last_chunk_mutslice::chunk_byslice::chunk_by_mutBound::mapFile::create_newMutex::clear_poisonRwLock::clear_poisoncargo::.id format as PackageIDSpec.cargo-util-schemas as a crate.().localStorage.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.
ambiguous_wide_pointer_comparisons that supersedes clippy::vtable_address_comparisons#[must_use] pointers (in particular, Box<T> where T is #[must_use]) in unused_must_use.$message_type field to distinguish json diagnostic outputsRefer to Rust’s platform support page for more information on Rust’s tiered platform support.
dbg!()std::hash::{DefaultHasher, RandomState} exportsRwLockReadGuard and RwLockWriteGuard’s Debug impls.File::create to work on hidden filesArc::unwrap_or_cloneRc::unwrap_or_cloneResult::inspectResult::inspect_errOption::inspecttype_name_of_valstd::hash::{DefaultHasher, RandomState}
These were previously available only through std::collections::hash_map.ptr::{from_ref, from_mut}ptr::addr_eqSee Cargo release notes.
() with user-provided spans,
which means that this lint will warn for user code.print_tts
This change can break some naive manual parsing of token trees in proc macro
code which expect a particular structure after .to_string(), rather than just arbitrary Rust code.IMPLIED_BOUNDS_ENTAILMENT into a hard error from a lintimpl FromIterator for Vec
for more details.default on free const itemsasync fn and return-position impl Trait in traits.&mut T in const contexts.usize/isize exhaustively with half-open ranges.char has the same size and alignment as u32.match.COINDUCTIVE_OVERLAP_IN_COHERENCE to deny, and warn in dependencies.riscv64-linux-android target spec.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Waker::clone_from to avoid cloning Wakers unnecessarily.BufRead for VecDeque<u8>.FusedIterator for DecodeUtf16 when the inner iterator does.Not, Bit{And,Or}{,Assign} for IP addresses.Default for ExitCode.str::SplitInclusive’s DoubleEndedIterator implcfg(unix) platforms.Atomic*::from_ptrFileTimesFileTimesExtFile::set_modifiedFile::set_timesIpAddr::to_canonicalIpv6Addr::to_canonicalOption::as_sliceOption::as_mut_slicepointer::byte_addpointer::byte_offsetpointer::byte_offset_frompointer::byte_subpointer::wrapping_byte_addpointer::wrapping_byte_offsetpointer::wrapping_byte_subThese APIs are now stable in const contexts:
Ipv6Addr::to_ipv4_mappedMaybeUninit::assume_init_readMaybeUninit::zeroedmem::discriminantmem::zeroed[workspace.members] automatically.Cargo.toml manifests.#[repr(transparent)] if it isn’t part of the public ABI.const contexts.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.
librustc_driver.so with BOLT.rustc-codegen-cranelift as rustup component on the nightly channel.std::mem::Discriminant<T> does not depend on any lifetimes in Tprivate_in_public lint with private_interfaces and private_bounds per RFC 2145.
Read more in RFC 2145.#[repr(Rust)]async blocksimpl_trait_projectionsPATH option for --print KIND=PATH*-apple-ios-macabii686-pc-windows-gnullvm as a tier 3 targetFrom<OwnedFd/Handle> for ChildStdin/out/errFrom<{&,&mut} [T; N]> for Vec<T> where T: CloneFrom<[T; N]> for Rc<[T]> and Arc<[T]>impl TryFrom<char> for u16io_error_other featureSaturating typecore::num::Saturatingimpl From<io::Stdout> for std::process::Stdioimpl From<io::Stderr> for std::process::Stdioimpl From<OwnedHandle> for std::process::Child{Stdin, Stdout, Stderr}impl From<OwnedFd> for std::process::Child{Stdin, Stdout, Stderr}std::ffi::OsString::from_encoded_bytes_uncheckedstd::ffi::OsString::into_encoded_bytesstd::ffi::OsStr::from_encoded_bytes_uncheckedstd::ffi::OsStr::as_encoded_bytesstd::io::Error::otherimpl TryFrom<char> for u16impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T>impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T>impl<T, const N: usize> From<[T; N]> for Arc<[T]>impl<T, const N: usize> From<[T; N]> for Rc<[T]>These APIs are now stable in const contexts:
Cargo.toml, stabilize [lints]--keep-going build flag--help outputcargo clean, add --dry-run flag and summary line at the endcargo update, make --package more convenient by being positionalcargo update, clarify meaning of –aggressive as –recursive--dry-run--package flags) to resolve ambiguities.cargo/config.toml, merge lists in precedence ordertarget.'cfg(..)'.linker--externimpl From<{&,&mut} [T; N]> for Vec<T> is known to cause some inference failures with overly-generic code. In those examples using the tui crate, the combination of AsRef<_> and Into<Vec> leaves the middle type ambiguous, and the new impl adds another possibility, so it now requires an explicit type annotation.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.
None this cycle.
clippy::fn_null_check lint as useless_ptr_null_checks.noop_method_call warn by default.try and async in macros.unconditional_recursion lint detect recursive drops.invalid_reference_casting lint is now deny-by-default (instead of allow-by-default).comment section like GCC/Clang.extern "thiscall" and "thiscall-unwind" ABIs.wasm32-wasi-preview1-threads as a tier 2 target.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Read, Write and Seek impls for Arc<File>.io::Sink into io::Empty.RefUnwindSafe for BacktraceExitStatus implement Defaultimpl SliceIndex<str> for (Bound<usize>, Bound<usize>)assert_eq! & assert_ne! panic messages.stat struct definitions.{integer}::div_ceil{integer}::next_multiple_of{integer}::checked_next_multiple_ofstd::ffi::FromBytesUntilNulErrorstd::os::unix::fs::chownstd::os::unix::fs::fchownstd::os::unix::fs::lchownLocalKey::<Cell<T>>::getLocalKey::<Cell<T>>::setLocalKey::<Cell<T>>::takeLocalKey::<Cell<T>>::replaceLocalKey::<RefCell<T>>::with_borrowLocalKey::<RefCell<T>>::with_borrow_mutLocalKey::<RefCell<T>>::setLocalKey::<RefCell<T>>::takeLocalKey::<RefCell<T>>::replaceThese APIs are now stable in const contexts:
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.
rustc_apfloat with the new version of the crate.internal_features lint for internal unstable features.#![cfg(FALSE)] behaves on crate rootclippy::undropped_manually_drops lintclippy::invalid_utf8_in_unchecked lint as invalid_from_utf8_unchecked and invalid_from_utf8clippy::cast_ref_to_mut lint as invalid_reference_castingclippy::cmp_nan lint as invalid_nan_comparisonsdyn Trait objectscfg-ed out items to mention them in diagnostics- is given as output fileloongarch64-unknown-none*.eh_frame from being emitted for -C panic=abortRefer to Rust’s platform support page for more information on Rust’s tiered platform support.
thread::{park, unpark}T: Sized bounds on BufReader<T>, BufWriter<T> and LineWriter<T>select_nth_unstableOk on kill if process has already exitedVecs over different allocators{Arc,Rc,Weak}::ptr_eq ignore pointer metadata[]These APIs are now stable in const contexts:
-Zdoctest-in-workspace by default. When running each documentation
test, the working directory is set to the root directory of the package the
test belongs to.
docs
#12221
#12288build.jobs
parallelism back to the default.
#12222Display for Ipv6Addr for IPv4-compatible addressesmips*-unknown-linux-gnu* targets from host tier 2 to target tier 3 support.suspicious_double_ref_op lint when calling borrow()can_eq in derive(..) suggestion for missing methodraw-dylib, link_ordinal, import_name_type and -Cdlltool.clippy::{drop,forget}_{ref,copy} lints.Drop impl compatibilityPlaceMention,
making let _ = patterns more consistent with respect to the borrow checker.--print deployment-target flag for Apple targets.extern "C-unwind" and friends.
The existing extern "C" etc. may change behavior for cross-language unwinding in a future release.*-linux-musl targets to 1.2.3,
enabling time64 on 32-bit systems.debugger_visualizer
for embedding metadata like Microsoft’s Natvis.Self respect tuple constructor privacy.apple-m1 as the target CPU for aarch64-apple-darwin.x86_64h-apple-darwin target.loongarch64-unknown-linux-gnu to Tier 2 with host tools.Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Drop implementation, but panicking within a panic hook is now an immediate abort.From<&[T]> for Box<[T]> bound to T: Clone.T: Send bound
in Error for mpsc::SendError<T> and TrySendError<T>.alloc::realloc
to match Layout requirements that the size must not exceed isize::MAX.const {} syntax for std::thread_local.
This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.CStr::is_emptyBuildHasher::hash_oneNonZeroI*::is_positiveNonZeroI*::is_negativeNonZeroI*::checked_negNonZeroI*::overflowing_negNonZeroI*::saturating_negNonZeroI*::wrapping_negNeg for NonZeroI*Neg for &NonZeroI*From<[T; N]> for (T...)
(array to N-tuple for N in 1..=12)From<(T...)> for [T; N]
(N-tuple to array for N in 1..=12)windows::io::AsHandle for Box<T>windows::io::AsHandle for Rc<T>windows::io::AsHandle for Arc<T>windows::io::AsSocket for Box<T>windows::io::AsSocket for Rc<T>windows::io::AsSocket for Arc<T>These APIs are now stable in const contexts:
<*const T>::read<*const T>::read_unaligned<*mut T>::read<*mut T>::read_unalignedptr::readptr::read_unaligned<[T]>::split_atCargo.toml.workspace_default_members to the output of cargo metadata.cargo new/cargo init.rustdoc::unescaped_backticks lint for broken inline code.~~old~~ vs. ~new~)TypeId.
Code that uses a constant TypeId in a pattern will potentially be broken.
Known cases have already been fixed – in particular, users of the log
crate’s kv_unstable feature should update to log v0.4.18 or later.sysroot crate to represent the standard library crates.
This does not affect stable users, but may require adjustment in tools that build their own standard library.rustup. When
Cargo detects it will run rustc pointing to a rustup proxy, it’ll try bypassing the proxy and
use the underlying binary directly. There are assumptions around the interaction with rustup and
RUSTUP_TOOLCHAIN. However, it’s not expected to affect normal users.RUSTUP_HOME and
RUSTUP_TOOLCHAIN in the [env] configuration
table. This is considered to be not a use case Cargo would like to support, since it will likely
cause problems or lead to confusion.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.
asm! operandsformat_args invocations to uses captureslet _ = expr position.-Cdebuginfo=line-tables-only), which may eventually become the default for -Cdebuginfo=1.unused_allocation lint against Box::new tooloongarch64-unknown-linux-gnui586-pc-nto-qnx700 (QNX Neutrino RTOS, version 7.0),Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Command prefer non-verbatim pathsconcat!Cellpartial_cmp to implement tuple lt/le/ge/gtatomic_as_ptrnonnull_slice_from_raw_partsonce_cellnonzero_min_maxFnPtr trait that is implemented for all function pointers
This extends Debug, Pointer, Hash, PartialEq, Eq, PartialOrd, and Ord
implementations for function pointers with all ABIs.NonZero*::MIN/MAXBinaryHeap::retainDefault for std::collections::binary_heap::IntoIterDefault for std::collections::btree_map::{IntoIter, Iter, IterMut}Default for std::collections::btree_map::{IntoKeys, Keys}Default for std::collections::btree_map::{IntoValues, Values}Default for std::collections::btree_map::RangeDefault for std::collections::btree_set::{IntoIter, Iter}Default for std::collections::btree_set::RangeDefault for std::collections::linked_list::{IntoIter, Iter, IterMut}Default for std::vec::IntoIterDefault for std::iter::ChainDefault for std::iter::ClonedDefault for std::iter::CopiedDefault for std::iter::EnumerateDefault for std::iter::FlattenDefault for std::iter::FuseDefault for std::iter::RevDefault for std::slice::IterDefault for std::slice::IterMutRc::into_innerArc::into_innerstd::cell::OnceCellOption::is_some_andNonNull::slice_from_raw_partsResult::is_ok_andResult::is_err_andstd::sync::atomic::Atomic*::as_ptrstd::io::IsTerminalstd::os::linux::net::SocketAddrExtstd::os::unix::net::UnixDatagram::bind_addrstd::os::unix::net::UnixDatagram::connect_addrstd::os::unix::net::UnixDatagram::send_to_addrstd::os::unix::net::UnixListener::bind_addrstd::path::Path::as_mut_os_strstd::sync::OnceLockCARGO_PKG_READMEsparse the default protocol for crates.iocargo logoutlibtest from supporting -Zunstable-optionslet _ = expr position.sign-ext and mutable-globals features in codegen
This may cause incompatibility with older execution environments.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.
Copy fields.cmpxchg16b target feature on x86 and x86_64.Self: Autotrait bounds on dyn-safe trait methods.str as containing [u8] for auto trait purposes.*-pc-windows-gnu on CI to mingw-w64 v10 and GCC 12.2.true and false as boolean flags in compiler arguments.repr(C) enums to c_int size.DispatchFromDyn for cell types, allowing downstream experimentation with custom method receivers.fmt::Arguments::as_str() may return Some(_) in more cases after optimization, subject to change.AsFd and AsRawFd for Rc.These APIs are now stable in const contexts:
SocketAddr::newSocketAddr::ipSocketAddr::portSocketAddr::is_ipv4SocketAddr::is_ipv6SocketAddrV4::newSocketAddrV4::ipSocketAddrV4::portSocketAddrV6::newSocketAddrV6::ipSocketAddrV6::portSocketAddrV6::flowinfoSocketAddrV6::scope_idcargo fix or cargo clippy --fix when compilation warnings are auto-fixable.cargo add if you try to install a library crate.CARGO_BIN_NAME environment variable also for binary examples.rustdoc::all group.!.rust-analysis component from rustup now only contains a warning placeholder. This was primarily intended for RLS, and the corresponding -Zsave-analysis flag has been removed from the compiler as well.default-features is set to false of a workspace dependency, and an inherited dependency of a member has default-features = true, Cargo will enable default features of that dependency.CARGO_HOME in the [env] configuration table. Cargo itself doesn’t pick up this value, but recursive calls to cargo would, which was not intended.tools = [...] is set in bootstrap.toml, we will respect a missing rustdoc in that list. By
default rustdoc remains included. To retain the prior behavior explicitly add "rustdoc" to the
list.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.
@revoked and a better error message for @cert-authority in Cargo’s SSH host key verification$prefix-clang as clang in linker detection codealloc on stable without requiring the
definition of a handler for allocation failure. Defining custom handlers is still unstable.efiapi calling convention.bindings_with_variant_name to deny-by-defaultarmv7-sony-vita-newlibeabihf as a tier 3 targetstd::task::Context !Send and !SyncOnceWith & RepeatWithVec -> VecDeque conversion guarantee{core,std}::pin::pin!impl From<bool> for {f32,f64}std::path::MAIN_SEPARATOR_STRimpl DerefMut for PathBufThese APIs are now stable in const contexts:
cargo build --verbose tells you more about why it recompiles.net.git-fetch-with-cli option enabledSEMICOLON_IN_EXPRESSIONS_FROM_MACROS to future-incompat report--target by default for -Zgcc-ld=lld on wasmIMPLIED_BOUNDS_ENTAILMENT to Deny + ReportNowstd::task::Context no longer implements Send and SyncThese changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
x86_64-pc-windows-msvcx86_64-apple-darwinclippy::uninlined_format_args to pedantic.Sized predicates coinductive, allowing cycles.#[must_use] annotations on async fn also affect the Future::Output.cfg(FALSE).C or cdecl.verbatim.Added, updated, and removed targets:
powerpc64-ibm-aix.mipsel-sony-psx.no_std targets for the QNX Neutrino RTOS,
aarch64-unknown-nto-qnx710 and x86_64-pc-nto-qnx710.aarch64-unknown-uefi, i686-unknown-uefi, and x86_64-unknown-uefi.linuxkernel targets (not used by the actual kernel).Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
crossbeam-channel into std::sync::mpsc.Eq and Hash for ControlFlow.compiler_builtins with -C panic=abort.{integer}::checked_ilog{integer}::checked_ilog2{integer}::checked_ilog10{integer}::ilog{integer}::ilog2{integer}::ilog10NonZeroU*::ilog2NonZeroU*::ilog10NonZero*::BITSThese APIs are now stable in const contexts:
repr(Rust) types now groups m*2^n-sized fields with
equivalently aligned ones.
This is intended to be an optimization, but it is also known to increase type
sizes in a few cases for the placement of enum tags. As a reminder, the layout
of repr(Rust) types is an implementation detail, subject to change.&& and || will now drop temporaries from their sub-expressions in
evaluation order, left-to-right.
Previously, it was “twisted” such that the first expression dropped its
temporaries last, after all of the other expressions dropped in order.-export-dynamic to wasm-ld.main is now mangled as __main_void on wasm32-wasi.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.
repr(Int) enums
must_use on impl Trait for supertraits
This makes impl ExactSizeIterator respect the existing #[must_use] annotation on Iterator...=X in patternsclippy::for_loops_over_fallibles lint into rustcsym operands in inline assembly#[derive(Default)] on a generic #[default] enum adding unnecessary Default boundsproc_macro::Span::source_textuX::{checked_add_signed, overflowing_add_signed, saturating_add_signed, wrapping_add_signed}iX::{checked_add_unsigned, overflowing_add_unsigned, saturating_add_unsigned, wrapping_add_unsigned}iX::{checked_sub_unsigned, overflowing_sub_unsigned, saturating_sub_unsigned, wrapping_sub_unsigned}BTreeSet::{first, last, pop_first, pop_last}BTreeMap::{first_key_value, last_key_value, first_entry, last_entry, pop_first, pop_last}AsFd implementations for stdio lock types on WASI.impl TryFrom<Vec<T>> for Box<[T; N]>core::hint::black_boxDuration::try_from_secs_{f32,f64}Option::unzipstd::os::fdcargo remove to remove dependencies from Cargo.tomlcargo publish now waits for the new version to be downloadable before exitingSee detailed release notes for more.
ProceduralMasquerade hack to older versions of rental__heap_base and __data_end on wasm32-wasi.__wasm_init_memory on WebAssembly.__tls_* on wasm32-unknown-unknown.libresolv in libstd on Darwinlibstd no longer pull in libiconv.dylib on Darwin)order_dependent_trait_objects show up in future-breakage reportsThese changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
as casts of enums with #[non_exhaustive] variantslet elselet_underscore_drop and let_underscore_lock from Clippybreaking from arbitrary labeled blocks (“label-break-value”)MaybeUninit is the correct way to work with uninitialized memory.Drop impl on foreign ADTsspecial_module_name lint-C instrument-coverageNew targets:
PartialEq::ne in derive(PartialEq)BCRYPT_RNG_ALG_HANDLE by defaultSystem with direct system allocator callsstd::layout::Layout size must not overflow isize::MAX when rounded up to align
This also changes the safety conditions on Layout::from_size_align_unchecked.std::backtrace::BacktraceBound::as_refstd::io::read_to_string<*const T>::cast_mut<*mut T>::cast_constThese APIs are now stable in const contexts:
std::layout::Layout size must not overflow isize::MAX when rounded up to align.
This also changes the safety conditions on Layout::from_size_align_unchecked.PollFn now only implements Unpin if the closure is Unpin.
This is a possible breaking change if users were relying on the blanket unpin implementation.
See discussion on the PR for details of why this change was made.#![cfg_attr(..., crate_type = ...)] to set the crate type
This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny.llvm-has-rust-patches allows setting the build system to treat the LLVM as having Rust-specific patches
This option may need to be set for distributions that are building Rust with a patched LLVM via llvm-config, not the built-in LLVM.lld. For more information, see issue 102754.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.
x.sh and x.ps1 shell scripts&T if every byte in T is inside an UnsafeCellunused_tuple_struct_fields, similar to the existing warning for unused struct fields. This lint will become warn-by-default in the future.#[used] as llvm.compiler.used for ELF targets--diagnostic-width compiler flag to define the terminal width.rust-lld for iOS, tvOS and watchOSwrite! or writeln! into an OsString: Implement fmt::Write for OsStringFusedIterator for std::net::[Into]Incomingimpl<T: AsRawFd> AsRawFd for {Arc,Box}<T>ptr::copy and ptr::swap are doing untyped copiesavailable_parallelismmem::uninitializedfuture::IntoFuturefuture::poll_fntask::ready!num::NonZero*::checked_mulnum::NonZero*::checked_pownum::NonZero*::saturating_mulnum::NonZero*::saturating_pownum::NonZeroI*::absnum::NonZeroI*::checked_absnum::NonZeroI*::overflowing_absnum::NonZeroI*::saturating_absnum::NonZeroI*::unsigned_absnum::NonZeroI*::wrapping_absnum::NonZeroU*::checked_addnum::NonZeroU*::checked_next_power_of_twonum::NonZeroU*::saturating_addos::unix::process::CommandExt::process_groupos::windows::fs::FileTypeExt::is_symlink_diros::windows::fs::FileTypeExt::is_symlink_fileThese types were previously stable in std::ffi, but are now also available in core and alloc:
core::ffi::CStrcore::ffi::FromBytesWithNulErroralloc::ffi::CStringalloc::ffi::FromVecWithNulErroralloc::ffi::IntoStringErroralloc::ffi::NulErrorThese types were previously stable in std::os::raw, but are now also available in core::ffi and std::ffi:
ffi::c_charffi::c_doubleffi::c_floatffi::c_intffi::c_longffi::c_longlongffi::c_scharffi::c_shortffi::c_ucharffi::c_uintffi::c_ulongffi::c_ulonglongffi::c_ushortThese APIs are now usable in const contexts:
workspace.package
and
workspace.dependencies
for more details on how to define these common settings.--target flags to build for
multiple targets at once, and the
build.target
config option may now take an array of multiple targets.--jobs argument can now take a negative number to count backwards from
the max CPUs.cargo add will now update Cargo.lock.--crate-type
flag to cargo rustc to override the crate type.rev field.-linux-gnu targets are now at least kernel 3.2 and glibc 2.17, for targets that previously supported older versions: Increase the minimum linux-gnu versionstransmute_copy’s U is not larger than TBTreeMap was fixed that allowed data it was borrowing to be dropped before the container.thumbv6m-none-eabi target, some incorrect asm! statements were erroneously accepted if they used the high registers (r8 to r14) as an input/output operand. This is no longer accepted.impl Trait was accidentally accepted as the associated type value of return-position impl Trait, without fulfilling all the trait bounds of that associated type, as long as the hidden type satisfies said bounds. This has been fixed.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.
Vec::insert for the case where index == len.impl Trait args.cenum_impl_drop_cast warnings deny-by-default.-C panic=abort is used regardless of declared ABI.bundle native library modifier, also removing the
deprecated static-nobundle linking kind.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Copy, Clone, PartialEq and Eq for core::fmt::Alignment.ptr::null and null_mut to all thin (including extern) types.impl Read and Write for VecDeque<u8>.[OsStr]::join.Hash for core::alloc::Layout.OsString.std::mem::needs_drop accept ?Sized.impl Termination for Infallible and then make the Result impls of Termination more generic./proc/self/mem.array::from_fnBox::into_pinBinaryHeap::try_reserveBinaryHeap::try_reserve_exactOsString::try_reserveOsString::try_reserve_exactPathBuf::try_reservePathBuf::try_reserve_exactPath::try_existsRef::filter_mapRefMut::filter_mapNonNull::<[T]>::lenToOwned::clone_intoIpv6Addr::to_ipv4_mappedunix::io::AsFdunix::io::BorrowedFd<'fd>unix::io::OwnedFdwindows::io::AsHandlewindows::io::BorrowedHandle<'handle>windows::io::OwnedHandlewindows::io::HandleOrInvalidwindows::io::HandleOrNullwindows::io::InvalidHandleErrorwindows::io::NullHandleErrorwindows::io::AsSocketwindows::io::BorrowedSocket<'handle>windows::io::OwnedSocketthread::scopethread::Scopethread::ScopedJoinHandleThese APIs are now usable in const contexts:
array::from_refslice::from_refintrinsics::copyintrinsics::copy_nonoverlapping<*const T>::copy_to<*const T>::copy_to_nonoverlapping<*mut T>::copy_to<*mut T>::copy_to_nonoverlapping<*mut T>::copy_from<*mut T>::copy_from_nonoverlappingstr::from_utf8Utf8Error::error_lenUtf8Error::valid_up_toCondvar::newMutex::newRwLock::new--config path command-line argument.CARGO_PKG_RUST_VERSION.#[link] attributes are now checked more strictly, which may introduce
errors for invalid attribute arguments that were previously ignored.Duration. The converted
duration can differ slightly from what it was.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Rust 1.62.1 addresses a few recent regressions in the compiler and standard library, and also mitigates a CPU vulnerability on Intel SGX.
impl Trait return types.async fn lifetimes.x86_64-fortanix-unknown-sgx target added a mitigation for the
MMIO stale data vulnerability, advisory INTEL-SA-00615.#[derive(Default)] on enums with a #[default] variantconst functions may now specify extern "C" or extern "Rust"unaligned_references lint deny-by-default
This lint is also a future compatibility lint, and is expected to eventually
become a hard error.#[thread_local] attribute on non-static itemsaarch64-pc-windows-gnullvm and x86_64-pc-windows-gnullvm targets*x86_64-unknown-none target to Tier 2** Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
bool::then_somef32::total_cmpf64::total_cmpStdin::lineswindows::CommandExt::raw_argimpl<T: Default> Default for AssertUnwindSafe<T>From<Rc<str>> for Rc<[u8]>From<Arc<str>> for Arc<[u8]>FusedIterator for EncodeWidecargo add command for adding dependencies to Cargo.toml from
the command-line.
docsname@version syntax in addition to the
previous name:version to align with the behavior in cargo add and other
tools. cargo install and cargo yank also now support this syntax so the
version does not need to passed as a separate flag.git and registry directories in Cargo’s home directory (usually
~/.cargo) are now marked as cache directories so that they are not
included in backups or content indexing (on Windows).@ argfile support, which will use “response files” if the
command-line to rustc exceeds the operating system’s limit.cargo test now passes --target to rustdoc if the specified target is
the same as the host target.
#10594macro_rules! macros, matching other private itemsFile reads or writes cannot
complete synchronously.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
const fn signatures can now include generic trait boundsconst fn signatures can now use impl Trait in argument and return positionconst fnimpl Trait return type#[link] attributes and on the command line, as well as the whole-archive modifier specifically, are now supportedchar type is now described as UTF-32 in debuginfo#[target_feature] attribute can now be used with aarch64 features#[target_feature = "adx"] is now stableManuallyDrop<T> is now documented to have the same layout as T#[ignore = "…"] messages are printed when running testsstd::io::stdio::lock() return 'static handles. Previously, the creation of locked handles to stdin/stdout/stderr would borrow the handles being locked, which prevented writing let out = std::io::stdout().lock(); because out would outlive the return value of stdout(). Such code now works, eliminating a common pitfall that affected many Rust users.Vec::from_raw_parts is now less restrictive about its inputsstd::thread::available_parallelism now takes cgroup quotas into account. Since available_parallelism is often used to create a thread pool for parallel computation, which may be CPU-bound for performance, available_parallelism will return a value consistent with the ability to use that many threads continuously, if possible. For instance, in a container with 8 virtual CPUs but quotas only allowing for 50% usage, available_parallelism will return 4.Pin::static_mutPin::static_refVec::retain_mutVecDeque::retain_mutWrite for Cursor<[u8; N]>std::os::unix::net::SocketAddr::from_pathnamestd::process::ExitCode and std::process::Termination. The stabilization of these two APIs now makes it possible for programs to return errors from main with custom exit codes.std::thread::JoinHandle::is_finishedThese APIs are now usable in const contexts:
<*const T>::offset and <*mut T>::offset<*const T>::wrapping_offset and <*mut T>::wrapping_offset<*const T>::add and <*mut T>::add<*const T>::sub and <*mut T>::sub<*const T>::wrapping_add and <*mut T>::wrapping_add<*const T>::wrapping_sub and <*mut T>::wrapping_sub<[T]>::as_mut_ptr<[T]>::as_ptr_range<[T]>::as_mut_ptr_rangeNo feature changes, but see compatibility notes.
whole-archive in some cases, but now rustc tries not to use whole-archive unless explicitly requested. This change may result in linking errors in some cases. To fix such errors, native libraries linked from the command line, build scripts, or #[link] attributes need to
a depends on b then a should go first and b second)+whole-archive modifier.ident matchers wrapped in groups# in r# raw string literals is now required to be less than 256cargo vendor now only accepts one value for each --sync flagcfg predicates in all() and any() are always evaluated to detect errors, instead of short-circuiting. The compatibility considerations here arise in nightly-only code that used the short-circuiting behavior of all to write something like cfg(all(feature = "nightly", syntax-requiring-nightly)), which will now fail to compile. Instead, use either cfg_attr(feature = "nightly", ...) or nested uses of cfg.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
#[cfg(panic = "...")] for either "unwind" or "abort".#[cfg(target_has_atomic = "...")] for each integer size and "ptr".+crt-static and relocation-model=pic on x86_64-unknown-linux-gnuunreachable_pub lints on nested and glob public reexport-Z instrument-coverage as -C instrument-coverage-Z print-link-args as --print link-argsmips64-openwrt-linux-musl*armv7-unknown-linux-uclibceabi (softfloat)*RUST_BACKTRACE=full by default* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
sort_by_cached_keyDuration::try_from_secs_f32/f64 accuracy by directly processing exponent and mantissaInstant::{duration_since, elapsed, sub} saturatingInstant::nowBuildHasherDefault, iter::Empty and future::Pending covariantArc::new_cyclicRc::new_cyclicslice::EscapeAscii<[u8]>::escape_asciiu8::escape_asciiVec::spare_capacity_mutMaybeUninit::assume_init_dropMaybeUninit::assume_init_readi8::abs_diffi16::abs_diffi32::abs_diffi64::abs_diffi128::abs_diffisize::abs_diffu8::abs_diffu16::abs_diffu32::abs_diffu64::abs_diffu128::abs_diffusize::abs_diffDisplay for io::ErrorKindFrom<u8> for ExitCodeNot for ! (the “never” type)Assign<$t> for Wrapping<$t>arch::is_aarch64_feature_detected!toml-rs to toml_edit-Ztimings as --timingscargo:rustc-link-arg-* types from build script output.Instant::now. On platforms that don’t provide monotonic clocks, an
instant is not guaranteed to be greater than an earlier instant anymore.Instant::{duration_since, elapsed, sub} do not panic anymore on underflow,
saturating to 0 instead. In the real world the panic happened mostly
on platforms with buggy monotonic clock implementations rather than catching
programming errors like reversing the start and end times. Such programming
errors will now results in 0 rather than a panic.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
-Cremark#[test]-like built-in attribute macro is present multiple times.-Z emit-future-incompat as --json future-incompatThis release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable. This is due to a known and relatively frequently occurring bug in incremental compilation, which causes builds to issue internal compiler errors. This particular bug is already fixed on nightly, but that fix has not yet rolled out to stable and is deemed too risky for a direct stable backport.
As always, we encourage users to test with nightly and report bugs so that we can track failures and fix issues earlier.
See 94124 for more details.
std::thread::available_parallelismResult::copiedResult::clonedarch::asm!arch::global_asm!ops::ControlFlow::is_breakops::ControlFlow::is_continueTryFrom<char> for u8char::TryFromCharError
implementing Clone, Debug, Display, PartialEq, Copy, Eq, Erroriter::zipNonZeroU8::is_power_of_twoNonZeroU16::is_power_of_twoNonZeroU32::is_power_of_twoNonZeroU64::is_power_of_twoNonZeroU128::is_power_of_twoNonZeroUsize::is_power_of_twoDoubleEndedIterator for ToLowercaseDoubleEndedIterator for ToUppercaseTryFrom<&mut [T]> for [T; N]UnwindSafe for OnceRefUnwindSafe for OnceConst-stable:
mem::MaybeUninit::as_ptrmem::MaybeUninit::assume_initmem::MaybeUninit::assume_init_refffi::CStr::from_bytes_with_nul_uncheckedstrip profile option--release as -rterm.quiet configuration--host from cargo {publish,search,login}#![cfg_attr]
This adds a future compatibility lint to supporting the use of cfg_attr
wrapping either crate_type or crate_name specification within Rust files;
it is recommended that users migrate to setting the equivalent command line
flags.#[no_link] attribute on name resolution
This may expose new names, leading to conflicts with preexisting names in a
given namespace and a compilation failure.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
std::fs::remove_dir_all (CVE-2022-21658)useless_format Clippy lintnon_send_fields_in_send_ty Clippy lint to nursery{ident} in the string. This works in all macros accepting format strings. Support for this in panic! (panic!("{ident}")) requires the 2021 edition; panic invocations in previous editions that appear to be trying to use this will result in a warning lint about not having the intended effect.*const T pointers can now be dereferenced in const contexts.Unsize have been relaxed.strip option to remove these symbols to produce smaller release binaries. Note that this release only includes support in rustc, not directly in cargo.-Cremarkx86_64-unknown-none at Tier 3** Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
#[must_use] annotations where appropriate, producing a warning when ignoring their return value. This helps catch mistakes such as expecting a function to mutate a value in place rather than return a new value.copy and copy_nonoverlappingRefUnwindSafe for Rc<T>Termination for Result<Infallible, E>. This allows writing fn main() -> Result<Infallible, ErrorType>, for a program whose successful exits never involve returning from main (for instance, a program that calls exit, or that uses exec to run another program).Metadata::is_symlinkPath::is_symlink{integer}::saturating_divOption::unwrap_uncheckedResult::unwrap_uncheckedResult::unwrap_err_uncheckedFile::optionsThese APIs are now usable in const contexts:
Duration::newDuration::checked_addDuration::saturating_addDuration::checked_subDuration::saturating_subDuration::checked_mulDuration::saturating_mulDuration::checked_divstd::process::Command will no longer search the current directory for executables.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
#[derive] and will see the original (pre-cfg) input.m!{ .. }.method() and m!{ .. }?.Clone and Debug implementations during dead code analysis.armv6k-nintendo-3ds at Tier 3*.armv7-unknown-linux-uclibceabihf at Tier 3*.m68k-unknown-linux-gnu at Tier 3*.aarch64-kmc-solid_asp3, armv7a-kmc-solid_asp3-eabi, armv7a-kmc-solid_asp3-eabihf* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Vec::leak#[repr(i8)] to OrderingFile::read_to_end and read_to_string#[must_use], producing a warning
when ignoring their return value. This helps catch mistakes such as expecting
a function to mutate a value in place rather than return a new value.[T; N]::as_mut_slice[T; N]::as_slicecollections::TryReserveErrorHashMap::try_reserveHashSet::try_reserveString::try_reserveString::try_reserve_exactVec::try_reserveVec::try_reserve_exactVecDeque::try_reserveVecDeque::try_reserve_exactIterator::map_whileiter::MapWhileproc_macro::is_availableCommand::get_programCommand::get_argsCommand::get_envsCommand::get_current_dirCommandArgsCommandEnvsThese APIs are now usable in const contexts:
Clone and Debug implementations during dead code analysis.
This will break some builds that set #![deny(dead_code)].These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
binding @ pattern can now also introduce new bindings.const fn.--force-warn.
This feature is primarily intended for usage by cargo fix, rather than end users.aarch64-apple-ios-sim to Tier 2*.powerpc-unknown-freebsd at Tier 3*.riscv32imc-esp-espidf at Tier 3*.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
AtomicU{64,128} over Mutex for Instant backsliding protection.
For this use case, atomics scale much better under contention.Extend<(A, B)> for (Extend<A>, Extend<B>)impl From<[(K, V); N]> for all collections.P: Unpin bound on impl Future for Pin.=). Now, these functions will
just treat such names as nonexistent variables, since the OS cannot represent
the existence of a variable with such a name.std::os::unix::fs::chrootUnsafeCell::raw_getBufWriter::into_partscore::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}
These APIs were previously stable in std, but are now also available in core.Vec::shrink_toString::shrink_toOsString::shrink_toPathBuf::shrink_toBinaryHeap::shrink_toVecDeque::shrink_toHashMap::shrink_toHashSet::shrink_toThese APIs are now usable in const contexts:
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS warn by defaultlibc::getpid / std::process::id from Command::pre_exec
may return different values on glibc <= 2.24.
Rust now invokes the clone3 system call directly, when available, to use new functionality
available via that system call. Older versions of glibc cache the result of getpid, and only
update that cache when calling glibc’s clone/fork functions, so a direct system call bypasses
that cache update. glibc 2.25 and newer no longer cache getpid for exactly this reason.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
X..), which will start at X and
will end at the maximum value of the integer.std::prelude (e.g. use std::prelude::rust_2021::*;).* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
string::Drain now implements AsRef<str> and AsRef<[u8]>.Bound::clonedDrain::as_strIntoInnerError::into_errorIntoInnerError::into_partsMaybeUninit::assume_init_mutMaybeUninit::assume_init_refMaybeUninit::writearray::mapops::ControlFlowx86::_bittestx86::_bittestandcomplementx86::_bittestandresetx86::_bittestandsetx86_64::_bittest64x86_64::_bittestandcomplement64x86_64::_bittestandreset64x86_64::_bittestandset64The following previously stable functions are now const.
cargo test.cargo metadata now includes the "default_run"
field from the manifest.cargo d as an alias for cargo doc.{lib} as formatting option for cargo tree to print the "lib_name"
of packages.CTRL+F in your browser.#[doc(hidden)] will no longer appear in the
“Trait Implementations” section.io::Error will no longer use the
ErrorKind::Other variant. This is to better reflect that these
kinds of errors could be categorised into newer more specific ErrorKind
variants, and that they do not represent a user error.process::Command on Windows now
behaves as expected. Previously using environment variables with
Command would cause them to be ASCII-uppercased.rustdoc::RUSTFLAGS is no longer set for build scripts. Build scripts
should use CARGO_ENCODED_RUSTFLAGS instead. See the
documentation
for more details.You can now use macros for values in some built-in attributes.
This primarily allows you to call macros within the #[doc] attribute. For
example, to include external documentation in your crate, you can now write
the following:
You can now cast between unsized slice types (and types which contain
unsized slices) in const fn.
You can now use multiple generic lifetimes with impl Trait where the
lifetimes don’t explicitly outlive another. In code this means
that you can now have impl Trait<'a, 'b> where as before you could
only have impl Trait<'a, 'b> where 'b: 'a.
/lib/rustlib/<target-triple>/target.json where / is the “sysroot”
directory. You can find your sysroot directory by running
rustc --print sysroot.wasm as a target_family for WebAssembly platforms.#[target_feature] on safe functions when targeting
WebAssembly platforms.bpfel-unknown-none
and bpfeb-unknown-none.-Zmutable-noalias=yes is enabled by default when using LLVM 12 or above.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
panic::panic_any will now #[track_caller].OutOfMemory as a variant of io::ErrorKind.proc_macro::Literal now implements FromStr.BTreeMap::into_keysBTreeMap::into_valuesHashMap::into_keysHashMap::into_valuesarch::wasm32VecDeque::binary_searchVecDeque::binary_search_byVecDeque::binary_search_by_keyVecDeque::partition_point--prune <spec> option to cargo-tree to remove a package from
the dependency graph.--depth option to cargo-tree to print only to a certain depth
in the tree no-proc-macro value to cargo-tree --edges to hide procedural
macro dependencies.CARGO_TARGET_TMPDIR is available.
This variable points to a directory that integration tests and benches
can use as a “scratchpad” for testing filesystem operations.? is no longer permitted in closures for inferred types.std::arch intrinsics now uses stricter const checking
than before and may reject some previously accepted code.i128 multiplication on Cortex M0+ platforms currently unconditionally causes overflow
when compiled with codegen-units = 1.◆ or 🦀. More specifically you can now use any identifier that
matches the UAX #31 “Unicode Identifier and Pattern Syntax” standard. This
is the same standard as languages like Python, however Rust uses NFC
normalization which may be different from other languages.| (OR) on complete patterns. E.g.
:pat_param macro_rules! matcher. This matcher
has the same semantics as the :pat matcher. This is to allow :pat
to change semantics to being a pattern fragment in a future edition.wasm64-unknown-unknown target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
android_set_abort_message on
Android platforms when available.slice::IterMut<'_, T> now implements AsRef<[T]>IntoIterator.
Currently calling .into_iter() as a method on an array will
return impl Iterator<Item=&T>, but this may change in a
future edition to change Item to T. Calling IntoIterator::into_iter
directly on arrays will provide impl Iterator<Item=T> as expected.leading_zeros, and trailing_zeros are now available on all
NonZero integer types.{f32, f64}::from_str now parse and print special values
(NaN, -0) according to IEEE 754.(Bound<usize>, Bound<usize>).BITS associated constant to all numeric types.AtomicBool::fetch_updateAtomicPtr::fetch_updateBTreeMap::retainBTreeSet::retainBufReader::seek_relativeDebugStruct::non_exhaustiveDuration::MAXDuration::ZERODuration::is_zeroDuration::saturating_addDuration::saturating_mulDuration::saturating_subErrorKind::UnsupportedOption::insertOrdering::is_eqOrdering::is_geOrdering::is_gtOrdering::is_leOrdering::is_ltOrdering::is_neOsStr::is_asciiOsStr::make_ascii_lowercaseOsStr::make_ascii_uppercaseOsStr::to_ascii_lowercaseOsStr::to_ascii_uppercasePeekable::peek_mutRc::decrement_strong_countRc::increment_strong_countVec::extend_from_withinarray::from_mutarray::from_refcmp::max_by_keycmp::max_bycmp::min_by_keycmp::min_byf32::is_subnormalf64::is_subnormalHEAD branch is not
“master”. This also includes a switch to the version 3 Cargo.lock format
which can handle default branches correctly.unpacked split-debuginfo.authors field is no longer included in Cargo.toml for new
projects.Ipv4::from_str will now reject octal format IP addresses in addition
to rejecting hexadecimal IP addresses. The octal format can lead
to confusion and potential security vulnerabilities and is no
longer recommended.BITS constant may conflict with external definitions.
In particular, this was known to be a problem in the lexical-core crate,
but they have published fixes for semantic versions 0.4 through 0.7. To
update this dependency alone, use cargo update -p lexical-core.RUSTC_FORCE_INCREMENTAL=1 environment variable added in 1.52.1.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
std::sys::windows::alloc implementation.get_blanket_implsThis release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to the widespread, and frequently occurring, breakage encountered by Rust users due to newly enabled incremental verification in 1.52.0. Notably, Rust users should upgrade to 1.52.0 or 1.52.1: the bugs that are detected by newly added incremental verification are still present in past stable versions, and are not yet fixed on any channel. These bugs can lead to miscompilation of Rust binaries.
These problems only affect incremental builds, so release builds with Cargo should not be affected unless the user has explicitly opted into incremental. Debug and check builds are affected.
See 84970 for more details.
unsafe_op_in_unsafe_fn lint, which checks whether the unsafe code
in an unsafe fn is wrapped in a unsafe block. This lint
is allowed by default, and may become a warning or hard error in a
future edition.Added tier 3* support for the following targets.
s390x-unknown-linux-muslriscv32gc-unknown-linux-musl & riscv64gc-unknown-linux-muslpowerpc-unknown-openbsd* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
OsString now implements Extend and FromIterator.cmp::Reverse now has #[repr(transparent)] representation.Arc<impl Error> now implements error::Error.const.Arguments::as_strchar::MAXchar::REPLACEMENT_CHARACTERchar::UNICODE_VERSIONchar::decode_utf16char::from_digitchar::from_u32_uncheckedchar::from_u32slice::partition_pointstr::rsplit_oncestr::split_onceThe following previously stable APIs are now const.
char::len_utf8char::len_utf16char::to_ascii_uppercasechar::to_ascii_lowercasechar::eq_ignore_ascii_caseu8::to_ascii_uppercaseu8::to_ascii_lowercaseu8::eq_ignore_ascii_caserustdoc:: (e.g. #[warn(rustdoc::broken_intra_doc_links)]).
Using the old style is still allowed, and will become a warning in
a future release.- [x] Complete
- [ ] Todocargo test -- foo bar will run all tests that match foo and bar.std library on Windows,
allowing you to see std symbols when debugging.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
RUSTC_BOOTSTRAP.x86_64-rumprun-netbsd target.x86_64-sun-solaris target in favor of x86_64-pc-solaris.,, , and \t as delimiters for specifying
languages in code blocks.pub_use_of_private_extern_crateproc-macro-hack versions. A cargo update should be sufficient to fix this in all cases.#[derive] into a regular macro attributestructs by constant
values in addition to by types and lifetimes. Also known as “const generics”
E.g. you can now write the following. Note: Only values of primitive integers,
bool, or char types are currently permitted.
-Csplit-debuginfo codegen option for macOS platforms.
This option controls whether debug information is split across multiple files
or packed into a single file. Note This option is unstable on other platforms.aarch64_be-unknown-linux-gnu,
aarch64-unknown-linux-gnu_ilp32, and aarch64_be-unknown-linux-gnu_ilp32 targets.i386-unknown-linux-gnu and i486-unknown-linux-gnu targets.target-cpu=native option will now detect individual features of CPUs.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Box::downcast is now also implemented for any dyn Any + Send + Sync object.str now implements AsMut<str>.u64 and u128 now implement From<char>.Error is now implemented for &T where T implements Error.Poll::{map_ok, map_err} are now implemented for Poll<Option<Result<T, E>>>.unsigned_abs is now implemented for all signed integer types.io::Empty now implements io::Seek.rc::Weak<T> and sync::Weak<T>’s methods such as as_ptr are now implemented for
T: ?Sized types.Div and Rem by their NonZero variant is now implemented for all unsigned integers.Arc::decrement_strong_countArc::increment_strong_countOnce::call_once_forcePeekable::next_if_eqPeekable::next_ifSeek::stream_positionarray::IntoIterpanic::panic_anyptr::addr_of!ptr::addr_of_mut!slice::fill_withslice::split_inclusive_mutslice::split_inclusiveslice::strip_prefixslice::strip_suffixstr::split_inclusivesync::OnceStatetask::WakeVecDeque::rangeVecDeque::range_mutsplit-debuginfo profile option to control the -Csplit-debuginfo
codegen option.resolver field to Cargo.toml to enable the new feature resolver
and CLI option behavior. Version 2 of the feature resolver will try
to avoid unifying features of dependencies where that unification could be unwanted.
Such as using the same dependency with a std feature in a build scripts and
proc-macros, while using the no-std feature in the final binary. See the
Cargo book documentation for more information on the feature.Deref traits.--default-theme flag which sets the default theme to use for
documentation.Various improvements to intra-doc links:
slice.Vec<T>.wasm-bindgen ABI, and instead use the wasm32 ABI.rustc no longer promotes division, modulo and indexing operations to const that
could fail.armv5te-unknown-linux-gnueabisparc64-unknown-linux-gnuthumbv7neon-unknown-linux-gnueabihfarmv7-unknown-linux-gnueabix86_64-unknown-linux-gnux32atomic::spin_loop_hint has been deprecated. It’s recommended to use hint::spin_loop instead.const values for x in [x; N] array expressions.
This has been technically possible since 1.38.0, as it was unintentionally stabilized.ManuallyDrop<T> union fields are now considered safe.armv5te-unknown-linux-uclibceabi target.aarch64-apple-ios-macabi target.x86_64-unknown-freebsd is now built with the full toolset.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
proc_macro::Punct now implements PartialEq<char>.ops::{Index, IndexMut} are now implemented for fixed sized arrays of any length.std::fs::File type now has a “niche” of -1.
This value cannot be a valid file descriptor, and now means Option<File> takes
up the same amount of space as File.bool::thenbtree_map::Entry::or_insert_with_keyf32::clampf64::clamphash_map::Entry::or_insert_with_keyOrd::clampRefCell::takeslice::fillUnsafeCell::get_mutThe following previously stable methods are now const.
IpAddr::is_ipv4IpAddr::is_ipv6IpAddr::is_unspecifiedIpAddr::is_loopbackIpAddr::is_multicastIpv4Addr::octetsIpv4Addr::is_loopbackIpv4Addr::is_privateIpv4Addr::is_link_localIpv4Addr::is_multicastIpv4Addr::is_broadcastIpv4Addr::is_documentationIpv4Addr::to_ipv6_compatibleIpv4Addr::to_ipv6_mappedIpv6Addr::segmentsIpv6Addr::is_unspecifiedIpv6Addr::is_loopbackIpv6Addr::is_multicastIpv6Addr::to_ipv4Layout::sizeLayout::alignLayout::from_size_alignpow for all integer types.checked_pow for all integer types.saturating_pow for all integer types.wrapping_pow for all integer types.next_power_of_two for all unsigned integer types.checked_next_power_of_two for all unsigned integer types.[build.rustc-workspace-wrapper] option.
This option sets a wrapper to execute instead of rustc, for workspace members only.cargo:rerun-if-changed will now, if provided a directory, scan the entire
contents of that directory for changes.--workspace flag to the cargo update command.compare_and_swap method on atomics has been deprecated. It’s
recommended to use the compare_exchange and compare_exchange_weak methods instead.TokenStreams are checked have fixed some cases where you could write
unhygenic macro_rules! macros.#![test] as an inner attribute is now considered unstable like other inner macro
attributes, and reports an error by default through the soft_unstable lint.forbid lint at the same level that it was set is now a hard error.panic! calls by supplying your own macro. It’s
recommended to use the #[panic_handler] attribute to provide your own implementation.struct Foo {};) now produce a warning.Drop, and you can now have a field in a union
with ManuallyDrop<T>.aarch64-unknown-linux-gnu.aarch64-apple-darwin.aarch64-pc-windows-msvc.mipsel-unknown-none.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
RangeInclusive now checks for exhaustion when calling contains and indexing.ToString::to_string now no longer shrinks the internal buffer in the default implementation.The following previously stable methods are now const.
cargo-package should now be independently reproducible.cargo-tree now marks proc-macro crates.CARGO_PRIMARY_PACKAGE build-time environment variable. This
variable will be set if the crate being built is one the user selected to build, either
with -p or through defaults.i686-unknown-freebsd from host tier 2 to target tier 2 support.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
initial-exec Thread
Local Storage model.system to the llvm-libunwind bootstrap config option.--color for configuring terminal color support to bootstrap.unsafe keyword is now syntactically permitted on modules. This
is still rejected semantically, but can now be parsed by procedural macros.-C link-self-contained=<yes|no> compiler flag. This tells
rustc whether to link its own C runtime and libraries or to rely on a external
linker to find them. (Supported only on windows-gnu, linux-musl, and wasi platforms.)-C target-feature=+crt-static on linux-gnu targets.
Note: If you’re using cargo you must explicitly pass the --target flag.aarch64-unknown-linux-musl.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
io::Write is now implemented for &ChildStdin &Sink, &Stdout,
and &Stderr.TryFrom<Vec<T>>.matches! macro now supports having a trailing comma.Vec<A> now implements PartialEq<[B]> where A: PartialEq<B>.RefCell::{replace, replace_with, clone} methods now all use #[track_caller].The following previously stable methods are now const fn’s:
Option::is_someOption::is_noneOption::as_refResult::is_okResult::is_errResult::as_refOrdering::reverseOrdering::thenrustdoc using the intra-doc link
syntax. E.g. /// Uses [`std::future`] will automatically generate
a link to std::future’s documentation. See “Linking to items by
name” for more information.#[doc(alias = "<alias>")] on items to add search aliases
when searching through rustdoc’s UI.'static lifetime inside const fn now follows the
same rules as inside a fn body. In particular, &foo() will not be
promoted to 'static lifetime any more inside const fns.&mut references to non zero-sized types are no longer promoted.rustc will now warn if you use attributes like #[link_name] or #[cold]
in places where they have no effect._mm256_extract_epi8 and _mm256_extract_epi16 signatures in
arch::{x86, x86_64} to return i32 to match the vendor signatures.mem::uninitialized will now panic if any inner types inside a struct or enum
disallow zero-initialization.#[target_feature] will now error if used in a place where it has no effect.catch_unwind and will cause an abort.
Note: This behaviour is not guaranteed and is still considered undefined behaviour,
see the catch_unwind documentation for further information.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
rustc from source now uses ninja by default over make.
You can continue building with make by setting ninja=false in
your bootstrap.toml.fewer_names in uncached_llvm_typeensure_sufficient_stack() non-generic-C control-flow-guard codegen option, which enables
Control Flow Guard for Windows platforms, and is ignored on other
platforms.thumbv4t-none-eabi target.RUST_BACKTRACE’s output is now more compact.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
CStr now implements Index<RangeFrom<usize>>.std/core are now implemented for arrays of any length, not just
those of length less than 33.ops::RangeFull and ops::Range now implement Default.panic::Location now implements Copy, Clone, Eq, Hash, Ord,
PartialEq, and PartialOrd.Ident::new_rawRange::is_emptyRangeInclusive::is_emptyResult::as_derefResult::as_deref_mutVec::leakpointer::offset_fromf32::TAUf64::TAUThe following previously stable APIs have now been made const.
new method for all NonZero integers.checked_add,checked_sub,checked_mul,checked_neg, checked_shl,
checked_shr, saturating_add, saturating_sub, and saturating_mul
methods for all integers.checked_abs, saturating_abs, saturating_neg, and signum for all
signed integers.is_ascii_alphabetic, is_ascii_uppercase, is_ascii_lowercase,
is_ascii_alphanumeric, is_ascii_digit, is_ascii_hexdigit,
is_ascii_punctuation, is_ascii_graphic, is_ascii_whitespace, and
is_ascii_control methods for char and u8.build-dependencies are now built with opt-level 0 by default.
You can override this by setting the following in your Cargo.toml.[profile.release.build-override]
opt-level = 3cargo-help will now display man pages for commands rather just the
--help text.cargo-metadata now emits a test field indicating if a target has
tests enabled.workspace.default-members now respects workspace.exclude.cargo-publish will now use an alternative registry by default if it’s the
only registry specified in package.publish.{} && false in tail expressions.macro_rules! that should
help to preserve more span information. These changes may cause
compilation errors if your macro was unhygenic or didn’t correctly handle
Delimiter::None.linux-gnu targets now require minimum kernel 2.6.32 and glibc 2.11.rustc-docs component. This allows you to install
and read the documentation for the compiler internal APIs. (Currently only
available for x86_64-unknown-linux-gnu.)x.py. You can read details about this change in the “Changes to x.py defaults” post on the Inside Rust blog.if, match, and loop expressions can now be used in const functions.&[T]) in
const functions.#[track_caller] attribute can now be added to functions to use the
function’s caller’s location information for panic messages.x.0.0 over (x.0).0.mem::transmute can now be used in statics and constants. Note
You currently can’t use mem::transmute in constant functions.cdylib target on Apple iOS and tvOS platforms.x86_64-unknown-linux-musl.mem::forget is now a const fn.String now implements From<char>.leading_ones, and trailing_ones methods have been stabilised for all
integer types.vec::IntoIter<T> now implements AsRef<[T]>.NonZeroU8) now implement TryFrom for their
zero-able equivalent (e.g. TryFrom<u8>).&[T] and &mut [T] now implement PartialEq<Vec<T>>.(String, u16) now implements ToSocketAddrs.vec::Drain<'_, T> now implements AsRef<[T]>.Added a number of new environment variables that are now available when compiling your crate.
CARGO_BIN_NAME and CARGO_CRATE_NAME Providing the name of
the specific binary being compiled and the name of the crate.CARGO_PKG_LICENSE The license from the manifest of the package.CARGO_PKG_LICENSE_FILE The path to the license file.abi_blacklist has been renamed
to unsupported_abis. The old name will still continue to work.Drop.
This was previously accepted but will become a hard error in a future release.#[repr(i128)] or #[repr(u128)]. This representation is currently only
allowed on enums.macro_rules! are now always captured. This helps
ensure that spans have the correct information, and may cause breakage if you
were relying on receiving spans with dummy information.{f32, f64}::asinh now returns the correct values for negative numbers.rustc would erroneously allow
you to pass a shorter lifetime than expected.libz (also called zlib) on Linux.
The library will need to be installed for rustc to work, even though we
expect it to be already available on most systems.#[should_panic] are broken on ARMv7 while running
under QEMU.as has been defined as a saturating
conversion. This was previously undefined behaviour, but you can use the
{f64, f32}::to_int_unchecked methods to continue using the current behaviour, which
may be desirable in rare performance sensitive situations.mem::Discriminant<T> now uses T’s discriminant type instead of always
using u64.macro_rules!) macro.target-feature
flag. E.g. -C target-feature=+avx2 -C target-feature=+fma is now
equivalent to -C target-feature=+avx2,+fma.force-unwind-tables flag. This option allows
rustc to always generate unwind tables regardless of panic strategy.embed-bitcode flag. This codegen flag allows rustc
to include LLVM bitcode into generated rlibs (this is on by default).tiny value to the code-model codegen flag.mipsel-sony-psp target.thumbv7a-uwp-windows-msvc target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
net::{SocketAddr, SocketAddrV4, SocketAddrV6} now implements PartialOrd
and Ord.proc_macro::TokenStream now implements Default.char with
ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo} to iterate over
a range of codepoints. E.g.
you can now write the following;
OsString now implements FromStr.saturating_neg method has been added to all signed integer primitive
types, and the saturating_abs method has been added for all integer
primitive types.Arc<T>, Rc<T> now implement From<Cow<'_, T>>, and Box now
implements From<Cow> when T is [T: Copy], str, CStr, OsStr,
or Path.Box<[T]> now implements From<[T; N]>.BitOr and BitOrAssign are implemented for all NonZero
integer types.fetch_min, and fetch_max methods have been added to all atomic
integer types.fetch_update method has been added to all atomic integer types.Arc::as_ptrBTreeMap::remove_entryRc::as_ptrrc::Weak::as_ptrrc::Weak::from_rawrc::Weak::into_rawstr::strip_prefixstr::strip_suffixsync::Weak::as_ptrsync::Weak::from_rawsync::Weak::into_rawchar::UNICODE_VERSIONSpan::resolved_atSpan::located_atSpan::mixed_siteunix::process::CommandExt::arg0~~outdated information~~ becomes “{f32, f64}::powi now returns a slightly different value on Windows.
This is due to changes in LLVM’s intrinsics which {f32, f64}::powi uses.lto flag is incompatible with the new embed-bitcode=no.
This may cause issues if LTO is enabled through RUSTFLAGS or cargo rustc
flags while cargo is adding embed-bitcode itself. The recommended way to
control LTO is with Cargo profiles, either in Cargo.toml or .cargo/config,
or by setting CARGO_PROFILE_<name>_LTO in the environment.Syntax-only changes
These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
-C codegen-units flag in incremental mode.
Additionally when in incremental mode rustc defaults to 256 codegen units.catch_unwind to have zero-cost, unless unwinding is enabled and
a panic is thrown.aarch64-unknown-none and
aarch64-unknown-none-softfloat targets.arm64-apple-tvos and
x86_64-apple-tvos targets.vec![] to map directly to Vec::new(). This allows
vec![] to be able to be used in const contexts.convert::Infallible now implements Hash.OsString now implements DerefMut and IndexMut returning
a &mut OsStr.String now implements From<&mut str>.IoSlice now implements Copy.Vec<T> now implements From<[T; N]>. Where N is at most 32.proc_macro::LexError now implements fmt::Display and Error.from_le_bytes, to_le_bytes, from_be_bytes, to_be_bytes,
from_ne_bytes, and to_ne_bytes methods are now const for all
integer types.PathBuf::with_capacityPathBuf::capacityPathBuf::clearPathBuf::reservePathBuf::reserve_exactPathBuf::shrink_to_fitf32::to_int_uncheckedf64::to_int_uncheckedLayout::align_toLayout::pad_to_alignLayout::arrayLayout::extendcargo tree command which will print a tree graph of
your dependencies. E.g.
mdbook v0.3.2 (/Users/src/rust/mdbook)
├── ammonia v3.0.0
│ ├── html5ever v0.24.0
│ │ ├── log v0.4.8
│ │ │ └── cfg-if v0.1.9
│ │ ├── mac v0.1.1
│ │ └── markup5ever v0.9.0
│ │ ├── log v0.4.8 (*)
│ │ ├── phf v0.7.24
│ │ │ └── phf_shared v0.7.24
│ │ │ ├── siphasher v0.2.3
│ │ │ └── unicase v1.4.2
│ │ │ [build-dependencies]
│ │ │ └── version_check v0.1.5
...cargo tree -d (short for cargo tree --duplicates)..a extension, rather than the previous .lib.-C no_integrated_as flag from rustc.file_name property in JSON output of macro errors now points the actual
source file rather than the previous format of <NAME macros>.
Note: this may not point to a file that actually exists on the user’s system.mem::{zeroed, uninitialised} will now panic when used with types that do
not allow zero initialization such as NonZeroU8. This was
previously a warning.f64 to u32 using the as
operator has been defined as a saturating operation. This was previously
undefined behaviour, but you can use the {f64, f32}::to_int_unchecked methods to
continue using the current behaviour, which may be desirable in rare performance
sensitive situations.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
cargo package --list not working with unpublished dependencies.&{number} (e.g. &1.0) not having
the type inferred correctly.#[cfg()] can now be used on if expressions.Syntax only changes
type Foo: Ord syntactically.self in all fn contexts.fn syntax + cleanup item parsing.item macro fragments can be interpolated into traits, impls, and extern blocks.
For example, you may now write:
These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
rustc -D unused -A unused-variables denies
everything in the unused lint group except unused-variables which
is explicitly allowed. However, passing rustc -A unused-variables -D unused denies
everything in the unused lint group including unused-variables since
the allow flag is specified before the deny flag (and therefore overridden).windows-gnu.Arc<[T; N]>, Box<[T; N]>, and Rc<[T; N]>, now implement
TryFrom<Arc<[T]>>,TryFrom<Box<[T]>>, and TryFrom<Rc<[T]>>
respectively. Note These conversions are only available when N
is 0..=32.u32::MAX or
f32::NAN with no imports.u8::is_ascii is now const.String now implements AsMut<str>.primitive module to std and core. This module
reexports Rust’s primitive types. This is mainly useful in macros
where you want avoid these types being shadowed.HashMap and HashSet.string::FromUtf8Error now implements Clone + Eq.[profile]s in your .cargo/config, or through
your environment.CARGO_BIN_EXE_<name> pointing to a binary’s
executable path when running integration tests or benchmarks.
<name> is the name of your binary as-is e.g. If you wanted the executable
path for a binary named my-programyou would use env!("CARGO_BIN_EXE_my-program").const_err lint were deemed unrelated to const
evaluation, and have been moved to the unconditional_panic and
arithmetic_overflow lints.assert! macro is now a hard error. This
has been a warning since 1.36.0.Self not having the correctly inferred type. This incorrectly
led to some instances being accepted, and now correctly emits a hard error.These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.
opt-level=3 instead of 2.#[inline]-ing certain hot functions.Drop terminators for enum variants without drop glueYou can now use the slice pattern syntax with subslices. e.g.
You can now use #[repr(transparent)] on univariant enums. Meaning
that you can create an enum that has the exact layout and ABI of the type
it contains.
You can now use outer attribute procedural macros on inline modules.
There are some syntax-only changes:
default is syntactically allowed before items in trait definitions.impls (i.e. consts, types, and fns) may syntactically
leave out their bodies in favor of ;.impls are now syntactically allowed
(e.g. type Foo: Ord;).... (the C-variadic type) may occur syntactically directly as the type of
any function parameter.These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by procedural macros and conditional compilation.
armv7a-none-eabi.riscv64gc-unknown-linux-gnu.Option::{expect,unwrap} and
Result::{expect, expect_err, unwrap, unwrap_err} now produce panic messages
pointing to the location where they were called, rather than
core’s internals. * Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
iter::Empty<T> now implements Send and Sync for any T.Pin::{map_unchecked, map_unchecked_mut} no longer require the return type
to implement Sized.io::Cursor now derives PartialEq and Eq.Layout::new is now const.riscv64gc-unknown-linux-gnu.CondVar::wait_whileCondVar::wait_timeout_whileDebugMap::keyDebugMap::valueManuallyDrop::takematches!ptr::slice_from_raw_parts_mutptr::slice_from_raw_partsError::description has been deprecated, and its use will now produce a
warning. It’s recommended to use Display/to_string instead.Copy implsLayout::repeatimpl<T> From<Foo> for Vec<T> {}.self position. E.g. you can
now write fn foo(self: Box<Box<Self>>) {}. Previously only Self, &Self,
&mut Self, Arc<Self>, Rc<Self>, and Box<Self> were allowed.format_args macro.
Previously identifiers starting with an underscore were not allowed.pub) are now syntactically allowed on trait items and
enum variants. These are still rejected semantically, but
can be seen and parsed by procedural macros and conditional compilation.extern "C" function with Box<T> and use T* as the corresponding
type on the C side. Please see the documentation for more information,
including the important caveat about preferring to avoid Box<T> in Rust signatures for functions defined in C.'labels.i686-unknown-dragonfly target.riscv64gc-unknown-linux-gnu target.@path syntax
to rustc. Note that the format differs somewhat from what is
found in other tooling; please see the documentation for
more information.--extern flag without a path, indicating that it is
available from the search path or specified with an -L flag.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
core::panic module is now stable. It was already stable
through std.NonZero* numerics now implement From<NonZero*> if it’s a smaller integer
width. E.g. NonZeroU16 now implements From<NonZeroU8>.MaybeUninit<T> now implements fmt::Debug.Result::map_orResult::map_or_elsestd::rc::Weak::weak_countstd::rc::Weak::strong_countstd::sync::Weak::weak_countstd::sync::Weak::strong_countcargo-install will now reinstall the package if it detects that it is out
of date.[profile.dev.package.image] opt-level = 2 sets the image crate’s
optimisation level to 2 for debug builds. You can also use
[profile.<profile>.build-override] to override build scripts and
their dependencies.edition in documentation code blocks to compile the block
for that edition. E.g. edition2018 tells rustdoc that the code sample
should be compiled the 2018 edition of Rust.--theme, and check the
current theme with --check-theme.#[cfg(doc)] to compile an item when building documentation.You can now use tuple structs and tuple enum variant’s constructors in
const contexts. e.g.
You can now mark structs, enums, and enum variants with the #[non_exhaustive] attribute to
indicate that there may be variants or fields added in the future.
For example this requires adding a wild-card branch (_ => {}) to any match
statements on a non-exhaustive enum. (RFC 2008)
You can now use function-like procedural macros in extern blocks and in
type positions. e.g. type Generated = macro!();
The meta pattern matcher in macro_rules! now correctly matches the modern
attribute syntax. For example (#[$m:meta]) now matches #[attr],
#[attr{tokens}], #[attr[tokens]], and #[attr(tokens)].
thumbv7neon-unknown-linux-musleabihf target.aarch64-unknown-none-softfloat target.mips64-unknown-linux-muslabi64, and
mips64el-unknown-linux-muslabi64 targets.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
BTreeMap::get_key_valueHashMap::get_key_valueOption::as_deref_mutOption::as_derefOption::flattenUdpSocket::peer_addrf32::to_be_bytesf32::to_le_bytesf32::to_ne_bytesf64::to_be_bytesf64::to_le_bytesf64::to_ne_bytesf32::from_be_bytesf32::from_le_bytesf32::from_ne_bytesf64::from_be_bytesf64::from_le_bytesf64::from_ne_bytesmem::takeslice::repeattodo!--all-features) passed to a virtual workspace will
now produce an error. Previously these flags were ignored.dev-dependencies without including
a version.include! macro will now warn if it failed to include the
entire file. The include! macro unintentionally only includes the
first expression in a file, and this can be unintuitive. This will become
either a hard error in a future release, or the behavior may be fixed to include all expressions as expected.#[inline] on function prototypes and consts now emits a warning under
unused_attribute lint. Using #[inline] anywhere else inside traits
or extern blocks now correctly emits a hard error.async functions and blocks with async fn, async move {}, and
async {} respectively, and you can now call .await on async expressions.cfg, cfg_attr, allow, warn,
deny, forbid as well as inert helper attributes used by procedural macro
attributes applied to items. e.g.
if guards
of match arms. e.g.
fn main() {
let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);
match array {
nums
// ---- `nums` is bound by move.
if nums.iter().sum::<u8>() == 10
// ^------ `.iter()` implicitly takes a reference to `nums`.
=> {
drop(nums);
// ----------- Legal as `nums` was bound by move and so we have ownership.
}
_ => unreachable!(),
}
}i686-unknown-uefi target.sparc64-unknown-openbsd target.--show-output argument to test binaries to print the
output of successful tests.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Vec::new and String::new are now const functions.LinkedList::new is now a const function.str::len, [T]::len and str::as_bytes are now const functions.abs, wrapping_abs, and overflowing_abs numeric functions are
now const.version.--all flag has been renamed to --workspace. Using
--all is now deprecated.rustdoc now requires rustc to be installed and in the same directory to
run tests. This should improve performance when running a large
amount of doctests.try! macro will now issue a deprecation warning. It is
recommended to use the ? operator instead.asinh(-0.0) now correctly returns -0.0. Previously this
returned 0.0.#[global_allocator] attribute can now be used in submodules.#[deprecated] attribute can now be used on macros.rustc. This will
improve compilation times in some cases. For further information please refer
to the “Evaluating pipelined rustc compilation” thread.aarch64-uwp-windows-msvc, i686-uwp-windows-gnu,
i686-uwp-windows-msvc, x86_64-uwp-windows-gnu, and
x86_64-uwp-windows-msvc targets.armv7-unknown-linux-gnueabi and
armv7-unknown-linux-musleabi targets.hexagon-unknown-linux-musl target.riscv32i-unknown-none-elf target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
ascii::EscapeDefault now implements Clone and Display.Clone, Debug, Hash) are now
available at the same path as the trait. (e.g. The Clone derive macro
is available at std::clone::Clone). This also makes all built-in macros
available in std/core root. e.g. std::include_bytes!.str::Chars now implements Debug.slice::{concat, connect, join} now accepts &[T] in addition to &T.*const T and *mut T now implement marker::Unpin.Arc<[T]> and Rc<[T]> now implement FromIterator<T>.div_euclid,
rem_euclid) to all numeric primitives. Additionally checked,
overflowing, and wrapping versions are available for all
integer primitives.thread::AccessError now implements Clone, Copy, Eq, Error, and
PartialEq.iter::{StepBy, Peekable, Take} now implement DoubleEndedIterator.<*const T>::cast<*mut T>::castDuration::as_secs_f32Duration::as_secs_f64Duration::div_f32Duration::div_f64Duration::from_secs_f32Duration::from_secs_f64Duration::mul_f32Duration::mul_f64any::type_namecargo.--features option multiple times to enable
multiple features.x86_64-unknown-uefi platform can not be built with rustc
1.38.0.armv7-unknown-linux-gnueabihf platform is known to have
issues with certain crates such as libc.#[must_use] will now warn if the type is contained in a tuple,
Box, or an array and unused.cfg and cfg_attr attributes on
generic parameters._ as an identifier for consts. e.g. You can write
const _: u32 = 5;.#[repr(align(X)] on enums.? Kleene macro operator is now available in the
2015 edition.-C profile-generate
and -C profile-use flags. For more information on how to use profile
guided optimization, please refer to the rustc book.rust-lldb wrapper script should now work again.BufReader::bufferBufWriter::bufferCell::from_mutCell<[T]>::as_slice_of_cellsDoubleEndedIterator::nth_backOption::xorWrapping::reverse_bitsi128::reverse_bitsi16::reverse_bitsi32::reverse_bitsi64::reverse_bitsi8::reverse_bitsisize::reverse_bitsslice::copy_withinu128::reverse_bitsu16::reverse_bitsu32::reverse_bitsu64::reverse_bitsu8::reverse_bitsusize::reverse_bitsCargo.lock files are now included by default when publishing executable crates
with executables.default-run="foo" in [package] to specify the
default executable to use for cargo run.... for inclusive range patterns will now warn by default.
Please transition your code to using the ..= syntax for inclusive
ranges instead.dyn will now warn by default.
Please transition your code to use dyn Trait for trait objects instead.dyn Send + fmt::Debug is now equivalent to
dyn fmt::Debug + Send, where this was previously not the case.HashMap’s implementation has been replaced with hashbrown::HashMap implementation.TryFromSliceError now implements From<Infallible>.mem::needs_drop is now available as a const fn.alloc::Layout::from_size_align_unchecked is now available as a const fn.String now implements BorrowMut<str>.io::Cursor now implements Default.NonNull::{dangling, cast} are now const fns.alloc crate is now stable. alloc allows you to use a subset
of std (e.g. Vec, Box, Arc) in #![no_std] environments if the
environment has access to heap memory allocation.String now implements From<&String>.dbg! macro. dbg! will
return a tuple of each argument when there is multiple arguments.Result::{is_err, is_ok} are now #[must_use] and will produce a warning if
not used.VecDeque::rotate_leftVecDeque::rotate_rightIterator::copiedio::IoSliceio::IoSliceMutRead::read_vectoredWrite::write_vectoredstr::as_mut_ptrmem::MaybeUninitpointer::align_offsetfuture::Futuretask::Contexttask::RawWakertask::RawWakerVTabletask::Wakertask::Poll--offline flag to run cargo without accessing the network.You can find further change’s in Cargo’s 1.36.0 release notes.
There have been numerous additions and fixes to clippy, see Clippy’s 1.36.0 release notes for more details.
mem::MaybeUninit, mem::uninitialized use is no
longer recommended, and will be deprecated in 1.39.0.FnOnce, FnMut, and the Fn traits are now implemented for Box<FnOnce>,
Box<FnMut>, and Box<Fn> respectively.armv6-unknown-freebsd-gnueabihf and
armv7-unknown-freebsd-gnueabihf targets.wasm32-unknown-wasi target.Thread will now show its ID in Debug output.StdinLock, StdoutLock, and StderrLock now implement AsRawFd.alloc::System now implements Default.Debug output ({:#?}) for structs now has a trailing comma on the
last field.char::{ToLowercase, ToUppercase} now
implement ExactSizeIterator.NonZero numeric types now implement FromStr.Read trait bounds
on the BufReader::{get_ref, get_mut, into_inner} methods.dbg! macro without any parameters to print the file
and line where it is called.str::make_ascii_lowercasehash_map::{OccupiedEntry, VacantEntry} now implement Sync
and Send.f32::copysignf64::copysignRefCell::replace_withRefCell::map_splitptr::hashRange::containsRangeFrom::containsRangeTo::containsRangeInclusive::containsRangeToInclusive::containsOption::copiedcargo:rustc-cdylib-link-arg at build time to pass custom
linker arguments when building a cdylib. Its usage is highly
platform specific.redundant_closure Clippy lintmissing_const_for_fn Clippy lint#[deprecated = "reason"] as a shorthand for
#[deprecated(note = "reason")]. This was previously allowed by mistake
but had no effect.#[attr()],#[attr[]], and
#[attr{}] procedural macros.extern crate self as foo; to import your
crate’s root into the extern prelude.riscv64imac-unknown-none-elf and
riscv64gc-unknown-none-elf.-C linker-plugin-lto. This allows rustc to compile your Rust code
into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI
boundaries.powerpc64-unknown-freebsd.HashMap<K, V, S>’s and
HashSet<T, S>’s basic methods. Most notably you no longer require
the Hash trait to create an iterator.Ord trait bounds have been removed on some of BinaryHeap<T>’s basic
methods. Most notably you no longer require the Ord trait to create
an iterator.overflowing_neg and wrapping_neg are now const functions
for all numeric types.str is now generic over all types that
implement SliceIndex<str>.str::trim, str::trim_matches, str::trim_{start, end}, and
str::trim_{start, end}_matches are now #[must_use] and will
produce a warning if their returning type is unused.checked_pow, saturating_pow, wrapping_pow, and
overflowing_pow are now available for all numeric types. These are
equivalent to methods such as wrapping_add for the pow operation.Any::type_idError::type_idatomic::AtomicI16atomic::AtomicI32atomic::AtomicI64atomic::AtomicI8atomic::AtomicU16atomic::AtomicU32atomic::AtomicU64atomic::AtomicU8convert::Infallibleconvert::TryFromconvert::TryIntoiter::from_fniter::successorsnum::NonZeroI128num::NonZeroI16num::NonZeroI32num::NonZeroI64num::NonZeroI8num::NonZeroIsizeslice::sort_by_cached_keystr::escape_debugstr::escape_defaultstr::escape_unicodestr::split_ascii_whitespaceCommand::before_exec is being replaced by the unsafe method
Command::pre_exec and will be deprecated with Rust 1.37.0.ATOMIC_{BOOL, ISIZE, USIZE}_INIT is now deprecated as you
can now use const functions in static variables.cfg(target_vendor) attribute. E.g.
#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }u8 that covers 0..=255 and
you would no longer be required to have a _ => unreachable!() case.if let and while let
expressions. You can do this with the same syntax as a match
expression. E.g.
if let and while let patterns. Using
this feature will by default produce a warning as this behaviour can be
unintuitive. E.g. if let _ = 5 {}let bindings, assignments, expression statements,
and irrefutable pattern destructuring in const functions.cfg_attr attribute.
E.g. #[cfg_attr(all(), must_use, optimize)]#[repr(packed)]
attribute. E.g. #[repr(packed(2))] struct Foo(i16, i32); is a struct
with an alignment of 2 bytes and a size of 6 bytes._. This allows you to
import a trait’s impls, and not have the name in the namespace. E.g.
Rc, Arc, and Pin as method receivers.rustc with the -Clinker-flavor
command line argument.x86_64-fortanix-unknown-sgx target support has been upgraded to
tier 2 support. Visit the platform support page for
information on Rust’s platform support.thumbv7neon-linux-androideabi and
thumbv7neon-unknown-linux-gnueabihf targets.x86_64-unknown-uefi target.overflowing_{add, sub, mul, shl, shr} are now const
functions for all numeric types.rotate_left, rotate_right, and wrapping_{add, sub, mul, shl, shr}
are now const functions for all numeric types.is_positive and is_negative are now const functions for
all signed numeric types.get method for all NonZero types is now const.count_ones, count_zeros, leading_zeros, trailing_zeros,
swap_bytes, from_be, from_le, to_be, to_le are now const for all
numeric types.Ipv4Addr::new is now a const functionunix::FileExt::read_exact_atunix::FileExt::write_all_atOption::transposeResult::transposeconvert::identitypin::Pinmarker::Unpinmarker::PhantomPinnedVec::resize_withVecDeque::resize_withDuration::as_millisDuration::as_microsDuration::as_nanoscargo publish --features or cargo publish --all-features.str::{trim_left, trim_right, trim_left_matches, trim_right_matches}
are now deprecated in the standard library, and their usage will now produce a warning.
Please use the str::{trim_start, trim_end, trim_start_matches, trim_end_matches}
methods instead.Error::cause method has been deprecated in favor of Error::source which supports
downcasting.--test-threads=1. It also runs the tests in deterministic order? operator in macro definitions. The ?
operator allows you to specify zero or one repetitions similar to the * and
+ operators.super, self, or crate, will
now always resolve to the item (enum, struct, etc.) available in the
module if present, before resolving to a external crate or an item the prelude.
E.g.
PhantomData<T> types.literal
specifier. This will match against a literal of any type.
E.g. 1, 'A', "Hello World"#[must_use]. This provides a warning if
a impl Trait or dyn Trait is returned and unused in the program.aarch64-pc-windows-msvc target.PathBuf now implements FromStr.Box<[T]> now implements FromIterator<T>.dbg! macro has been stabilized. This macro enables you to
easily debug expressions in your rust program. E.g.
The following APIs are now const functions and can be used in a
const context.
Cell::as_ptrUnsafeCell::getchar::is_asciiiter::emptyManuallyDrop::newManuallyDrop::into_innerRangeInclusive::startRangeInclusive::endNonNull::as_ptrslice::as_ptrstr::as_ptrDuration::as_secsDuration::subsec_millisDuration::subsec_microsDuration::subsec_nanosCStr::as_ptrIpv4Addr::is_unspecifiedIpv6Addr::newIpv6Addr::octetsi8::to_be_bytesi8::to_le_bytesi8::to_ne_bytesi8::from_be_bytesi8::from_le_bytesi8::from_ne_bytesi16::to_be_bytesi16::to_le_bytesi16::to_ne_bytesi16::from_be_bytesi16::from_le_bytesi16::from_ne_bytesi32::to_be_bytesi32::to_le_bytesi32::to_ne_bytesi32::from_be_bytesi32::from_le_bytesi32::from_ne_bytesi64::to_be_bytesi64::to_le_bytesi64::to_ne_bytesi64::from_be_bytesi64::from_le_bytesi64::from_ne_bytesi128::to_be_bytesi128::to_le_bytesi128::to_ne_bytesi128::from_be_bytesi128::from_le_bytesi128::from_ne_bytesisize::to_be_bytesisize::to_le_bytesisize::to_ne_bytesisize::from_be_bytesisize::from_le_bytesisize::from_ne_bytesu8::to_be_bytesu8::to_le_bytesu8::to_ne_bytesu8::from_be_bytesu8::from_le_bytesu8::from_ne_bytesu16::to_be_bytesu16::to_le_bytesu16::to_ne_bytesu16::from_be_bytesu16::from_le_bytesu16::from_ne_bytesu32::to_be_bytesu32::to_le_bytesu32::to_ne_bytesu32::from_be_bytesu32::from_le_bytesu32::from_ne_bytesu64::to_be_bytesu64::to_le_bytesu64::to_ne_bytesu64::from_be_bytesu64::from_le_bytesu64::from_ne_bytesu128::to_be_bytesu128::to_le_bytesu128::to_ne_bytesu128::from_be_bytesu128::from_le_bytesu128::from_ne_bytesusize::to_be_bytesusize::to_le_bytesusize::to_ne_bytesusize::from_be_bytesusize::from_le_bytesusize::from_ne_bytescargo c as an alias for cargo check._mm256_stream_si256, _mm256_stream_pd, _mm256_stream_ps have
been changed from *const to *mut as the previous implementation
was unsound.powerpc-unknown-netbsdimpl<'a> Reader for BufReader<'a> {} can now be
impl Reader for BufReader<'_> {}. Lifetimes are still required to be defined
in structs.const functions. These are currently
a strict minimal subset of the const fn RFC. Refer to the
language reference for what exactly is available.#[allow(clippy::filter_map)].#[no_mangle] and #[export_name] attributes can now be located anywhere in
a crate, not just in exported functions.num::NonZero* types to their raw equivalents using the
From trait. E.g. u8 now implements From<NonZeroU8>.&Option<T> into Option<&T> and &mut Option<T>
into Option<&mut T> using the From trait.*) a time::Duration by a u32.slice::align_toslice::align_to_mutslice::chunks_exactslice::chunks_exact_mutslice::rchunksslice::rchunks_mutslice::rchunks_exactslice::rchunks_exact_mutOption::replacepackage key in your dependencies.r#), e.g. let r#for = true;crate in paths. This allows you to refer to the
crate root in the path, e.g. use crate::foo; refers to foo in src/lib.rs.::.
Previously, using a external crate in a module without a use statement
required let json = ::serde_json::from_str(foo); but can now be written
as let json = serde_json::from_str(foo);.#[used] attribute to static items to prevent the
compiler from optimising them away, even if they appear to be unused,
e.g. #[used] static FOO: u32 = 1;use
syntax. Macros exported with #[macro_export] are now placed into
the root module of the crate. If your macro relies on calling other local
macros, it is recommended to export with the
#[macro_export(local_inner_macros)] attribute so users won’t have to import
those macros.pub, pub(crate)) in macros
using the vis specifier.#[attr("true")], and you can now
write #[attr(true)].#[panic_handler] attribute.riscv32imc-unknown-none-elf target.aarch64-unknown-netbsd targetThe following methods are replacement methods for trim_left, trim_right,
trim_left_matches, and trim_right_matches, which will be deprecated
in 1.33.0:
cargo run doesn’t require specifying a package in workspaces.cargo doc now supports --message-format=json. This is
equivalent to calling rustdoc --error-format=json.rustdoc allows you to specify what edition to treat your code as with the
--edition option.rustdoc now has the --color (specify whether to output color) and
--error-format (specify error format, e.g. json) options.rust-gdbgui script that invokes gdbgui with Rust
debug symbols.rustfmt or clippy are now
available, e.g. #[rustfmt::skip] will skip formatting the next item.rls-preview component on the windows-gnu targets has been restored.The standard library’s str::repeat function contained an out of bounds write
caused by an integer overflow. This has been fixed by deterministically
panicking when an overflow happens.
Thank you to Scott McMurray for responsibly disclosing this vulnerability to us.
powerpc64le-unknown-linux-musl target.aarch64-unknown-hermit and x86_64-unknown-hermit targets.Once::call_once no longer requires Once to be 'static.BuildHasherDefault now implements PartialEq and Eq.Box<CStr>, Box<OsStr>, and Box<Path> now implement Clone.PartialEq<&str> for OsString and PartialEq<OsString>
for &str.Cell<T> now allows T to be unsized.SocketAddr is now stable on Redox.--locked to disable this behavior.cargo-install will now allow you to cross compile an install
using --target.cargo-fix subcommand to automatically move project code from
2015 edition to 2018.cargo doc can now optionally document private types using the
--document-private-items flag.rustdoc now has the --cap-lints option which demotes all lints above
the specified level to that level. For example --cap-lints warn
will demote deny and forbid lints to warn.rustc and rustdoc will now have the exit code of 1 if compilation
fails and 101 if there is a panic.rustup component add clippy-preview.str::{slice_unchecked, slice_unchecked_mut} are now deprecated.
Use str::get_unchecked(begin..end) instead.std::env::home_dir is now deprecated for its unintuitive behavior.
Consider using the home_dir function from
https://crates.io/crates/dirs instead.rustc will no longer silently ignore invalid data in target spec.cfg attributes and --cfg command line flags are now more
strictly validated.#[repr(transparent)] attribute is now stable. This attribute
allows a Rust newtype wrapper (struct NewType<T>(T);) to be represented as
the inner type across Foreign Function Interface (FFI) boundaries.pure, sizeof, alignof, and offsetof have been unreserved
and can now be used as identifiers.GlobalAlloc trait and #[global_allocator] attribute are now
stable. This will allow users to specify a global allocator for
their program.#[test] attribute can now return
Result<(), E: Debug> in addition to ().lifetime specifier for macro_rules! is now stable. This
allows macros to easily target lifetimes.s and z optimisation levels are now stable. These optimisations
prioritise making smaller binary sizes. z is the same as s with the
exception that it does not vectorise loops, which typically results in an even
smaller binary.--error-format=short this option will provide a more compressed output of
rust error messages.macro_exports.Default for &mut str.From<bool> for all integer and unsigned number types.Extend for ().Debug implementation of time::Duration should now be more easily
human readable. Previously a Duration of one second would printed as
Duration { secs: 1, nanos: 0 } and will now be printed as 1s.From<&String> for Cow<str>, From<&Vec<T>> for Cow<[T]>,
From<Cow<CStr>> for CString, From<CString>, From<CStr>, From<&CString>
for Cow<CStr>, From<OsString>, From<OsStr>, From<&OsString> for
Cow<OsStr>, From<&PathBuf> for Cow<Path>, and From<Cow<Path>>
for PathBuf.Shl and Shr for Wrapping<u128>
and Wrapping<i128>.DirEntry::metadata now uses fstatat instead of lstat when
possible. This can provide up to a 40% speed increase.format!.Iterator::step_byPath::ancestorsSystemTime::UNIX_EPOCHalloc::GlobalAllocalloc::Layoutalloc::LayoutErralloc::Systemalloc::allocalloc::alloc_zeroedalloc::deallocalloc::reallocalloc::handle_alloc_errorbtree_map::Entry::or_defaultfmt::Alignmenthash_map::Entry::or_defaultiter::repeat_withnum::NonZeroUsizenum::NonZeroU128num::NonZeroU16num::NonZeroU32num::NonZeroU64num::NonZeroU8ops::RangeBoundsslice::SliceIndexslice::from_mutslice::from_ref{Any + Send + Sync}::downcast_mut{Any + Send + Sync}::downcast_ref{Any + Send + Sync}::issrc directory. The src directory in a crate should be
considered to be immutable.suggestion_applicability field in rustc’s json output is now
stable. This will allow dev tools to check whether a code suggestion
would apply to them.rustdoc would execute plugins in the /tmp/rustdoc/plugins directory when running, which enabled executing code as some other user on a given machine. This release fixes that vulnerability; you can read more about this on the blog. The associated CVE is CVE-2018-1000622.
Thank you to Red Hat for responsibly disclosing this vulnerability to us.
proc to
be used as an identifier.Trait syntax, and should make it clearer when being used in tandem with
impl Trait because it is equivalent to the following syntax:
&Trait == &dyn Trait, &mut Trait == &mut dyn Trait, and
Box<Trait> == Box<dyn Trait>.fn foo<#[lifetime_attr] 'a, #[type_attr] T: 'a>() {}#[must_use] attribute can now also be used on functions as well as
types. It provides a lint that by default warns users when the
value returned by a function has not been used.arch::x86 & arch::x86_64 modules which contain
SIMD intrinsics, a new macro called is_x86_feature_detected!, the
#[target_feature(enable="")] attribute, and adding target_feature = "" to
the cfg attribute.[u8], f32, and f64 previously only available in
std are now available in core.Rhs type parameter on ops::{Shl, ShlAssign, Shr} now defaults
to Self.std::str::replace now has the #[must_use] attribute to clarify
that the operation isn’t done in place.Clone::clone, Iterator::collect, and ToOwned::to_owned now have
the #[must_use] attribute to warn about unused potentially
expensive allocations.DoubleEndedIterator::rfindDoubleEndedIterator::rfoldDoubleEndedIterator::try_rfoldDuration::from_microsDuration::from_nanosDuration::subsec_microsDuration::subsec_millisHashMap::remove_entryIterator::try_foldIterator::try_for_eachNonNull::castOption::filterString::replace_rangeTake::set_limithint::unreachable_uncheckedos::unix::process::parent_idptr::swap_nonoverlappingslice::rsplit_mutslice::rsplitslice::swap_with_slicecargo-metadata now includes authors, categories, keywords,
readme, and repository fields.cargo-metadata now includes a package’s metadata table.--target-dir optional argument. This allows you to specify
a different directory than target for placing compilation artifacts.[[bin]], and have other binaries in locations
where cargo would infer a binary, Cargo will produce a warning. You can
disable this feature ahead of time by setting any of the following to false:
autobins, autobenches, autoexamples, autotests.CARGO_CACHE_RUSTC_INFO=0 in your environment.doc.rust-lang.org are now searchable.CharExt or StrExt method directly on core will no longer
work. e.g. ::core::prelude::v1::StrExt::is_empty("") will not
compile, "".is_empty() will still compile.Debug output on atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize}
will only print the inner type. E.g.
print!("{:?}", AtomicBool::new(true)) will print true,
not AtomicBool(true).repr(align(N)) is now 2²⁹. Previously you
could enter higher numbers but they were not supported by LLVM. Up to 512MB
alignment should cover all use cases..description() method on the std::error::Error trait
has been soft-deprecated. It is no longer required to implement it.fn main() -> impl Trait no longer works for non-Termination
trait.
This reverts an accidental stabilization.NaN > NaN no longer returns true in const-fn contexts.impl Trait in method arguments.Copy and/or Clone if all captured variables
implement either or both traits.for x in 0..=10 is now stable.'_ lifetime is now stable. The underscore lifetime can be used anywhere a
lifetime can be elided.impl Trait is now stable allowing you to have abstract types in returns
or in function parameters. E.g. fn foo() -> impl Iterator<Item=u8> or
fn open(path: impl AsRef<Path>).u128 and i128 are now stable.main can now return Result<(), E: Debug> in addition to ().let points = [1, 2, 3, 4];
match points {
[1, 2, 3, 4] => println!("All points were sequent