Rust versions / 1.49
Rust release · Dec 31, 2020
Rust 1.49: what's new, what was stabilized
Short answerRust 1.49 was released on Dec 31, 2020: 5 newly stable APIs (slice::select_nth_unstable, slice::select_nth_unstable_by, slice::select_nth_unstable_by_key, Poll::is_ready, ...); 5 compatibility notes that can affect existing code.
← Rust 1.48All versionsRust 1.50 →
5 APIs stabilized
slice::select_nth_unstable, slice::select_nth_unstable_by, slice::select_nth_unstable_by_key, Poll::is_ready, Poll::is_pending
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:
- [Demoted
i686-unknown-freebsdfrom host tier 2 to target tier 2 support.][78746] - [Macros that end with a semi-colon are now treated as statements even if they expand to nothing.][78376]
- [Rustc will now check for the validity of some built-in attributes on enum variants.][77015]
- Leading whitespace is stripped more uniformly in documentation comments, which may change behavior. You
- [Trait bounds are no longer inferred for associated types.][79904]
Use it
rustup update stable # get the newest release
rustup install 1.49 # or exactly this one
rustup override set 1.49 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.49" 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
- [Unions can now implement
Drop, and you can now have a field in a union withManuallyDrop<T>.][77547] - [You can now cast uninhabited enums to integers.][76199]
- [You can now bind by reference and by move in patterns.][76119] This allows you to selectively borrow individual components of a type. E.g. ```rust #[derive(Debug)] struct Person { name: String, age: u8, }
let person = Person { name: String::from("Alice"), age: 20, };
// name is moved out of person, but age is referenced. let Person { name, ref age } = person; println!("{} {}", name, age); ```
Compiler
- [Added tier 1\* support for
aarch64-unknown-linux-gnu.][78228] - [Added tier 2 support for
aarch64-apple-darwin.][75991] - [Added tier 2 support for
aarch64-pc-windows-msvc.][75914] - [Added tier 3 support for
mipsel-unknown-none.][78676] - [Raised the minimum supported LLVM version to LLVM 9.][78848]
- [Output from threads spawned in tests is now captured.][78227]
- [Change os and vendor values to "none" and "unknown" for some targets][78951]
\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- [
RangeInclusivenow checks for exhaustion when callingcontainsand indexing.][78109] - [
ToString::to_stringnow no longer shrinks the internal buffer in the default implementation.][77997]
Stabilized APIs
- [
slice::select_nth_unstable] - [
slice::select_nth_unstable_by] - [
slice::select_nth_unstable_by_key]
The following previously stable methods are now const.
- [
Poll::is_ready] - [
Poll::is_pending]
Cargo
- [Building a crate with
cargo-packageshould now be independently reproducible.][cargo/8864] - [
cargo-treenow marks proc-macro crates.][cargo/8765] - [Added
CARGO_PRIMARY_PACKAGEbuild-time environment variable.][cargo/8758] This variable will be set if the crate being built is one the user selected to build, either with-por through defaults. - [You can now use glob patterns when specifying packages & targets.][cargo/8752]
Compatibility Notes
- [Demoted
i686-unknown-freebsdfrom host tier 2 to target tier 2 support.][78746] - [Macros that end with a semi-colon are now treated as statements even if they expand to nothing.][78376]
- [Rustc will now check for the validity of some built-in attributes on enum variants.][77015] Previously such invalid or unused attributes could be ignored.
- Leading whitespace is stripped more uniformly in documentation comments, which may change behavior. You read [this post about the changes][rustdoc-ws-post] for more details.
- [Trait bounds are no longer inferred for associated types.][79904]
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.50Released Feb 11, 2021.Read it next →Also worth your time
Did this answer your question?