Skip to content

Rust 0.6

Compare
Choose a tag to compare
@rustbot rustbot released this 10 Sep 08:08
· 254810 commits to master since this release
  • ~2100 changes, numerous bugfixes

  • Syntax changes

    • The self type parameter in traits is now spelled Self
    • The self parameter in trait and impl methods must now be explicitly named (for example: fn f(&self) { }). Implicit self is deprecated.
    • Static methods no longer require the static keyword and instead are distinguished by the lack of a self parameter
    • Replaced the Durable trait with the 'static lifetime
    • The old closure type syntax with the trailing sigil has been removed in favor of the more consistent leading sigil
    • super is a keyword, and may be prefixed to paths
    • Trait bounds are separated with + instead of whitespace
    • Traits are implemented with impl Trait for Type instead of impl Type: Trait
    • Lifetime syntax is now &'l foo instead of &l/foo
    • The export keyword has finally been removed
    • The move keyword has been removed (see "Semantic changes")
    • The interior mutability qualifier on vectors, [mut T], has been removed. Use &mut [T], etc.
    • mut is no longer valid in ~mut T. Use inherited mutability
    • fail is no longer a keyword. Use fail!()
    • assert is no longer a keyword. Use assert!()
    • log is no longer a keyword. use debug!, etc.
    • 1-tuples may be represented as (T,)
    • Struct fields may no longer be mut. Use inherited mutability, @mut T, core::mut or core::cell
    • extern mod { ... } is no longer valid syntax for foreign function modules. Use extern blocks: extern { ... }
    • Newtype enums removed. Use tuple-structs.
    • Trait implementations no longer support visibility modifiers
    • Pattern matching over vectors improved and expanded
    • const renamed to static to correspond to lifetime name, and make room for future static mut unsafe mutable globals.
    • Replaced #[deriving_eq] with #[deriving(Eq)], etc.
    • Clone implementations can be automatically generated with #[deriving(Clone)]
    • Casts to traits must use a pointer sigil, e.g. @foo as @Bar instead of foo as Bar.
    • Fixed length vector types are now written as [int, .. 3] instead of [int * 3].
    • Fixed length vector types can express the length as a constant expression. (ex: [int, .. GL_BUFFER_SIZE - 2])
  • Semantic changes

    • Types with owned pointers or custom destructors move by default, eliminating the move keyword
    • All foreign functions are considered unsafe
    • &mut is now unaliasable
    • Writes to borrowed @mut pointers are prevented dynamically
    • () has size 0
    • The name of the main function can be customized using #[main]
    • The default type of an inferred closure is &fn instead of @fn
    • use statements may no longer be "chained" - they cannot import identifiers imported by previous use statements
    • use statements are crate relative, importing from the "top" of the crate by default. Paths may be prefixed with super:: or self:: to change the search behavior.
    • Method visibility is inherited from the implementation declaration
    • Structural records have been removed
    • Many more types can be used in static items, including enums 'static-lifetime pointers and vectors
    • Pattern matching over vectors improved and expanded
    • Typechecking of closure types has been overhauled to improve inference and eliminate unsoundness
    • Macros leave scope at the end of modules, unless that module is tagged with #[macro_escape]
  • Libraries

    • Added big integers to std::bigint
    • Removed core::oldcomm module
    • Added pipe-based core::comm module
    • Numeric traits have been reorganized under core::num
    • vec::slice finally returns a slice
    • debug! and friends don't require a format string, e.g. debug!(Foo)
    • Containers reorganized around traits in core::container
    • core::dvec removed, ~[T] is a drop-in replacement
    • core::send_map renamed to core::hashmap
    • std::map removed; replaced with core::hashmap
    • std::treemap reimplemented as an owned balanced tree
    • std::deque and std::smallintmap reimplemented as owned containers
    • core::trie added as a fast ordered map for integer keys
    • Set types added to core::hashmap, core::trie and std::treemap
    • Ord split into Ord and TotalOrd. Ord is still used to overload the comparison operators, whereas TotalOrd is used by certain container types
  • Other

    • Replaced the 'cargo' package manager with 'rustpkg'
    • Added all-purpose 'rust' tool
    • rustc --test now supports benchmarks with the #[bench] attribute
    • rustc now attempts to offer spelling suggestions
    • Improved support for ARM and Android
    • Preliminary MIPS backend
    • Improved foreign function ABI implementation for x86, x86_64
    • Various memory usage improvements
    • Rust code may be embedded in foreign code under limited circumstances
    • Inline assembler supported by new asm!() syntax extension.