Version 0.6 (2013-04-03)
-
~2100 changes, numerous bugfixes
-
Syntax changes
- The self type parameter in traits is now spelled
Self - The
selfparameter 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
statickeyword and instead are distinguished by the lack of aselfparameter - Replaced the
Durabletrait with the'staticlifetime - The old closure type syntax with the trailing sigil has been removed in favor of the more consistent leading sigil
superis a keyword, and may be prefixed to paths- Trait bounds are separated with
+instead of whitespace - Traits are implemented with
impl Trait for Typeinstead ofimpl Type: Trait - Lifetime syntax is now
&'l fooinstead of&l/foo - The
exportkeyword has finally been removed - The
movekeyword has been removed (see "Semantic changes") - The interior mutability qualifier on vectors,
[mut T], has been removed. Use&mut [T], etc. mutis no longer valid in~mut T. Use inherited mutabilityfailis no longer a keyword. Usefail!()assertis no longer a keyword. Useassert!()logis no longer a keyword. usedebug!, etc.- 1-tuples may be represented as
(T,) - Struct fields may no longer be
mut. Use inherited mutability,@mut T,core::mutorcore::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
constrenamed tostaticto correspond to lifetime name, and make room for futurestatic mutunsafe mutable globals.- Replaced
#[deriving_eq]with#[deriving(Eq)], etc. Cloneimplementations can be automatically generated with#[deriving(Clone)]- Casts to traits must use a pointer sigil, e.g.
@foo as @Barinstead offoo 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])
- The self type parameter in traits is now spelled
-
Semantic changes
- Types with owned pointers or custom destructors move by default,
eliminating the
movekeyword - 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
usestatements may no longer be "chained" - they cannot import identifiers imported by previoususestatementsusestatements are crate relative, importing from the "top" of the crate by default. Paths may be prefixed withsuper::orself::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]
- Types with owned pointers or custom destructors move by default,
eliminating the
-
Libraries
- Added big integers to
std::bigint - Removed
core::oldcommmodule - Added pipe-based
core::commmodule - Numeric traits have been reorganized under
core::num vec::slicefinally returns a slicedebug!and friends don't require a format string, e.g.debug!(Foo)- Containers reorganized around traits in
core::container core::dvecremoved,~[T]is a drop-in replacementcore::send_maprenamed tocore::hashmapstd::mapremoved; replaced withcore::hashmapstd::treemapreimplemented as an owned balanced treestd::dequeandstd::smallintmapreimplemented as owned containerscore::trieadded as a fast ordered map for integer keys- Set types added to
core::hashmap,core::trieandstd::treemap Ordsplit intoOrdandTotalOrd.Ordis still used to overload the comparison operators, whereasTotalOrdis used by certain container types
- Added big integers to
-
Other
- Replaced the 'cargo' package manager with 'rustpkg'
- Added all-purpose 'rust' tool
rustc --testnow 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.