Releases: rust-lang/rust
Rust 1.68.0
Language
- Stabilize default_alloc_error_handler This allows usage of
allocon stable without requiring the definition of a handler for allocation failure. Defining custom handlers is still unstable. - Stabilize
efiapicalling convention. - Remove implicit promotion for types with drop glue
Compiler
- Change
bindings_with_variant_nameto deny-by-default - Allow .. to be parsed as let initializer
- Add
armv7-sony-vita-newlibeabihfas 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 -> VecDequeconversion 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_STRimpl DerefMut for PathBuf
These APIs are now stable in const contexts:
Cargo
- Stabilize sparse registry support for crates.io
cargo build --verbosetells you more about why it recompiles.- Show progress of crates.io index update even
net.git-fetch-with-clioption enabled
Misc
Compatibility Notes
- Only support Android NDK 25 or newer
- Add
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSto future-incompat report - Only specify
--targetby default for-Zgcc-ld=lldon wasm - Bump
IMPLIED_BOUNDS_ENTAILMENTto Deny + ReportNow std::task::Contextno 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
Sizedpredicates coinductive, allowing cycles. #[must_use]annotations onasync fnalso 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
Corcdecl. - 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_stdtargets for the QNX Neutrino RTOS,aarch64-unknown-nto-qnx710andx86_64-pc-nto-qnx710. - Promote UEFI targets to tier 2,
aarch64-unknown-uefi,i686-unknown-uefi, andx86_64-unknown-uefi. - Remove tier 3
linuxkerneltargets (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-channelintostd::sync::mpsc. - Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.
- Derive
EqandHashforControlFlow. - Don't build
compiler_builtinswith-C panic=abort.
Stabilized APIs
{integer}::checked_ilog{integer}::checked_ilog2{integer}::checked_ilog10{integer}::ilog{integer}::ilog2{integer}::ilog10NonZeroU*::ilog2NonZeroU*::ilog10NonZero*::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-dynamictowasm-ld. mainis now mangled as__main_voidonwasm32-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_useonimpl Traitfor supertraits This makesimpl ExactSizeIteratorrespect the existing#[must_use]annotation onIterator. - Allow
..=Xin patterns - Uplift
clippy::for_loops_over_fallibleslint into rustc - Stabilize
symoperands 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 unnecessaryDefaultbounds - Update to Unicode 15
Stabilized APIs
proc_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}- Add
AsFdimplementations 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::fd
Rustdoc
Cargo
- Added
cargo removeto remove dependencies from Cargo.toml cargo publishnow waits for the new version to be downloadable before exiting
See detailed release notes for more.
Compatibility Notes
- Only apply
ProceduralMasqueradehack to older versions ofrental - Don't export
__heap_baseand__data_endon wasm32-wasi. - Don't export
__wasm_init_memoryon WebAssembly. - Only export
__tls_*on wasm32-unknown-unknown. - Don't link to
libresolvin libstd on Darwin - Update libstd's libc to 0.2.135 (to make
libstdno longer pull inlibiconv.dylibon 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_objectsshow 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
ascasts of enums with#[non_exhaustive]variants - Stabilize
let else - Stabilize generic associated types (GATs)
- Add lints
let_underscore_dropandlet_underscore_lockfrom Clippy - Stabilize
breaking from arbitrary labeled blocks ("label-break-value") - Uninitialized integers, floats, and raw pointers are now considered immediate UB. Usage of
MaybeUninitis the correct way to work with uninitialized memory. - Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a
- Do not allow
Dropimpl 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_namelint - 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::nein derive(PartialEq) - Windows RNG: Use
BCRYPT_RNG_ALG_HANDLEby default - Forbid mixing
Systemwith direct system allocator calls - Document no support for writing to non-blocking stdio/stderr
std::layout::Layoutsize must not overflowisize::MAXwhen rounded up toalignThis also changes the safety conditions onLayout::from_size_align_unchecked.
Stabilized APIs
std::backtrace::BacktraceBound::as_refstd::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::Layoutsize must not overflowisize::MAXwhen rounded up toalign. This also changes the safety conditions onLayout::from_size_align_unchecked.PollFnnow only implementsUnpinif 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-patchesallows 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.shandx.ps1shell 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.
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
&Tif every byte inTis 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-widthcompiler flag to define the terminal width. - Add support for link-flavor
rust-lldfor iOS, tvOS and watchOS
Libraries
- Remove restrictions on compare-exchange memory ordering.
- You can now
write!orwriteln!into anOsString: Implementfmt::WriteforOsString - Make RwLockReadGuard covariant
- Implement
FusedIteratorforstd::net::[Into]Incoming impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>ptr::copyandptr::swapare doing untyped copies- Add cgroupv1 support to
available_parallelism - Mitigate many incorrect uses of
mem::uninitialized
Stabilized APIs
future::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_file
These 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::NulError
These 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_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.packageandworkspace.dependenciesfor more details on how to define these common settings. - Cargo commands can now accept multiple
--targetflags to build for multiple targets at once, and thebuild.targetconfig option may now take an array of multiple targets. - The
--jobsargument can now take a negative number to count backwards from the max CPUs. cargo addwill now updateCargo.lock.- Added the
--crate-typeflag tocargo rustcto override the crate type. - Significantly improved the performance fetching git dependencies from GitHub when using a hash in the
revfield.
Misc
Compatibility Notes
- The minimum required versions for all
-linux-gnutargets 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'sUis not larger thanT - A soundness bug in
BTreeMapwas 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-eabitarget, 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 Traitwas 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
- [Sto...
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 Traitargs. - Make
cenum_impl_drop_castwarnings deny-by-default. - Prevent unwinding when
-C panic=abortis used regardless of declared ABI. - lub: don't bail out due to empty binders.
Compiler
- Stabilize the
bundlenative library modifier, also removing the deprecatedstatic-nobundlelinking 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,PartialEqandEqforcore::fmt::Alignment. - Extend
ptr::nullandnull_mutto 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
Hashforcore::alloc::Layout. - Add capacity documentation for
OsString. - Put a bound on collection misbehavior.
- Make
std::mem::needs_dropaccept?Sized. impl Termination for Infallibleand then make theResultimpls ofTerminationmore generic.- Document Rust's stance on
/proc/self/mem.
Stabilized APIs
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::ScopedJoinHandle
These 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
Cargo
- Stabilize the
--config pathcommand-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 Traitreturn types. - The compiler fixed an incremental compilation bug with
async fnlifetimes. - Windows added a fallback for overlapped I/O in synchronous reads and writes.
- The
x86_64-fortanix-unknown-sgxtarget added a mitigation for the MMIO stale data vulnerability, advisory INTEL-SA-00615.