- ~1500 changes, numerous bugfixes
Highlights
- The vast majority of the standard library is now
#[stable]
. It is no longer possible to use unstable features with a stable build of the compiler. - Many popular crates on crates.io now work on the stable release channel.
- Arithmetic on basic integer types now checks for overflow in debug builds.
Language
- Several restrictions have been added to trait coherence in order to make it easier for upstream authors to change traits without breaking downstream code.
- Digits of binary and octal literals are lexed more eagerly to improve error messages and macro behavior. For example,
0b1234
is now lexed as0b1234
instead of two tokens,0b1
and234
. - Trait bounds are always invariant, eliminating the need for the
PhantomFn
andMarkerTrait
lang items, which have been removed. - "-" is no longer a valid character in crate names, the
extern crate "foo" as bar
syntax has been replaced withextern crate foo as bar
, and Cargo now automatically translates "-" in package names to underscore for the crate name. - Lifetime shadowing is an error.
Send
no longer implies'static
.- UFCS now supports trait-less associated paths like
MyType::default()
. - Primitive types now have inherent methods, obviating the need for extension traits like
SliceExt
. - Methods with
Self: Sized
in theirwhere
clause are considered object-safe, allowing many extension traits likeIteratorExt
to be merged into the traits they extended. - You can now refer to associated types whose corresponding trait bounds appear only in a
where
clause. - The final bits of OIBIT landed, meaning that traits like
Send
andSync
are now library-defined. - A Reflect trait was introduced, which means that downcasting via the
Any
trait is effectively limited to concrete types. This helps retain the potentially-important "parametricity" property: generic code cannot behave differently for different type arguments except in minor ways. - The
unsafe_destructor
feature is now deprecated in favor of the newdropck
. This change is a major reduction in unsafe code.
Libraries
- The
thread_local
module has been renamed tostd::thread
. - The methods of
IteratorExt
have been moved to theIterator
trait itself. - Several traits that implement Rust's conventions for type conversions,
AsMut
,AsRef
,From
, andInto
have been centralized in thestd::convert
module. - The
FromError
trait was removed in favor ofFrom
. - The basic sleep function has moved to
std::thread::sleep_ms
. - The
splitn
function now takes ann
parameter that represents the number of items yielded by the returned iterator instead of the number of 'splits'. - On Unix, all file descriptors are
CLOEXEC
by default. - Derived implementations of
PartialOrd
now order enums according to their explicitly-assigned discriminants. - Methods for searching strings are generic over
Pattern
s, implemented presently by&char
,&str
,FnMut(char) -> bool
and some others. - In method resolution, object methods are resolved before inherent methods.
String::from_str
has been deprecated in favor of theFrom
impl,String::from
.io::Error
implementsSync
.- The
words
method on&str
has been replaced withsplit_whitespace
, to avoid answering the tricky question, 'what is a word?' - The new path and IO modules are complete and
#[stable]
. This was the major library focus for this cycle. - The path API was revised to normalize
.
, adjusting the tradeoffs in favor of the most common usage. - A large number of remaining APIs in
std
were also stabilized during this cycle; about 75% of the non-deprecated API surface is now stable. - The new string pattern API landed, which makes the string slice API much more internally consistent and flexible.
- A new set of generic conversion traits replaced many existing ad hoc traits.
- Generic numeric traits were completely removed. This was made possible thanks to inherent methods for primitive types, and the removal gives maximal flexibility for designing a numeric hierarchy in the future.
- The
Fn
traits are now related via inheritance and provide ergonomic blanket implementations. - The
Index
andIndexMut
traits were changed to take the index by value, enabling code likehash_map["string"]
to work. Copy
now inherits fromClone
, meaning that allCopy
data is known to beClone
as well.
Misc
- Many errors now have extended explanations that can be accessed with the
--explain
flag torustc
. - Many new examples have been added to the standard library documentation.
- rustdoc has received a number of improvements focused on completion and polish.
- Metadata was tuned, shrinking binaries by 27%.
- Much headway was made on ecosystem-wide CI, making it possible to compare builds for breakage.