-
~2400 changes, numerous bugfixes
-
Highlights
- The language itself is considered feature complete for 1.0, though there will be many usability improvements and bugfixes before the final release.
- Nearly 50% of the public API surface of the standard library has been declared 'stable'. Those interfaces are unlikely to change before 1.0.
- The long-running debate over integer types has been settled: Rust will ship with types named
isize
andusize
, rather thanint
anduint
, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle. - Most crates that are not
std
have been moved out of the Rust distribution into the Cargo ecosystem so they can evolve separately and don't need to be stabilized as quickly, including 'time', 'getopts', 'num', 'regex', and 'term'. - Documentation continues to be expanded with more API coverage, more examples, and more in-depth explanations. The guides have been consolidated into The Rust Programming Language.
- "Rust By Example" is now maintained by the Rust team.
- All official Rust binary installers now come with Cargo, the Rust package manager.
-
Language
- Closures have been completely redesigned to be implemented in terms of traits, can now be used as generic type bounds and thus monomorphized and inlined, or via an opaque pointer (boxed) as in the old system. The new system is often referred to as 'unboxed' closures.
- Traits now support associated types, allowing families of related types to be defined together and used generically in powerful ways.
- Enum variants are namespaced by their type names.
where
clauses provide a more versatile and attractive syntax for specifying generic bounds, though the previous syntax remains valid.- Rust again picks a fallback (either i32 or f64) for uninferred numeric types.
- Rust no longer has a runtime of any description, and only supports OS threads, not green threads.
- At long last, Rust has been overhauled for 'dynamically-sized types' (DST), which integrates 'fat pointers' (object types, arrays, and
str
) more deeply into the type system, making it more consistent. - Rust now has a general range syntax,
i..j
,i..
, and..j
that produce range types and which, when combined with theIndex
operator and multidispatch, leads to a convenient slice notation,[i..j]
. - The new range syntax revealed an ambiguity in the fixed-length array syntax, so now fixed length arrays are written
[T; N]
. - The
Copy
trait is no longer implemented automatically. Unsafe pointers no longer implementSync
andSend
so types containing them don't automatically either.Sync
andSend
are now 'unsafe traits' so one can "forcibly" implement them viaunsafe impl
if a type confirms to the requirements for them even though the internals do not (e.g. structs containing unsafe pointers likeArc
). These changes are intended to prevent some footguns and are collectively known as opt-in built-in traits (thoughSync
andSend
will soon become pure library types unknown to the compiler). - Operator traits now take their operands by value, and comparison traits can use multidispatch to compare one type against multiple other types, allowing e.g.
String
to be compared with&str
. if let
andwhile let
are no longer feature-gated.- Rust has adopted a more uniform syntax for escaping unicode characters.
macro_rules!
has been declared stable. Though it is a flawed system it is sufficiently popular that it must be usable for 1.0. Effort has gone into future-proofing it in ways that will allow other macro systems to be developed in parallel, and won't otherwise impact the evolution of the language.- The prelude has been pared back significantly such that it is the minimum necessary to support the most pervasive code patterns, and through generalized where clauses many of the prelude extension traits have been consolidated.
- Rust's rudimentary reflection has been removed, as it incurred too much code generation for little benefit.
- Struct variants are no longer feature-gated.
- Trait bounds can be polymorphic over lifetimes. Also known as 'higher-ranked trait bounds', this crucially allows unboxed closures to work.
- Macros invocations surrounded by parens or square brackets and not terminated by a semicolon are parsed as expressions, which makes expressions like
vec![1i32, 2, 3].len()
work as expected. - Trait objects now implement their traits automatically, and traits that can be coerced to objects now must be object safe.
- Automatically deriving traits is now done with
#[derive(...)]
not#[deriving(...)]
for consistency with other naming conventions. - Importing the containing module or enum at the same time as items or variants they contain is now done with
self
instead ofmod
, as in usefoo::{self, bar}
- Glob imports are no longer feature-gated.
- The
box
operator andbox
patterns have been feature-gated pending a redesign. For now unique boxes should be allocated like other containers, withBox::new
.
-
Libraries
- A series of efforts to establish conventions for collections types has resulted in API improvements throughout the standard library.
- New APIs for error handling provide ergonomic interop between error types, and new conventions describe more clearly the recommended error handling strategies in Rust.
- The
fail!
macro has been renamed topanic!
so that it is easier to discuss failure in the context of error handling without making clarifications as to whether you are referring to the 'fail' macro or failure more generally. - On Linux,
OsRng
prefers the new, more reliablegetrandom
syscall when available. - The 'serialize' crate has been renamed 'rustc-serialize' and moved out of the distribution to Cargo. Although it is widely used now, it is expected to be superseded in the near future.
- The
Show
formatter, typically implemented with#[derive(Show)]
is now requested with the{:?}
specifier and is intended for use by all types, for uses such asprintln!
debugging. The newString
formatter must be implemented by hand, uses the{}
specifier, and is intended for full-fidelity conversions of things that can logically be represented as strings.
-
Tooling
- Flexible target specification allows rustc's code generation to be configured to support otherwise-unsupported platforms.
- Rust comes with rust-gdb and rust-lldb scripts that launch their respective debuggers with Rust-appropriate pretty-printing.
- The Windows installation of Rust is distributed with the MinGW components currently required to link binaries on that platform.
-
Misc
- Nullable enum optimizations have been extended to more types so that e.g.
Option<Vec<T>>
andOption<String>
take up no more space than the inner types themselves. - Work has begun on supporting AArch64.
- Nullable enum optimizations have been extended to more types so that e.g.