Releases: rust-lang/rust
Rust 1.69.0
Language
- Deriving built-in traits on packed structs works with
Copy
fields. - Stabilize the
cmpxchg16b
target feature on x86 and x86_64. - Improve analysis of trait bounds for associated types.
- Allow associated types to be used as union fields.
- Allow
Self: Autotrait
bounds on dyn-safe trait methods. - Treat
str
as containing[u8]
for auto trait purposes.
Compiler
- Upgrade
*-pc-windows-gnu
on CI to mingw-w64 v10 and GCC 12.2. - Rework min_choice algorithm of member constraints.
- Support
true
andfalse
as boolean flags in compiler arguments. - Default
repr(C)
enums toc_int
size.
Libraries
- Implement the unstable
DispatchFromDyn
for cell types, allowing downstream experimentation with custom method receivers. - Document that
fmt::Arguments::as_str()
may returnSome(_)
in more cases after optimization, subject to change. - Implement
AsFd
andAsRawFd
forRc
.
Stabilized APIs
These APIs are now stable in const contexts:
SocketAddr::new
SocketAddr::ip
SocketAddr::port
SocketAddr::is_ipv4
SocketAddr::is_ipv6
SocketAddrV4::new
SocketAddrV4::ip
SocketAddrV4::port
SocketAddrV6::new
SocketAddrV6::ip
SocketAddrV6::port
SocketAddrV6::flowinfo
SocketAddrV6::scope_id
Cargo
- Cargo now suggests
cargo fix
orcargo clippy --fix
when compilation warnings are auto-fixable. - Cargo now suggests
cargo add
if you try to install a library crate. - Cargo now sets the
CARGO_BIN_NAME
environment variable also for binary examples.
Rustdoc
- Vertically compact trait bound formatting.
- Only include stable lints in
rustdoc::all
group. - Compute maximum Levenshtein distance based on the query.
- Remove inconsistently-present sidebar tooltips.
- Search by macro when query ends with
!
.
Compatibility Notes
- The
rust-analysis
component fromrustup
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. - Unaligned references to packed fields are now a hard error. This has been a warning since 1.53, and denied by default with a future-compatibility warning since 1.62.
- Update the minimum external LLVM to 14.
- Cargo now emits errors on invalid characters in a registry token.
- When
default-features
is set to false of a workspace dependency, and an inherited dependency of a member hasdefault-features = true
, Cargo will enable default features of that dependency. - Cargo denies
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. - Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.
- The Rust distribution no longer always includes rustdoc If
tools = [...]
is set in config.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.
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.
Rust 1.68.2
- Update the GitHub RSA host key bundled within Cargo. The key was rotated by GitHub on 2023-03-24 after the old one leaked.
- Mark the old GitHub RSA host key as revoked. This will prevent Cargo from accepting the leaked key even when trusted by the system.
- Add support for
@revoked
and a better error message for@cert-authority
in Cargo's SSH host key verification
Rust 1.68.1
- Fix miscompilation in produced Windows MSVC artifacts This was introduced by enabling ThinLTO for the distributed rustc which led to miscompilations in the resulting binary. Currently this is believed to be limited to the -Zdylib-lto flag used for rustc compilation, rather than a general bug in ThinLTO, so only rustc artifacts should be affected.
- Fix --enable-local-rust builds
- Treat
$prefix-clang
asclang
in linker detection code - Fix panic in compiler code
Rust 1.68.0
Language
- Stabilize default_alloc_error_handler This allows usage of
alloc
on stable without requiring the definition of a handler for allocation failure. Defining custom handlers is still unstable. - Stabilize
efiapi
calling convention. - Remove implicit promotion for types with drop glue
Compiler
- Change
bindings_with_variant_name
to deny-by-default - Allow .. to be parsed as let initializer
- Add
armv7-sony-vita-newlibeabihf
as a tier 3 target - Always check alignment during compile-time const evaluation
- Disable "split dwarf inlining" by default.
- Add vendor to Fuchsia's target triple
- Enable sanitizers for s390x-linux
Libraries
- Loosen the bound on the Debug implementation of Weak.
- Make
std::task::Context
!Send and !Sync - PhantomData layout guarantees
- Don't derive Debug for
OnceWith
&RepeatWith
- Implement DerefMut for PathBuf
- Add O(1)
Vec -> VecDeque
conversion guarantee - Leak amplification for peek_mut() to ensure BinaryHeap's invariant is always met
Stabilized APIs
{core,std}::pin::pin!
impl From<bool> for {f32,f64}
std::path::MAIN_SEPARATOR_STR
impl DerefMut for PathBuf
These APIs are now stable in const contexts:
Cargo
- Stabilize sparse registry support for crates.io
cargo build --verbose
tells you more about why it recompiles.- Show progress of crates.io index update even
net.git-fetch-with-cli
option enabled
Misc
Compatibility Notes
- Only support Android NDK 25 or newer
- Add
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS
to future-incompat report - Only specify
--target
by default for-Zgcc-ld=lld
on wasm - Bump
IMPLIED_BOUNDS_ENTAILMENT
to Deny + ReportNow std::task::Context
no longer implements Send and Sync
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.
- Encode spans relative to the enclosing item
- Don't normalize in AstConv
- Find the right lower bound region in the scenario of partial order relations
- Fix impl block in const expr
- Check ADT fields for copy implementations considering regions
- rustdoc: simplify JS search routine by not messing with lev distance
- Enable ThinLTO for rustc on
x86_64-pc-windows-msvc
- Enable ThinLTO for rustc on
x86_64-apple-darwin
Rust 1.67.1
Rust 1.67.0
Language
- Make
Sized
predicates coinductive, allowing cycles. #[must_use]
annotations onasync fn
also affect theFuture::Output
.- Elaborate supertrait obligations when deducing closure signatures.
- Invalid literals are no longer an error under
cfg(FALSE)
. - Unreserve braced enum variants in value namespace.
Compiler
- Enable varargs support for calling conventions other than
C
orcdecl
. - Add new MIR constant propagation based on dataflow analysis.
- Optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones.
- Stabilize native library modifier
verbatim
.
Added, updated, and removed targets:
- Add a tier 3 target for PowerPC on AIX,
powerpc64-ibm-aix
. - Add a tier 3 target for the Sony PlayStation 1,
mipsel-sony-psx
. - Add tier 3
no_std
targets for the QNX Neutrino RTOS,aarch64-unknown-nto-qnx710
andx86_64-pc-nto-qnx710
. - Promote UEFI targets to tier 2,
aarch64-unknown-uefi
,i686-unknown-uefi
, andx86_64-unknown-uefi
. - Remove tier 3
linuxkernel
targets (not used by the actual kernel).
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Merge
crossbeam-channel
intostd::sync::mpsc
. - Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.
- Derive
Eq
andHash
forControlFlow
. - Don't build
compiler_builtins
with-C panic=abort
.
Stabilized APIs
{integer}::checked_ilog
{integer}::checked_ilog2
{integer}::checked_ilog10
{integer}::ilog
{integer}::ilog2
{integer}::ilog10
NonZeroU*::ilog2
NonZeroU*::ilog10
NonZero*::BITS
These APIs are now stable in const contexts:
Compatibility Notes
- The layout of
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 ofrepr(Rust)
types is an implementation detail, subject to change. - 0.5 now rounds to 0 when formatted to 0 decimal places. This makes it consistent with the rest of floating point formatting that rounds ties toward even digits.
- Chains of
&&
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. - Underscore suffixes on string literals are now a hard error. This has been a future-compatibility warning since 1.20.0.
- Stop passing
-export-dynamic
towasm-ld
. main
is now mangled as__main_void
onwasm32-wasi
.- Cargo now emits an error if there are multiple registries in the configuration with the same index URL.
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.
Rust 1.66.1
- Added validation of SSH host keys for git URLs in Cargo (CVE-2022-46176)
Rust 1.66.1
- Added validation of SSH host keys for git URLs in Cargo (CVE-2022-46176)
Rust 1.66.0
Language
- Permit specifying explicit discriminants on all
repr(Int)
enums#[repr(u8)] enum Foo { A(u8) = 0, B(i8) = 1, C(bool) = 42, }
- Allow transmutes between the same type differing only in lifetimes
- Change constant evaluation errors from a deny-by-default lint to a hard error
- Trigger
must_use
onimpl Trait
for supertraits This makesimpl ExactSizeIterator
respect the existing#[must_use]
annotation onIterator
. - Allow
..=X
in patterns - Uplift
clippy::for_loops_over_fallibles
lint into rustc - Stabilize
sym
operands in inline assembly - Update to Unicode 15
- Opaque types no longer imply lifetime bounds This is a soundness fix which may break code that was erroneously relying on this behavior.
Compiler
- Add armv5te-none-eabi and thumbv5te-none-eabi tier 3 targets
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
- Add support for linking against macOS universal libraries
Libraries
- Fix
#[derive(Default)]
on a generic#[default]
enum adding unnecessaryDefault
bounds - Update to Unicode 15
Stabilized APIs
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}
- Add
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
Rustdoc
Cargo
- Added
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.
Compatibility Notes
- Only apply
ProceduralMasquerade
hack to older versions ofrental
- Don't export
__heap_base
and__data_end
on wasm32-wasi. - Don't export
__wasm_init_memory
on WebAssembly. - Only export
__tls_*
on wasm32-unknown-unknown. - Don't link to
libresolv
in libstd on Darwin - Update libstd's libc to 0.2.135 (to make
libstd
no longer pull inlibiconv.dylib
on Darwin) - Opaque types no longer imply lifetime bounds This is a soundness fix which may break code that was erroneously relying on this behavior.
- Make
order_dependent_trait_objects
show up in future-breakage reports - Change std::process::Command spawning to default to inheriting the parent's signal mask
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.
Rust 1.65.0
Language
- Error on
as
casts of enums with#[non_exhaustive]
variants - Stabilize
let else
- Stabilize generic associated types (GATs)
- Add lints
let_underscore_drop
andlet_underscore_lock
from Clippy - Stabilize
break
ing from arbitrary labeled blocks ("label-break-value") - Uninitialized integers, floats, and raw pointers are now considered immediate UB. Usage of
MaybeUninit
is the correct way to work with uninitialized memory. - Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a
- Do not allow
Drop
impl on foreign ADTs
Compiler
- Stabilize -Csplit-debuginfo on Linux
- Use niche-filling optimization even when multiple variants have data
- Associated type projections are now verified to be well-formed prior to resolving the underlying type
- Stringify non-shorthand visibility correctly
- Normalize struct field types when unsizing
- Update to LLVM 15
- Fix aarch64 call abi to correctly zeroext when needed
- debuginfo: Generalize C++-like encoding for enums
- Add
special_module_name
lint - Add support for generating unique profraw files by default when using
-C instrument-coverage
- Allow dynamic linking for iOS/tvOS targets
New targets:
- Add armv4t-none-eabi as a tier 3 target
- Add powerpc64-unknown-openbsd and riscv64-unknown-openbsd as tier 3 targets
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Don't generate
PartialEq::ne
in derive(PartialEq) - Windows RNG: Use
BCRYPT_RNG_ALG_HANDLE
by default - Forbid mixing
System
with direct system allocator calls - Document no support for writing to non-blocking stdio/stderr
std::layout::Layout
size must not overflowisize::MAX
when rounded up toalign
This also changes the safety conditions onLayout::from_size_align_unchecked
.
Stabilized APIs
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:
Cargo
- Apply GitHub fast path even for partial hashes
- Do not add home bin path to PATH if it's already there
- Take priority into account within the pending queue. This slightly optimizes job scheduling by Cargo, with typically small improvements on larger crate graph builds.
Compatibility Notes
std::layout::Layout
size must not overflowisize::MAX
when rounded up toalign
. This also changes the safety conditions onLayout::from_size_align_unchecked
.PollFn
now only implementsUnpin
if the closure isUnpin
. 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.- Drop ExactSizeIterator impl from std::char::EscapeAscii This is a backwards-incompatible change to the standard library's surface area, but is unlikely to affect real world usage.
- Do not consider a single repeated lifetime eligible for elision in the return type This behavior was unintentionally changed in 1.64.0, and this release reverts that change by making this an error again.
- Reenable disabled early syntax gates as future-incompatibility lints
- Update the minimum external LLVM to 13
- Don't duplicate file descriptors into stdio fds
- Sunset RLS
- Deny usage of
#![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 viallvm-config
, not the built-in LLVM.- Combining three or more languages (e.g. Objective C, C++ and Rust) into one binary may hit linker limitations when using
lld
. For more information, see issue 102754.
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.
- Add
x.sh
andx.ps1
shell scripts - compiletest: use target cfg instead of hard-coded tables
- Use object instead of LLVM for reading bitcode from rlibs
- Enable MIR inlining for optimized compilations This provides a 3-10% improvement in compiletimes for real world crates. See perf results.