Rust versions / 1.37
Rust release · Aug 15, 2019
Rust 1.37: what's new, what was stabilized
Short answerRust 1.37 was released on Aug 15, 2019: 20 newly stable APIs (BufReader::buffer, BufWriter::buffer, Cell::from_mut, Cell<[T]>::as_slice_of_cells, ...); 2 compatibility notes that can affect existing code.
← Rust 1.36All versionsRust 1.38 →
20 APIs stabilized
BufReader::buffer, BufWriter::buffer, Cell::from_mut, Cell<[T]>::as_slice_of_cells, DoubleEndedIterator::nth_back, Option::xor, Wrapping::reverse_bits, i128::reverse_bits, i16::reverse_bits, i32::reverse_bits, i64::reverse_bits, i8::reverse_bits, isize::reverse_bits, slice::copy_within, u128::reverse_bits, u16::reverse_bits, u32::reverse_bits, u64::reverse_bits, u8::reverse_bits, usize::reverse_bits
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:
- [Using
...for inclusive range patterns will now warn by default.][61342] - [Using a trait object without the
dynwill now warn by default.][61203]
Use it
rustup update stable # get the newest release
rustup install 1.37 # or exactly this one
rustup override set 1.37 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.37" 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
#[must_use]will now warn if the type is contained in a [tuple][61100], [Box][62228], or an [array][62235] and unused.- [You can now use the
cfgandcfg_attrattributes on generic parameters.][61547] - [You can now use enum variants through type alias.][61682] e.g. You can write the following: ```rust type MyOption = Option<u8>;
fn increment_or_zero(x: MyOption) -> u8 { match x { MyOption::Some(y) => y + 1, MyOption::None => 0, } } ```
- [You can now use
_as an identifier for consts.][61347] e.g. You can writeconst _: u32 = 5;. - [You can now use
#[repr(align(X)]on enums.][61229] - [The
?Kleene macro operator is now available in the 2015 edition.][60932]
Compiler
- [You can now enable Profile-Guided Optimization with the
-C profile-generateand-C profile-useflags.][61268] For more information on how to use profile guided optimization, please refer to the [rustc book][rustc-book-pgo]. - [The
rust-lldbwrapper script should now work again.][61827]
Libraries
- [
mem::MaybeUninit<T>is now ABI-compatible withT.][61802]
Stabilized APIs
- [
BufReader::buffer] - [
BufWriter::buffer] - [
Cell::from_mut] - [
Cell<[T]>::as_slice_of_cells][Cell<slice>::as_slice_of_cells] - [
DoubleEndedIterator::nth_back] - [
Option::xor] - [
Wrapping::reverse_bits] - [
i128::reverse_bits] - [
i16::reverse_bits] - [
i32::reverse_bits] - [
i64::reverse_bits] - [
i8::reverse_bits] - [
isize::reverse_bits] - [
slice::copy_within] - [
u128::reverse_bits] - [
u16::reverse_bits] - [
u32::reverse_bits] - [
u64::reverse_bits] - [
u8::reverse_bits] - [
usize::reverse_bits]
Cargo
- [
Cargo.lockfiles are now included by default when publishing executable crates with executables.][cargo/7026] - [You can now specify
default-run="foo"in[package]to specify the default executable to use forcargo run.][cargo/7056]
Compatibility Notes
- Using
...for inclusive range patterns will now warn by default. Please transition your code to using the..=syntax for inclusive ranges instead. - Using a trait object without the
dynwill now warn by default. Please transition your code to usedyn Traitfor trait objects instead.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.38Released Sep 26, 2019.Read it next →Also worth your time
Did this answer your question?