Releases: rust-lang/rust
Rust 1.64.0
Language
- Unions with mutable references or tuples of allowed types are now allowed
- It is now considered valid to deallocate memory pointed to by a shared reference
&T
if every byte inT
is inside anUnsafeCell
- Unused tuple struct fields are now warned against in an allow-by-default lint,
unused_tuple_struct_fields
, similar to the existing warning for unused struct fields. This lint will become warn-by-default in the future.
Compiler
- Add Nintendo Switch as tier 3 target
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
- Only compile
#[used]
as llvm.compiler.used for ELF targets - Add the
--diagnostic-width
compiler flag to define the terminal width. - Add support for link-flavor
rust-lld
for iOS, tvOS and watchOS
Libraries
- Remove restrictions on compare-exchange memory ordering.
- You can now
write!
orwriteln!
into anOsString
: Implementfmt::Write
forOsString
- Make RwLockReadGuard covariant
- Implement
FusedIterator
forstd::net::[Into]Incoming
impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>
ptr::copy
andptr::swap
are doing untyped copies- Add cgroupv1 support to
available_parallelism
- Mitigate many incorrect uses of
mem::uninitialized
Stabilized APIs
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:
Cargo
- Packages can now inherit settings from the workspace so that the settings can be centralized in one place. See
workspace.package
andworkspace.dependencies
for more details on how to define these common settings. - Cargo commands can now accept multiple
--target
flags to build for multiple targets at once, and thebuild.target
config option may now take an array of multiple targets. - The
--jobs
argument can now take a negative number to count backwards from the max CPUs. cargo add
will now updateCargo.lock
.- Added the
--crate-type
flag tocargo rustc
to override the crate type. - Significantly improved the performance fetching git dependencies from GitHub when using a hash in the
rev
field.
Misc
Compatibility Notes
- The minimum required versions for all
-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 - Network primitives are now implemented with the ideal Rust layout, not the C system layout. This can cause problems when transmuting the types.
- Add assertion that
transmute_copy
'sU
is not larger thanT
- A soundness bug in
BTreeMap
was fixed that allowed data it was borrowing to be dropped before the container. - The Drop behavior of C-like enums cast to ints has changed. These are already discouraged by a compiler warning.
- Relate late-bound closure lifetimes to parent fn in NLL
- Errors at const-eval time are now in future incompatibility reports
- On the
thumbv6m-none-eabi
target, some incorrectasm!
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-positionimpl Trait
, without fulfilling all the trait bounds of that associated type, as long as the hidden type satisfies said bounds. This has been fixed.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Windows builds now use profile-guided optimization, providing 10-20% improvements to compiler performance: [Utilize PGO for windows x64 rustc dist builds](#96978...
Rust 1.63.0
Language
- Remove migrate borrowck mode for pre-NLL errors.
- Modify MIR building to drop repeat expressions with length zero.
- Remove label/lifetime shadowing warnings.
- Allow explicit generic arguments in the presence of
impl Trait
args. - Make
cenum_impl_drop_cast
warnings deny-by-default. - Prevent unwinding when
-C panic=abort
is used regardless of declared ABI. - lub: don't bail out due to empty binders.
Compiler
- Stabilize the
bundle
native library modifier, also removing the deprecatedstatic-nobundle
linking kind. - Add Apple WatchOS compile targets*.
- Add a Windows application manifest to rustc-main.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Implement
Copy
,Clone
,PartialEq
andEq
forcore::fmt::Alignment
. - Extend
ptr::null
andnull_mut
to all thin (including extern) types. impl Read and Write for VecDeque<u8>
.- STD support for the Nintendo 3DS.
- Use rounding in float to Duration conversion methods.
- Make write/print macros eagerly drop temporaries.
- Implement internal traits that enable
[OsStr]::join
. - Implement
Hash
forcore::alloc::Layout
. - Add capacity documentation for
OsString
. - Put a bound on collection misbehavior.
- Make
std::mem::needs_drop
accept?Sized
. impl Termination for Infallible
and then make theResult
impls ofTermination
more generic.- Document Rust's stance on
/proc/self/mem
.
Stabilized APIs
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
Cargo
- Stabilize the
--config path
command-line argument. - Expose rust-version in the environment as
CARGO_PKG_RUST_VERSION
.
Compatibility Notes
#[link]
attributes are now checked more strictly, which may introduce errors for invalid attribute arguments that were previously ignored.- Rounding is now used when converting a float to a
Duration
. The converted duration can differ slightly from what it was.
Internal Changes
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
Rust 1.62.1 addresses a few recent regressions in the compiler and standard library, and also mitigates a CPU vulnerability on Intel SGX.
- The compiler fixed unsound function coercions involving
impl Trait
return types. - The compiler fixed an incremental compilation bug with
async fn
lifetimes. - Windows added a fallback for overlapped I/O in synchronous reads and writes.
- The
x86_64-fortanix-unknown-sgx
target added a mitigation for the MMIO stale data vulnerability, advisory INTEL-SA-00615.
Rust 1.62.0
Language
- Stabilize
#[derive(Default)]
on enums with a#[default]
variant - Teach flow sensitive checks that visibly uninhabited call expressions never return
- Fix constants not getting dropped if part of a diverging expression
- Support unit struct/enum variant in destructuring assignment
- Remove mutable_borrow_reservation_conflict lint and allow the code pattern
const
functions may now specifyextern "C"
orextern "Rust"
Compiler
- linker: Stop using whole-archive on dependencies of dylibs
- Make
unaligned_references
lint deny-by-default This lint is also a future compatibility lint, and is expected to eventually become a hard error. - Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
- Reject
#[thread_local]
attribute on non-static items - Add tier 3
aarch64-pc-windows-gnullvm
andx86_64-pc-windows-gnullvm
targets* - Implement a lint to warn about unused macro rules
- Promote
x86_64-unknown-none
target to Tier 2*
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Windows: Use a pipe relay for chaining pipes
- Replace Linux Mutex and Condvar with futex based ones.
- Replace RwLock by a futex based one on Linux
- std: directly use pthread in UNIX parker implementation
Stabilized APIs
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
- RDM intrinsics on aarch64
Clippy
Cargo
- Added the
cargo add
command for adding dependencies toCargo.toml
from the command-line. docs - Package ID specs now support
name@version
syntax in addition to the previousname:version
to align with the behavior incargo add
and other tools.cargo install
andcargo yank
also now support this syntax so the version does not need to passed as a separate flag. - The
git
andregistry
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). - Added automatic
@
argfile support, which will use "response files" if the command-line torustc
exceeds the operating system's limit.
Compatibility Notes
cargo test
now passes--target
torustdoc
if the specified target is the same as the host target. #10594- rustdoc: doctests are now run on unexported
macro_rules!
macros, matching other private items - rustdoc: Remove .woff font files
- Enforce Copy bounds for repeat elements while considering lifetimes
- Windows: Fix potential unsoundness by aborting if
File
reads or writes cannot complete synchronously.
Internal Changes
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.61.0
Language
const fn
signatures can now include generic trait boundsconst fn
signatures can now useimpl Trait
in argument and return position- Function pointers can now be created, cast, and passed around in a
const fn
- Recursive calls can now set the value of a function's opaque
impl Trait
return type
Compiler
- Linking modifier syntax in
#[link]
attributes and on the command line, as well as thewhole-archive
modifier specifically, are now supported - The
char
type is now described as UTF-32 in debuginfo - The
#[target_feature]
attribute can now be used with aarch64 features - X86
#[target_feature = "adx"]
is now stable
Libraries
ManuallyDrop<T>
is now documented to have the same layout asT
#[ignore = "…"]
messages are printed when running tests- Consistently show absent stdio handles on Windows as NULL handles
- Make
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 writinglet out = std::io::stdout().lock();
becauseout
would outlive the return value ofstdout()
. 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. Sinceavailable_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.
Stabilized APIs
Pin::static_mut
Pin::static_ref
Vec::retain_mut
VecDeque::retain_mut
Write
forCursor<[u8; N]>
std::os::unix::net::SocketAddr::from_pathname
std::process::ExitCode
andstd::process::Termination
. The stabilization of these two APIs now makes it possible for programs to return errors frommain
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
Cargo
No feature changes, but see compatibility notes.
Compatibility Notes
- Previously native static libraries were linked as
whole-archive
in some cases, but now rustc tries not to usewhole-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- (more common) either be reordered to respect dependencies between them (if
a
depends onb
thena
should go first andb
second) - (less common) or be updated to use the
+whole-archive
modifier.
- (more common) either be reordered to respect dependencies between them (if
- Catching a second unwind from FFI code while cleaning up from a Rust panic now causes the process to abort
- Proc macros no longer see
ident
matchers wrapped in groups - The number of
#
inr#
raw string literals is now required to be less than 256 - When checking that a dyn type satisfies a trait bound, supertrait bounds are now enforced
cargo vendor
now only accepts one value for each--sync
flagcfg
predicates inall()
andany()
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 ofall
to write something likecfg(all(feature = "nightly", syntax-requiring-nightly))
, which will now fail to compile. Instead, use eithercfg_attr(feature = "nightly", ...)
or nested uses ofcfg
.- bootstrap: static-libstdcpp is now enabled by default, and can now be disabled when llvm-tools is enabled
Internal Changes
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.60.0
Language
- Stabilize
#[cfg(panic = "...")]
for either"unwind"
or"abort"
. - Stabilize
#[cfg(target_has_atomic = "...")]
for each integer size and"ptr"
.
Compiler
- Enable combining
+crt-static
andrelocation-model=pic
onx86_64-unknown-linux-gnu
- Fixes wrong
unreachable_pub
lints on nested and glob public reexport - Stabilize
-Z instrument-coverage
as-C instrument-coverage
- Stabilize
-Z print-link-args
as--print link-args
- Add new Tier 3 target
mips64-openwrt-linux-musl
* - Add new Tier 3 target
armv7-unknown-linux-uclibceabi
(softfloat)* - Fix invalid removal of newlines from doc comments
- Add kernel target for RustyHermit
- Deny mixing bin crate type with lib crate types
- Make rustc use
RUST_BACKTRACE=full
by default - Upgrade to LLVM 14
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Guarantee call order for
sort_by_cached_key
- Improve
Duration::try_from_secs_f32
/f64
accuracy by directly processing exponent and mantissa - Make
Instant::{duration_since, elapsed, sub}
saturating - Remove non-monotonic clocks workarounds in
Instant::now
- Make
BuildHasherDefault
,iter::Empty
andfuture::Pending
covariant
Stabilized APIs
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)- _Op_
Assign<$t> for Wrapping<$t>
arch::is_aarch64_feature_detected!
Cargo
- Port cargo from
toml-rs
totoml_edit
- Stabilize
-Ztimings
as--timings
- Stabilize namespaced and weak dependency features.
- Accept more
cargo:rustc-link-arg-*
types from build script output. - cargo-new should not add ignore rule on Cargo.lock inside subdirs
Misc
- Ship docs on Tier 2 platforms by reusing the closest Tier 1 platform docs
- Drop rustc-docs from complete profile
- bootstrap: tidy up flag handling for llvm build
Compatibility Notes
- Remove compiler-rt linking hack on Android
- Mitigations for platforms with non-monotonic clocks have been removed from
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 to0
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 in0
rather than a panic.- In a future release we're planning to increase the baseline requirements for the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love your feedback in PR #95026.
Internal Changes
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.59.0
Language
- Stabilize default arguments for const parameters and remove the ordering restriction for type and const parameters
- Stabilize destructuring assignment
- Relax private in public lint on generic bounds and where clauses of trait impls
- Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64, and RISC-V
Compiler
- Stabilize new symbol mangling format, leaving it opt-in (-Csymbol-mangling-version=v0)
- Emit LLVM optimization remarks when enabled with
-Cremark
- Fix sparc64 ABI for aggregates with floating point members
- Warn when a
#[test]
-like built-in attribute macro is present multiple times. - Add support for riscv64gc-unknown-freebsd
- Stabilize
-Z emit-future-incompat
as--json future-incompat
- Soft disable incremental compilation
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.
Libraries
Stabilized APIs
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
implementingClone
,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
- armv8 neon intrinsics for aarch64
Const-stable:
mem::MaybeUninit::as_ptr
mem::MaybeUninit::assume_init
mem::MaybeUninit::assume_init_ref
ffi::CStr::from_bytes_with_nul_unchecked
Cargo
- Stabilize the
strip
profile option - Stabilize future-incompat-report
- Support abbreviating
--release
as-r
- Support
term.quiet
configuration - Remove
--host
from cargo {publish,search,login}
Compatibility Notes
- Refactor weak symbols in std::sys::unix This may add new, versioned, symbols when building with a newer glibc, as the standard library uses weak linkage rather than dynamically attempting to load certain symbols at runtime.
- Deprecate crate_type and crate_name nested inside
#![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. - Remove effect of
#[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. - Cargo will document libraries before binaries.
- Respect doc=false in dependencies, not just the root crate
- Weaken guarantee around advancing underlying iterators in zip
- Make split_inclusive() on an empty slice yield an empty output
- Update std::env::temp_dir to use GetTempPath2 on Windows when available.
- unreachable! was updated to match other formatting macro behavior on Rust 2021
Internal Changes
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.58.1
Rust 1.58.0
Language
- Format strings can now capture arguments simply by writing
{ident}
in the string. This works in all macros accepting format strings. Support for this inpanic!
(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.- The rules for when a generic struct implements
Unsize
have been relaxed.
Compiler
- Add LLVM CFI support to the Rust compiler
- Stabilize -Z strip as -C strip. Note that while release builds already don't add debug symbols for the code you compile, the compiled standard library that ships with Rust includes debug symbols, so you may want to use the
strip
option to remove these symbols to produce smaller release binaries. Note that this release only includes support in rustc, not directly in cargo. - Add support for LLVM coverage mapping format versions 5 and 6
- Emit LLVM optimization remarks when enabled with
-Cremark
- Update the minimum external LLVM to 12
- Add
x86_64-unknown-none
at Tier 3* - Build musl dist artifacts with debuginfo enabled. When building release binaries using musl, you may want to use the newly stabilized strip option to remove these debug symbols, reducing the size of your binaries.
- Don't abort compilation after giving a lint error
- Error messages point at the source of trait bound obligations in more places
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- All remaining functions in the standard library have
#[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. - Paths are automatically canonicalized on Windows for operations that support it
- Re-enable debug checks for
copy
andcopy_nonoverlapping
- Implement
RefUnwindSafe
forRc<T>
- Make RSplit<T, P>: Clone not require T: Clone
- Implement
Termination
forResult<Infallible, E>
. This allows writingfn main() -> Result<Infallible, ErrorType>
, for a program whose successful exits never involve returning frommain
(for instance, a program that callsexit
, or that usesexec
to run another program).
Stabilized APIs
Metadata::is_symlink
Path::is_symlink
{integer}::saturating_div
Option::unwrap_unchecked
Result::unwrap_unchecked
Result::unwrap_err_unchecked
File::options
These APIs are now usable in const contexts:
Duration::new
Duration::checked_add
Duration::saturating_add
Duration::checked_sub
Duration::saturating_sub
Duration::checked_mul
Duration::saturating_mul
Duration::checked_div
Cargo
Rustdoc
Compatibility Notes
- Try all stable method candidates first before trying unstable ones. This change ensures that adding new nightly-only methods to the Rust standard library will not break code invoking methods of the same name from traits outside the standard library.
- Windows:
std::process::Command
will no longer search the current directory for executables. - All proc-macro backward-compatibility lints are now deny-by-default.
- proc_macro: Append .0 to unsuffixed float if it would otherwise become int token
- Refactor weak symbols in std::sys::unix. This optimizes accesses to glibc functions, by avoiding the use of dlopen. This does not increase the minimum expected version of glibc. However, software distributions that use symbol versions to detect library dependencies, and which take weak symbols into account in that analysis, may detect rust binaries as requiring newer versions of glibc.
- rustdoc now rejects some unexpected semicolons in doctests
Internal Changes
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.57.0
Language
- Macro attributes may follow
#[derive]
and will see the original (pre-cfg
) input. - Accept curly-brace macros in expressions, like
m!{ .. }.method()
andm!{ .. }?
. - Allow panicking in constant evaluation.
- Ignore derived
Clone
andDebug
implementations during dead code analysis.
Compiler
- Create more accurate debuginfo for vtables.
- Add
armv6k-nintendo-3ds
at Tier 3*. - Add
armv7-unknown-linux-uclibceabihf
at Tier 3*. - Add
m68k-unknown-linux-gnu
at Tier 3*. - Add SOLID targets 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.
Libraries
- Avoid allocations and copying in
Vec::leak
- Add
#[repr(i8)]
toOrdering
- Optimize
File::read_to_end
andread_to_string
- Update to Unicode 14.0
- Many more functions are marked
#[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.
Stabilised APIs
[T; N]::as_mut_slice
[T; N]::as_slice
collections::TryReserveError
HashMap::try_reserve
HashSet::try_reserve
String::try_reserve
String::try_reserve_exact
Vec::try_reserve
Vec::try_reserve_exact
VecDeque::try_reserve
VecDeque::try_reserve_exact
Iterator::map_while
iter::MapWhile
proc_macro::is_available
Command::get_program
Command::get_args
Command::get_envs
Command::get_current_dir
CommandArgs
CommandEnvs
These APIs are now usable in const contexts:
Cargo
Compatibility notes
- Ignore derived
Clone
andDebug
implementations during dead code analysis. This will break some builds that set#![deny(dead_code)]
.
Internal changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.