Rust 1.0.0-alpha.2
rustbot
released this
10 Sep 08:08
·
235113 commits
to master
since this release
-
~1300 changes, numerous bugfixes
-
Highlights
- The various I/O modules were overhauled to reduce unnecessary abstractions and provide better interoperation with the underlying platform. The old
io
module remains temporarily atstd::old_io
. - The standard library now participates in feature gating, so use of unstable libraries now requires a
#![feature(...)]
attribute. The impact of this change is described on the forum. RFC.
- The various I/O modules were overhauled to reduce unnecessary abstractions and provide better interoperation with the underlying platform. The old
-
Language
for
loops now operate on theIntoIterator
trait, which eliminates the need to call.iter()
, etc. to iterate over collections. There are some new subtleties to remember though regarding what sort of iterators various types yield, in particular thatfor foo in bar { }
yields values from a move iterator, destroying the original collection. RFC.- Objects now have default lifetime bounds, so you don't have to write
Box<Trait+'static>
when you don't care about storing references. RFC. - In types that implement
Drop
, lifetimes must outlive the value. This will soon make it possible to safely implementDrop
for types where#[unsafe_destructor]
is now required. Read the gorgeous RFC for details. - The fully qualified ::X syntax lets you set the Self type for a trait method or associated type. RFC.
- References to types that implement
Deref<U>
now automatically coerce to references to the dereferenced typeU
, e.g.&T where T: Deref<U>
automatically coerces to&U
. This should eliminate many unsightly uses of&*
, as when converting from references to vectors into references to slices. RFC. - The explicit closure kind syntax (
|&:|
,|&mut:|
,|:|
) is obsolete and closure kind is inferred from context. Self
is a keyword.
-
Libraries
- The
Show
andString
formatting traits have been renamed toDebug
andDisplay
to more clearly reflect their related purposes. Automatically getting a string conversion to use withformat!("{:?}", something_to_debug)
is now written#[derive(Debug)]
. - Abstract OS-specific string types,
std::ff::{OsString, OsStr}
, provide strings in platform-specific encodings for easier interop with system APIs. RFC. - The
boxed::into_raw
andBox::from_raw
functions convert betweenBox<T>
and*mut T
, a common pattern for creating raw pointers.
- The
-
Tooling
- Certain long error messages of the form 'expected foo found bar' are now split neatly across multiple lines. Examples in the PR.
- On Unix Rust can be uninstalled by running
/usr/local/lib/rustlib/uninstall.sh
. - The
#[rustc_on_unimplemented]
attribute, requiring the 'on_unimplemented' feature, lets rustc display custom error messages when a trait is expected to be implemented for a type but is not.
-
Misc
- Rust is tested against a LALR grammar, which parses almost all the Rust files that rustc does.