Rust versions / 1.74
Rust release · Nov 16, 2023
Rust 1.74: what's new, what was stabilized
Short answerRust 1.74 was released on Nov 16, 2023: 1 language stabilization (Stabilize impl_trait_projections); 18 newly stable APIs (core::num::Saturating, impl From<io::Stdout> for std::process::Stdio, impl From<io::Stderr> for std::process::Stdio, impl From<OwnedHandle> for std::process::Child{Stdin, Stdout, Stderr}, ...); 5 compatibility notes that can affect existing code. Point release: 1.74.1 (Dec 7, 2023).
← Rust 1.73All versionsRust 1.75 →
Language features stabilized
- Stabilize impl_trait_projections
18 APIs stabilized
core::num::Saturating, impl From<io::Stdout> for std::process::Stdio, impl From<io::Stderr> for std::process::Stdio, impl 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_unchecked, std::ffi::OsString::into_encoded_bytes, std::ffi::OsStr::from_encoded_bytes_unchecked, std::ffi::OsStr::as_encoded_bytes, std::io::Error::other, impl TryFrom<char> for u16, impl<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]>, core::mem::transmute_copy, str::is_ascii, [u8]::is_ascii
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- Raise minimum supported Apple OS versions
- make Cell::swap panic if the Cells partially overlap
- Reject invalid crate names in
--extern - Don't resolve generic impls that may be shadowed by dyn built-in impls
- [The new
impl From<{&,&mut} [T; N]> for Vec<T>is known to cause some inference failures with overly-generic code.](https://github.com/rust-lang/rust/issues/117054) In those examples using thetuicrate, the combination ofAsRef<_>andInto<Vec>leaves the middle type ambiguous, and the newimpladds another possibility, so it now requires an explicit type annotation.
Use it
rustup update stable # get the newest release
rustup install 1.74 # or exactly this one
rustup override set 1.74 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.74" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- Codify that
std::mem::Discriminant<T>does not depend on any lifetimes in T - Replace
private_in_publiclint withprivate_interfacesandprivate_boundsper RFC 2145. Read more in RFC 2145. - [Allow explicit
#[repr(Rust)]](https://github.com/rust-lang/rust/pull/114201/) - closure field capturing: don't depend on alignment of packed fields
- Enable MIR-based drop-tracking for
asyncblocks - Stabilize
impl_trait_projections
<a id="1.74.0-Compiler"></a>
Compiler
- stabilize combining +bundle and +whole-archive link modifiers
- Stabilize
PATHoption for--print KIND=PATH - Enable ASAN/LSAN/TSAN for
*-apple-ios-macabi - Promote loongarch64-unknown-none* to Tier 2
- Add
i686-pc-windows-gnullvmas a tier 3 target
<a id="1.74.0-Libraries"></a>
Libraries
- Implement
From<OwnedFd/Handle>for ChildStdin/out/err - [Implement
From<{&,&mut} [T; N]>forVec<T>whereT: Clone](https://github.com/rust-lang/rust/pull/111278/) - impl Step for IP addresses
- [Implement
From<[T; N]>forRc<[T]>andArc<[T]>](https://github.com/rust-lang/rust/pull/114041/) impl TryFrom<char> for u16- Stabilize
io_error_otherfeature - Stabilize the
Saturatingtype - Stabilize const_transmute_copy
<a id="1.74.0-Stabilized-APIs"></a>
Stabilized APIs
core::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 u16- [
impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T>](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#impl-From%3C%26%5BT;+N%5D%3E-for-Vec%3CT,+Global%3E) - [
impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T>](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#impl-From%3C%26mut+%5BT;+N%5D%3E-for-Vec%3CT,+Global%3E) - [
impl<T, const N: usize> From<[T; N]> for Arc<[T]>](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#impl-From%3C%5BT;+N%5D%3E-for-Arc%3C%5BT%5D,+Global%3E) - [
impl<T, const N: usize> From<[T; N]> for Rc<[T]>](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#impl-From%3C%5BT;+N%5D%3E-for-Rc%3C%5BT%5D,+Global%3E)
These APIs are now stable in const contexts:
core::mem::transmute_copystr::is_ascii- [
[u8]::is_ascii](https://doc.rust-lang.org/beta/std/primitive.slice.html#method.is_ascii)
<a id="1.74.0-Cargo"></a>
Cargo
- [In
Cargo.toml, stabilize[lints]](https://github.com/rust-lang/cargo/pull/12648/) - Stabilize credential-process and registry-auth
- Stabilize
--keep-goingbuild flag - Add styling to
--helpoutput - For
cargo clean, add--dry-runflag and summary line at the end - For
cargo update, make--packagemore convenient by being positional - For
cargo update, clarify meaning of --aggressive as --recursive - Add '-n' as an alias for
--dry-run - Allow version-prefixes in pkgid's (e.g.
--packageflags) to resolve ambiguities - In
.cargo/config.toml, merge lists in precedence order - Add support for
target.'cfg(..)'.linker
<a id="1.74.0-Rustdoc"></a>
Rustdoc
- Add warning block support in rustdoc
- rustdoc-search: add support for type parameters
- rustdoc: show inner enum and struct in type definition for concrete type
<a id="1.74.0-Compatibility-Notes"></a>
Compatibility Notes
- Raise minimum supported Apple OS versions
- make Cell::swap panic if the Cells partially overlap
- Reject invalid crate names in
--extern - Don't resolve generic impls that may be shadowed by dyn built-in impls
- [The new
impl From<{&,&mut} [T; N]> for Vec<T>is known to cause some inference failures with overly-generic code.](https://github.com/rust-lang/rust/issues/117054) In those examples using thetuicrate, the combination ofAsRef<_>andInto<Vec>leaves the middle type ambiguous, and the newimpladds another possibility, so it now requires an explicit type annotation.
<a id="1.74.0-Internal-Changes"></a>
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.
None this cycle.
1.74.1 (Dec 7, 2023)
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.75Released Dec 28, 2023.Read it next →Also worth your time
Did this answer your question?