Language
- Closures now implement
Copy
and/orClone
if all captured variables implement either or both traits. - The inclusive range syntax e.g.
for x in 0..=10
is now stable. - The
'_
lifetime is now stable. The underscore lifetime can be used anywhere a lifetime can be elided. impl Trait
is now stable allowing you to have abstract types in returns or in function parameters. E.g.fn foo() -> impl Iterator<Item=u8>
orfn open(path: impl AsRef<Path>)
.- Pattern matching will now automatically apply dereferences.
- 128-bit integers in the form of
u128
andi128
are now stable. main
can now returnResult<(), E: Debug>
in addition to()
.- A lot of operations are now available in a const context. E.g. You can now index into constant arrays, reference and dereference into constants, and use tuple struct constructors.
- Fixed entry slice patterns are now stable. E.g.
let points = [1, 2, 3, 4]; match points { [1, 2, 3, 4] => println!("All points were sequential."), _ => println!("Not all points were sequential."), }
Compiler
- LLD is now used as the default linker for
wasm32-unknown-unknown
. - Fixed exponential projection complexity on nested types. This can provide up to a ~12% reduction in compile times for certain crates.
- Added the
--remap-path-prefix
option to rustc. Allowing you to remap path prefixes outputted by the compiler. - Added
powerpc-unknown-netbsd
target.
Libraries
- Implemented
From<u16> for usize
&From<{u8, i16}> for isize
. - Added hexadecimal formatting for integers with fmt::Debug e.g.
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]")
- Implemented
Default, Hash
forcmp::Reverse
. - Optimized
str::repeat
being 8x faster in large cases. ascii::escape_default
is now available in libcore.- Trailing commas are now supported in std and core macros.
- Implemented
Copy, Clone
forcmp::Reverse
- Implemented
Clone
forchar::{ToLowercase, ToUppercase}
.
Stabilized APIs
*const T::add
*const T::copy_to_nonoverlapping
*const T::copy_to
*const T::read_unaligned
*const T::read_volatile
*const T::read
*const T::sub
*const T::wrapping_add
*const T::wrapping_sub
*mut T::add
*mut T::copy_to_nonoverlapping
*mut T::copy_to
*mut T::read_unaligned
*mut T::read_volatile
*mut T::read
*mut T::replace
*mut T::sub
*mut T::swap
*mut T::wrapping_add
*mut T::wrapping_sub
*mut T::write_bytes
*mut T::write_unaligned
*mut T::write_volatile
*mut T::write
Box::leak
FromUtf8Error::as_bytes
LocalKey::try_with
Option::cloned
btree_map::Entry::and_modify
fs::read_to_string
fs::read
fs::write
hash_map::Entry::and_modify
iter::FusedIterator
ops::RangeInclusive
ops::RangeToInclusive
process::id
slice::rotate_left
slice::rotate_right
String::retain
Cargo
- Cargo will now output path to custom commands when
-v
is passed with--list
- The Cargo binary version is now the same as the Rust version
Misc
Compatibility Notes
- aliasing a
Fn
trait asdyn
no longer works. E.g. the following syntax is now invalid.
use std::ops::Fn as dyn;
fn g(_: Box<dyn(std::fmt::Debug)>) {} - The result of dereferences are no longer promoted to
'static
. e.g.fn main() { const PAIR: &(i32, i32) = &(0, 1); let _reversed_pair: &'static _ = &(PAIR.1, PAIR.0); // Doesn't work }
- Deprecate
AsciiExt
trait in favor of inherent methods. ".e0"
will now no longer parse as0.0
and will instead cause an error.- Removed hoedown from rustdoc.
- Bounds on higher-kinded lifetimes a hard error.