Empowering everyone to build reliable and efficient software.
repr(Int)
enums
#[repr(u8)]
enum Foo {
A(u8) = 0,
B(i8) = 1,
C(bool) = 42,
}
must_use
on impl Trait
for supertraits This makes impl ExactSizeIterator
respect the existing #[must_use]
annotation on Iterator
...=X
in patterns
clippy::for_loops_over_fallibles
lint into rustc
sym
operands in inline assembly
#[derive(Default)]
on a generic #[default]
enum adding unnecessary Default
bounds
proc_macro::Span::source_text
uX::{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_box
Duration::try_from_secs_{f32,f64}
Option::unzip
std::os::fd
cargo remove
to remove dependencies from Cargo.toml
cargo publish
now waits for the new version to be downloadable before exiting
See 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 Darwin
libstd
no longer pull in libiconv.dylib
on Darwin)
order_dependent_trait_objects
show up 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.
as
casts of enums with #[non_exhaustive]
variants
let else
let_underscore_drop
and let_underscore_lock
from Clippy
break
ing from arbitrary labeled blocks ("label-break-value")
MaybeUninit
is the correct way to work with uninitialized memory.Drop
impl on foreign ADTs
special_module_name
lint
-C instrument-coverage
New targets:
PartialEq::ne
in derive(PartialEq)
BCRYPT_RNG_ALG_HANDLE
by default
System
with direct system allocator calls
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
.std::backtrace::Backtrace
Bound::as_ref
std::io::read_to_string
<*const T>::cast_mut
<*mut T>::cast_const
These 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 UnsafeCell
unused_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 watchOS
write!
or writeln!
into an OsString
: Implement fmt::Write
for OsString
FusedIterator
for std::net::[Into]Incoming
impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>
ptr::copy
and ptr::swap
are doing untyped copies
available_parallelism
mem::uninitialized
future::IntoFuture
future::poll_fn
task::ready!
num::NonZero*::checked_mul
num::NonZero*::checked_pow
num::NonZero*::saturating_mul
num::NonZero*::saturating_pow
num::NonZeroI*::abs
num::NonZeroI*::checked_abs
num::NonZeroI*::overflowing_abs
num::NonZeroI*::saturating_abs
num::NonZeroI*::unsigned_abs
num::NonZeroI*::wrapping_abs
num::NonZeroU*::checked_add
num::NonZeroU*::checked_next_power_of_two
num::NonZeroU*::saturating_add
os::unix::process::CommandExt::process_group
os::windows::fs::FileTypeExt::is_symlink_dir
os::windows::fs::FileTypeExt::is_symlink_file
These types were previously stable in std::ffi
, but are now also available in core
and alloc
:
core::ffi::CStr
core::ffi::FromBytesWithNulError
alloc::ffi::CString
alloc::ffi::FromVecWithNulError
alloc::ffi::IntoStringError
alloc::ffi::NulError
These types were previously stable in std::os::raw
, but are now also available in core::ffi
and std::ffi
:
ffi::c_char
ffi::c_double
ffi::c_float
ffi::c_int
ffi::c_long
ffi::c_longlong
ffi::c_schar
ffi::c_short
ffi::c_uchar
ffi::c_uint
ffi::c_ulong
ffi::c_ulonglong
ffi::c_ushort
These 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 versions
transmute_copy
's U
is not larger than T
BTreeMap
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_fn
Box::into_pin
BinaryHeap::try_reserve
BinaryHeap::try_reserve_exact
OsString::try_reserve
OsString::try_reserve_exact
PathBuf::try_reserve
PathBuf::try_reserve_exact
Path::try_exists
Ref::filter_map
RefMut::filter_map
NonNull::<[T]>::len
ToOwned::clone_into
Ipv6Addr::to_ipv4_mapped
unix::io::AsFd
unix::io::BorrowedFd<'fd>
unix::io::OwnedFd
windows::io::AsHandle
windows::io::BorrowedHandle<'handle>
windows::io::OwnedHandle
windows::io::HandleOrInvalid
windows::io::HandleOrNull
windows::io::InvalidHandleError
windows::io::NullHandleError
windows::io::AsSocket
windows::io::BorrowedSocket<'handle>
windows::io::OwnedSocket
thread::scope
thread::Scope
thread::ScopedJoinHandle
These APIs are now usable in const contexts:
array::from_ref
slice::from_ref
intrinsics::copy
intrinsics::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_nonoverlapping
str::from_utf8
Utf8Error::error_len
Utf8Error::valid_up_to
Condvar::new
Mutex::new
RwLock::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]
variant
const
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 items
aarch64-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_some
f32::total_cmp
f64::total_cmp
Stdin::lines
windows::CommandExt::raw_arg
impl<T: Default> Default for AssertUnwindSafe<T>
From<Rc<str>> for Rc<[u8]>
From<Arc<str>> for Arc<[u8]>
FusedIterator for EncodeWide
cargo add
command for adding dependencies to Cargo.toml
from the command-line. docs
name@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. #10594
macro_rules!
macros, matching other private items
File
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 bounds
const fn
signatures can now use impl Trait
in argument and return position
const fn
impl Trait
return type
#[link]
attributes and on the command line, as well as the whole-archive
modifier specifically, are now supported
char
type is now described as UTF-32 in debuginfo
#[target_feature]
attribute can now be used with aarch64 features
#[target_feature = "adx"]
is now stable
ManuallyDrop<T>
is now documented to have the same layout as T
#[ignore = "…"]
messages are printed when running tests
std::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 inputs
std::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_mut
Pin::static_ref
Vec::retain_mut
VecDeque::retain_mut
Write
for Cursor<[u8; N]>
std::os::unix::net::SocketAddr::from_pathname
std::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_finished
These 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_range
No 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 256
cargo vendor
now only accepts one value for each --sync
flag
cfg
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-gnu
unreachable_pub
lints on nested and glob public reexport
-Z instrument-coverage
as -C instrument-coverage
-Z print-link-args
as --print link-args
mips64-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_key
Duration::try_from_secs_f32
/f64
accuracy by directly processing exponent and mantissa
Instant::{duration_since, elapsed, sub}
saturating
Instant::now
BuildHasherDefault
, iter::Empty
and future::Pending
covariant
Arc::new_cyclic
Rc::new_cyclic
slice::EscapeAscii
<[u8]>::escape_ascii
u8::escape_ascii
Vec::spare_capacity_mut
MaybeUninit::assume_init_drop
MaybeUninit::assume_init_read
i8::abs_diff
i16::abs_diff
i32::abs_diff
i64::abs_diff
i128::abs_diff
isize::abs_diff
u8::abs_diff
u16::abs_diff
u32::abs_diff
u64::abs_diff
u128::abs_diff
usize::abs_diff
Display for io::ErrorKind
From<u8> for ExitCode
Not for !
(the "never" type)
Assign<$t> for Wrapping<$t>
arch::is_aarch64_feature_detected!
toml-rs
to toml_edit
-Ztimings
as --timings
cargo: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-incompat
This 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_parallelism
Result::copied
Result::cloned
arch::asm!
arch::global_asm!
ops::ControlFlow::is_break
ops::ControlFlow::is_continue
TryFrom<char> for u8
char::TryFromCharError
implementing Clone
, Debug
, Display
, PartialEq
, Copy
, Eq
, Error
iter::zip
NonZeroU8::is_power_of_two
NonZeroU16::is_power_of_two
NonZeroU32::is_power_of_two
NonZeroU64::is_power_of_two
NonZeroU128::is_power_of_two
NonZeroUsize::is_power_of_two
DoubleEndedIterator for ToLowercase
DoubleEndedIterator for ToUppercase
TryFrom<&mut [T]> for [T; N]
UnwindSafe for Once
RefUnwindSafe for Once
Const-stable:
mem::MaybeUninit::as_ptr
mem::MaybeUninit::assume_init
mem::MaybeUninit::assume_init_ref
ffi::CStr::from_bytes_with_nul_unchecked
strip
profile option
--release
as -r
term.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.