Rust 1.34.0
Language
- You can now use
#[deprecated = "reason"]
as a shorthand for#[deprecated(note = "reason")]
. This was previously allowed by mistake but had no effect. - You can now accept token streams in
#[attr()]
,#[attr[]]
, and#[attr{}]
procedural macros. - You can now write
extern crate self as foo;
to import your crate's root into the extern prelude.
Compiler
- You can now target
riscv64imac-unknown-none-elf
andriscv64gc-unknown-none-elf
. - You can now enable linker plugin LTO optimisations with
-C linker-plugin-lto
. This allows rustc to compile your Rust code into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI boundaries. - You can now target
powerpc64-unknown-freebsd
.
Libraries
- The trait bounds have been removed on some of
HashMap<K, V, S>
's andHashSet<T, S>
's basic methods. Most notably you no longer require theHash
trait to create an iterator. - The
Ord
trait bounds have been removed on some ofBinaryHeap<T>
's basic methods. Most notably you no longer require theOrd
trait to create an iterator. - The methods
overflowing_neg
andwrapping_neg
are nowconst
functions for all numeric types. - Indexing a
str
is now generic over all types that implementSliceIndex<str>
. str::trim
,str::trim_matches
,str::trim_{start, end}
, andstr::trim_{start, end}_matches
are now#[must_use]
and will produce a warning if their returning type is unused.- The methods
checked_pow
,saturating_pow
,wrapping_pow
, andoverflowing_pow
are now available for all numeric types. These are equivalent to methods such aswrapping_add
for thepow
operation.
Stabilized APIs
std & core
Any::type_id
Error::type_id
atomic::AtomicI16
atomic::AtomicI32
atomic::AtomicI64
atomic::AtomicI8
atomic::AtomicU16
atomic::AtomicU32
atomic::AtomicU64
atomic::AtomicU8
convert::Infallible
convert::TryFrom
convert::TryInto
iter::from_fn
iter::successors
num::NonZeroI128
num::NonZeroI16
num::NonZeroI32
num::NonZeroI64
num::NonZeroI8
num::NonZeroIsize
slice::sort_by_cached_key
str::escape_debug
str::escape_default
str::escape_unicode
str::split_ascii_whitespace
std
Cargo
Misc
Compatibility Notes
Command::before_exec
is being replaced by the unsafe methodCommand::pre_exec
and will be deprecated with Rust 1.37.0.- Use of
ATOMIC_{BOOL, ISIZE, USIZE}_INIT
is now deprecated as you can now useconst
functions instatic
variables.