Rust 0.4
-
~2000 changes, numerous bugfixes
-
Syntax
- All keywords are now strict and may not be used as identifiers anywhere
- Keyword removal: 'again', 'import', 'check', 'new', 'owned', 'send', 'of', 'with', 'to', 'class'.
- Classes are replaced with simpler structs
- Explicit method self types
ret
becamereturn
andalt
becamematch
import
is nowuse
;use is now
extern mod`extern mod { ... }
is nowextern { ... }
use mod
is the recommended way to import modulespub
andpriv
replace deprecated export lists- The syntax of
match
pattern arms now uses fat arrow (=>) main
no longer accepts an args vector; useos::args
instead
-
Semantics
- Trait implementations are now coherent, ala Haskell typeclasses
- Trait methods may be static
- Argument modes are deprecated
- Borrowed pointers are much more mature and recommended for use
- Strings and vectors in the static region are stored in constant memory
- Typestate was removed
- Resolution rewritten to be more reliable
- Support for 'dual-mode' data structures (freezing and thawing)
-
Libraries
- Most binary operators can now be overloaded via the traits in `core::ops'
std::net::url
for representing URLs- Sendable hash maps in
core::send_map
- `core::task' gained a (currently unsafe) task-local storage API
-
Concurrency
- An efficient new intertask communication primitive called the pipe, along with a number of higher-level channel types, in
core::pipes
std::arc
, an atomically reference counted, immutable, shared memory typestd::sync
, various exotic synchronization tools based on arcs and pipes- Futures are now based on pipes and sendable
- More robust linked task failure
- Improved task builder API
- An efficient new intertask communication primitive called the pipe, along with a number of higher-level channel types, in
-
Other
- Improved error reporting
- Preliminary JIT support
- Preliminary work on precise GC
- Extensive architectural improvements to rustc
- Begun a transition away from buggy C++-based reflection (shape) code to Rust-based (visitor) code
- All hash functions and tables converted to secure, randomized SipHash