Rust 1.0.0
Released on May 15, 2015
What's Changed
- Several [restrictions have been added to trait coherence][coh] in
- Digits of binary and octal literals are [lexed more eagerly][lex] to
- Trait bounds [are always invariant][inv], eliminating the need for
- ["-" is no longer a valid character in crate names][cr], the `extern crate
- [Lifetime shadowing is an error][lt].
- [
Sendno longer implies'static][send-rfc]. - [UFCS now supports trait-less associated paths][moar-ufcs] like
- Primitive types [now have inherent methods][prim-inherent],
- Methods with
Self: Sizedin theirwhereclause are [considered - You can now [refer to associated types][assoc-where] whose
- The final bits of [OIBIT landed][oibit-final], meaning that traits
- A [Reflect trait][reflect] was introduced, which means that
- The
unsafe_destructorfeature is now deprecated in favor of the
- The
thread_localmodule [has been renamed tostd::thread][th]. - The methods of
IteratorExt[have been moved to theIterator - Several traits that implement Rust's conventions for type
- The
FromErrortrait [was removed in favor ofFrom][fe]. - The basic sleep function [has moved to
- The
splitnfunction now takes annparameter that represents the - [On Unix, all file descriptors are
CLOEXECby default][clo]. - [Derived implementations of
PartialOrdnow order enums according - [Methods for searching strings are generic over
Patterns][pat], - [In method resolution, object methods are resolved before inherent
- [
String::from_strhas been deprecated in favor of theFromimpl, - [
io::ErrorimplementsSync][ios]. - [The
wordsmethod on&strhas been replaced with - The new path and IO modules are complete and
#[stable]. This - The path API was [revised][path-normalize] to normalize
., - A large number of remaining APIs in
stdwere also stabilized - The new [string pattern API][string-pattern] landed, which makes
- A new set of [generic conversion traits][conversion] replaced
- Generic numeric traits were [completely removed][num-traits]. This
- The
Fntraits are now related via [inheritance][fn-inherit] - The
IndexandIndexMuttraits were changed to Copynow [inherits][copy-clone] fromClone, meaning that all
- The vast majority of the standard library is now
#[stable]. It is - Many popular crates on [crates.io] now work on the stable release
- Arithmetic on basic integer types now [checks for overflow in debug
- Many errors now have extended explanations that can be accessed with
- Many new examples have been added to the standard library
- rustdoc has received a number of improvements focused on completion
- Metadata was tuned, shrinking binaries [by 27%][metadata-shrink].
- Much headway was made on ecosystem-wide CI, making it possible
Full Changelog
* ~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][overflow].
Language
--------
* Several [restrictions have been added to trait coherence][coh] 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][lex] to
improve error messages and macro behavior. For example, 0b1234 is
now lexed as 0b1234 instead of two tokens, 0b1 and 234.
* Trait bounds [are always invariant][inv], eliminating the need for
the PhantomFn and MarkerTrait lang items, which have been
removed.
* ["-" is no longer a valid character in crate names][cr], the extern crate
"foo" as bar syntax has been replaced with extern crate foo as
bar, and Cargo now automatically translates "-" in package names
to underscore for the crate name.
* [Lifetime shadowing is an error][lt].
* [Send no longer implies 'static][send-rfc].
* [UFCS now supports trait-less associated paths][moar-ufcs] like
MyType::default().
* Primitive types [now have inherent methods][prim-inherent],
obviating the need for extension traits like SliceExt.
* Methods with Self: Sized in their where clause are [considered
object-safe][self-sized], allowing many extension traits like
IteratorExt to be merged into the traits they extended.
* You can now [refer to associated types][assoc-where] whose
corresponding trait bounds appear only in a where clause.
* The final bits of [OIBIT landed][oibit-final], meaning that traits
like Send and Sync are now library-defined.
* A [Reflect trait][reflect] 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
[new dropck][rfc769]. This change is a major reduction in unsafe
code.
Libraries
---------
* The thread_local module [has been renamed to std::thread][th].
* The methods of IteratorExt [have been moved to the Iterator
trait itself][23300].
* Several traits that implement Rust's conventions for type
conversions, AsMut, AsRef, From, and Into have been
[centralized in the std::convert module][con].
* The FromError trait [was removed in favor of From][fe].
* The basic sleep function [has moved to
std::thread::sleep_ms][slp].
* The splitn function now takes an n parameter that represents the
number of items yielded by the returned iterator [instead of the
number of 'splits'][spl].
* [On Unix, all file descriptors are CLOEXEC by default][clo].
* [Derived implementations of PartialOrd now order enums according
to their explicitly-assigned discriminants][po].
* [Methods for searching strings are generic over Patterns][pat],
implemented presently by &char, &str, FnMut(char) -> bool and
some others.
* [In method resolution, object methods are resolved before inherent
methods][meth].
* [String::from_str has been deprecated in favor of the From impl,
String::from][24517].
* [io::Error implements Sync][ios].
* [The words method on &str has been replaced with
split_whitespace][sw], 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][path-normalize] 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][string-pattern] landed, which makes
the string slice API much more internally consistent and flexible.
* A new set of [generic conversion traits][conversion] replaced
many existing ad hoc traits.
* Generic numeric traits were [completely removed][num-traits]. 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][fn-inherit]
and provide ergonomic [blanket implementations][fn-blanket].
* The Index and IndexMut traits were changed to
[take the index by value][index-value], enabling code like
hash_map["string"] to work.
* Copy now [inherits][copy-clone] from Clone, meaning that all
Copy data is known to be Clone as well.
Misc
----
* Many errors now have extended explanations that can be accessed with
the --explain flag to rustc.
* 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%][metadata-shrink].
* Much headway was made on ecosystem-wide CI, making it possible
to [compare builds for breakage][ci-compare].
[crates.io]: http://crates.io
[clo]: https://github.com/rust-lang/rust/pull/24034
[coh]: https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md
[con]: https://github.com/rust-lang/rust/pull/23875
[cr]: https://github.com/rust-lang/rust/pull/23419
[fe]: https://github.com/rust-lang/rust/pull/23879
[23300]: https://github.com/rust-lang/rust/pull/23300
[inv]: https://github.com/rust-lang/rust/pull/23938
[ios]: https://github.com/rust-lang/rust/pull/24133
[lex]: https://github.com/rust-lang/rfcs/blob/master/text/0879-small-base-lexing.md
[lt]: https://github.com/rust-lang/rust/pull/24057
[meth]: https://github.com/rust-lang/rust/pull/24056
[pat]: https://github.com/rust-lang/rfcs/blob/master/text/0528-string-patterns.md
[po]: https://github.com/rust-lang/rust/pull/24270
[24517]: https://github.com/rust-lang/rust/pull/24517
[slp]: https://github.com/rust-lang/rust/pull/23949
[spl]: https://github.com/rust-lang/rfcs/blob/master/text/0979-align-splitn-with-other-languages.md
[sw]: https://github.com/rust-lang/rfcs/blob/master/text/1054-str-words.md
[th]: https://github.com/rust-lang/rfcs/blob/master/text/0909-move-thread-local-to-std-thread.md
[send-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0458-send-improvements.md
[moar-ufcs]: https://github.com/rust-lang/rust/pull/22172
[prim-inherent]: https://github.com/rust-lang/rust/pull/23104
[overflow]: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md
[metadata-shrink]: https://github.com/rust-lang/rust/pull/22971
[self-sized]: https://github.com/rust-lang/rust/pull/22301
[assoc-where]: https://github.com/rust-lang/rust/pull/22512
[string-pattern]: https://github.com/rust-lang/rust/pull/22466
[oibit-final]: https://github.com/rust-lang/rust/pull/21689
[reflect]: https://github.com/rust-lang/rust/pull/23712
[conversion]: https://github.com/rust-lang/rfcs/pull/529
[num-traits]: https://github.com/rust-lang/rust/pull/23549
[index-value]: https://github.com/rust-lang/rust/pull/23601
[rfc769]: https://github.com/rust-lang/rfcs/pull/769
[ci-compare]: https://gist.github.com/brson/a30a77836fbec057cbee
[fn-inherit]: https://github.com/rust-lang/rust/pull/23282
[fn-blanket]: https://github.com/rust-lang/rust/pull/23895
[copy-clone]: https://github.com/rust-lang/rust/pull/23860
[path-normalize]: https://github.com/rust-lang/rust/pull/23229