Skip to content

Rust 1.0.0-alpha.2

Compare
Choose a tag to compare
@rustbot 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 at std::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.
  • Language

    • for loops now operate on the IntoIterator 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 that for 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 implement Drop 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 type U, 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 and String formatting traits have been renamed to Debug and Display to more clearly reflect their related purposes. Automatically getting a string conversion to use with format!("{:?}", 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 and Box::from_raw functions convert between Box<T> and *mut T, a common pattern for creating raw pointers.
  • Tooling

  • Misc

    • Rust is tested against a LALR grammar, which parses almost all the Rust files that rustc does.