Rust versions / 1.21
Rust release · Oct 12, 2017
Rust 1.21: what's new, what was stabilized
Short answerRust 1.21 was released on Oct 12, 2017: 3 compatibility notes that can affect existing code.
← Rust 1.20All versionsRust 1.22 →
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:
- [Changes in method matching against higher-ranked types][43880] This may cause
- [rustc's JSON error output's byte position start at top of file.][42973]
- [
unused_resultslint no longer ignores booleans][43728]
Use it
rustup update stable # get the newest release
rustup install 1.21 # or exactly this one
rustup override set 1.21 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.21" 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
- [You can now use static references for literals.][43838] Example: ``
rust fn main() { let x: &'static u32 = &0; }`` - [Relaxed path syntax. Optional
::before<is now allowed in all contexts.][43540] Example: ``rust my_macro!(Vec<i32>::new); // Always worked my_macro!(Vec::<i32>::new); // Now works``
Compiler
- [Upgraded jemalloc to 4.5.0][43911]
- [Enabled unwinding panics on Redox][43917]
- [Now runs LLVM in parallel during translation phase.][43506] This should reduce peak memory usage.
Libraries
- [Generate builtin impls for
Clonefor all arrays and tuples that areT: Clone][43690] - [
Stdin,Stdout, andStderrnow implementAsRawFd.][43459] - [
RcandArcnow implementFrom<&[T]> where T: Clone,From<str>,From<String>,From<Box<T>> where T: ?Sized, andFrom<Vec<T>>.][42565]
Stabilized APIs
[std::mem::discriminant]
Cargo
- [You can now call
cargo installwith multiple package names][cargo/4216] - [Cargo commands inside a virtual workspace will now implicitly pass
--all][cargo/4335] - [Added a
[patch]section toCargo.tomlto handle prepublication dependencies][cargo/4123] [RFC 1969] - [
include&excludefields inCargo.tomlnow accept gitignore like patterns][cargo/4270] - [Added the
--all-targetsoption][cargo/4400] - [Using required dependencies as a feature is now deprecated and emits a warning][cargo/4364]
Misc
- [Cargo docs are moving][43916] to doc.rust-lang.org/cargo
- [The rustdoc book is now available][43863] at doc.rust-lang.org/rustdoc
- [Added a preview of RLS has been made available through rustup][44204] Install with
rustup component add rls-preview - [
std::osdocumentation for Unix, Linux, and Windows now appears on doc.rust-lang.org][43348] Previously only showedstd::os::unix.
Compatibility Notes
- Changes in method matching against higher-ranked types This may cause breakage in subtyping corner cases. A more in-depth explanation is available.
- rustc's JSON error output's byte position start at top of file. Was previously relative to the rustc's internal
CodeMapstruct which required the unstable librarylibsyntaxto correctly use. unused_resultslint no longer ignores booleans
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.22Released Nov 22, 2017.Read it next →Also worth your time
Did this answer your question?