Path
Path::strip_prefix
(renamed from relative_from)path::StripPrefixError
(new error type returned from strip_prefix)Ipv4Addr
Ipv6Addr
Vec
String
<[T]>::
clone_from_slice
, which now requires the two slices to be the same length<[T]>::
sort_by_key
i32::checked_rem
, i32::checked_neg
, i32::checked_shl
, i32::checked_shr
i32::saturating_mul
i32::overflowing_add
, i32::overflowing_sub
, i32::overflowing_mul
, i32::overflowing_div
i32::overflowing_rem
, i32::overflowing_neg
, i32::overflowing_shl
, i32::overflowing_shr
u32::checked_rem
, u32::checked_neg
, u32::checked_shl
, u32::checked_shl
u32::saturating_mul
u32::overflowing_add
, u32::overflowing_sub
, u32::overflowing_mul
, u32::overflowing_div
u32::overflowing_rem
, u32::overflowing_neg
, u32::overflowing_shl
, u32::overflowing_shr
ffi::IntoStringError
CString::into_string
CString::into_bytes
CString::into_bytes_with_nul
From<CString> for Vec<u8>
IntoStringError
IntoStringError::into_cstring
IntoStringError::utf8_error
Error for IntoStringError
String
s and str
s from bytes is faster.LineWriter
(and thus io::stdout
) was improved by using memchr
to search for newlines.f32::to_degrees
and f32::to_radians
are stable. The f64
variants were stabilized previously.BTreeMap
was rewritten to use less memory and improve the performance of insertion and iteration, the latter by as much as 5x.BTreeSet
and its iterators, Iter
, IntoIter
, and Range
are covariant over their contained type.LinkedList
and its iterators, Iter
and IntoIter
are covariant over their contained type.str::replace
now accepts a Pattern
, like other string searching methods.Any
is implemented for unsized types.Hash
is implemented for Duration
.--test
, rustdoc will pass --cfg
arguments to the compiler.rustc
when installed in unusual configurations without configuring the dynamic linker search path explicitly.rustc
passes --enable-new-dtags
to GNU ld. This makes any RPATH entries (emitted with -C rpath
) not take precedence over LD_LIBRARY_PATH
.cargo rustc
accepts a --profile
flag that runs rustc
under any of the compilation profiles, ‘dev’, ‘bench’, or ‘test’.rerun-if-changed
build script directive no longer causes the build script to incorrectly run twice in certain scenarios.private_in_public
lint.".".parse::<f32>()
returns Err
, not Ok(0)
.#![no_std]
attribute causes a crate to not be linked to the standard library, but only the core library, as described in RFC 1184. The core library defines common types and traits but has no platform dependencies whatsoever, and is the basis for Rust software in environments that cannot support a full port of the standard library, such as operating systems. Most of the core library is now stable.Read::read_exact
, ErrorKind::UnexpectedEof
(renamed from UnexpectedEOF
), fs::DirBuilder
, fs::DirBuilder::new
, fs::DirBuilder::recursive
, fs::DirBuilder::create
, os::unix::fs::DirBuilderExt
, os::unix::fs::DirBuilderExt::mode
, vec::Drain
, vec::Vec::drain
, string::Drain
, string::String::drain
, vec_deque::Drain
, vec_deque::VecDeque::drain
, collections::hash_map::Drain
, collections::hash_map::HashMap::drain
, collections::hash_set::Drain
, collections::hash_set::HashSet::drain
, collections::binary_heap::Drain
, collections::binary_heap::BinaryHeap::drain
, Vec::extend_from_slice
(renamed from push_all
), Mutex::get_mut
, Mutex::into_inner
, RwLock::get_mut
, RwLock::into_inner
, Iterator::min_by_key
(renamed from min_by
), Iterator::max_by_key
(renamed from max_by
).assert_eq!
macro supports arguments that don't implement Sized
, such as arrays. In this way it behaves more like assert!
.Duration
. These include Condvar::wait_timeout_ms
, thread::sleep_ms
, and thread::park_timeout_ms
.Vec
reserves additional elements was tweaked to not allocate excessive space while still growing exponentially.From
conversions are implemented from integers to floats in cases where the conversion is lossless. Thus they are not implemented for 32-bit ints to f32
, nor for 64-bit ints to f32
or f64
. They are also not implemented for isize
and usize
because the implementations would be platform-specific. From
is also implemented from f32
to f64
.From<&Path>
and From<PathBuf>
are implemented for Cow<Path>
.From<T>
is implemented for Box<T>
, Rc<T>
and Arc<T>
.IntoIterator
is implemented for &PathBuf
and &Path
.BinaryHeap
was refactored for modest performance improvements.$CARGO_HOME/bin
for subcommands by default.rerun-if-changed
key.cargo clean
accepts a --release
flag to clean the release folder. A variety of artifacts that Cargo failed to clean are now correctly deleted.unreachable_code
lint warns when a function call's argument diverges.RUST_PATH
environment variable when locating crates. This was a pre-cargo feature for integrating with the package manager that was accidentally never removed.Foo(..)
) can no longer be used to match unit structs. This is a warning now, but will become an error in future releases. Patterns that share the same name as a const are now an error.BinaryHeap::from
, BinaryHeap::into_sorted_vec
, BinaryHeap::into_vec
, Condvar::wait_timeout
, FileTypeExt::is_block_device
, FileTypeExt::is_char_device
, FileTypeExt::is_fifo
, FileTypeExt::is_socket
, FileTypeExt
, Formatter::alternate
, Formatter::fill
, Formatter::precision
, Formatter::sign_aware_zero_pad
, Formatter::sign_minus
, Formatter::sign_plus
, Formatter::width
, Iterator::cmp
, Iterator::eq
, Iterator::ge
, Iterator::gt
, Iterator::le
, Iterator::lt
, Iterator::ne
, Iterator::partial_cmp
, Path::canonicalize
, Path::exists
, Path::is_dir
, Path::is_file
, Path::metadata
, Path::read_dir
, Path::read_link
, Path::symlink_metadata
, Utf8Error::valid_up_to
, Vec::resize
, VecDeque::as_mut_slices
, VecDeque::as_slices
, VecDeque::insert
, VecDeque::shrink_to_fit
, VecDeque::swap_remove_back
, VecDeque::swap_remove_front
, slice::split_first_mut
, slice::split_first
, slice::split_last_mut
, slice::split_last
, char::from_u32_unchecked
, fs::canonicalize
, str::MatchIndices
, str::RMatchIndices
, str::match_indices
, str::rmatch_indices
, str::slice_mut_unchecked
, string::ParseError
.~/.cargo/bin
with the cargo install
command. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g. cargo-foo
is found in $PATH
it can be invoked as cargo foo
.*
) dependencies will emit warnings when published. In 1.6 it will no longer be possible to publish crates with wildcard dependencies.AsRef
and AsMut
were added to Box
, Rc
, and Arc
. Because these smart pointer types implement Deref
, this causes breakage in cases where the interior type contains methods of the same name.Self
are not object safe. Soundness fix.no_default_libraries
setting that controls whether -nodefaultlibs
is passed to the linker, and in turn the is_like_windows
setting no longer affects the -nodefaultlibs
flag.#[derive(Show)]
, long-deprecated, has been removed.#[inline]
and #[repr]
attributes can only appear in valid locations.#[no_debug]
and #[omit_gdb_pretty_printer_section]
are feature gated.use
statements to import unstable features.improper_ctypes
lint no longer warns about using isize
and usize
in FFI.Arc<T>
and Rc<T>
are covariant with respect to T
instead of invariant.Default
is implemented for mutable slices.FromStr
is implemented for SockAddrV4
and SockAddrV6
.From
conversions between floating point types where the conversions are lossless.From
conversions between integer types where the conversions are lossless.fs::Metadata
implements Clone
.parse
method accepts a leading “+” when parsing integers.AsMut
is implemented for Vec
.clone_from
implementations for String
and BinaryHeap
have been optimized and no longer rely on the default impl.extern "Rust"
, extern "C"
, unsafe extern "Rust"
and unsafe extern "C"
function types now implement Clone
, PartialEq
, Eq
, PartialOrd
, Ord
, Hash
, fmt::Pointer
, and fmt::Debug
for up to 12 arguments.Vec
s is much faster in unoptimized builds when the element types don't implement Drop
.VecDeque
with zero-sized types was resolved.PartialOrd
for slices is faster.str::lines
and BufRead::lines
iterators treat \r\n
as line breaks in addition to \n
.'static
lifetime extend to the end of a function.str::parse
no longer introduces avoidable rounding error when parsing floating point numbers. Together with earlier changes to float formatting/output, “round trips” like f.to_string().parse() now preserve the value of f exactly. Additionally, leading plus signs are now accepted.use
statements that import multiple items can now rename them, as in use foo::{bar as kitten, baz as puppy}
.pub extern crate
, which does not behave as expected, issues a warning until a better solution is found.<Box<str>>::into_string
, Arc::downgrade
, Arc::get_mut
, Arc::make_mut
, Arc::try_unwrap
, Box::from_raw
, Box::into_raw
, CStr::to_str
, CStr::to_string_lossy
, CString::from_raw
, CString::into_raw
, IntoRawFd::into_raw_fd
, IntoRawFd
, IntoRawHandle::into_raw_handle
, IntoRawHandle
, IntoRawSocket::into_raw_socket
, IntoRawSocket
, Rc::downgrade
, Rc::get_mut
, Rc::make_mut
, Rc::try_unwrap
, Result::expect
, String::into_boxed_str
, TcpStream::read_timeout
, TcpStream::set_read_timeout
, TcpStream::set_write_timeout
, TcpStream::write_timeout
, UdpSocket::read_timeout
, UdpSocket::set_read_timeout
, UdpSocket::set_write_timeout
, UdpSocket::write_timeout
, Vec::append
, Vec::split_off
, VecDeque::append
, VecDeque::retain
, VecDeque::split_off
, rc::Weak::upgrade
, rc::Weak
, slice::Iter::as_slice
, slice::IterMut::into_slice
, str::CharIndices::as_str
, str::Chars::as_str
, str::split_at_mut
, str::split_at
, sync::Weak::upgrade
, sync::Weak
, thread::park_timeout
, thread::sleep
.BTreeMap::with_b
, BTreeSet::with_b
, Option::as_mut_slice
, Option::as_slice
, Result::as_mut_slice
, Result::as_slice
, f32::from_str_radix
, f64::from_str_radix
.std::io::copy
allows ?Sized
arguments.Windows
, Chunks
, and ChunksMut
iterators over slices all override count
, nth
and last
with an O(1) implementation.Default
is implemented for arrays up to [T; 32]
.IntoRawFd
has been added to the Unix-specific prelude, IntoRawSocket
and IntoRawHandle
to the Windows-specific prelude.Extend<String>
and FromIterator<String
are both implemented for String
.IntoIterator
is implemented for references to Option
and Result
.HashMap
and HashSet
implement Extend<&T>
where T: Copy
as part of RFC 839. This will cause type inferance breakage in rare situations.BinaryHeap
implements Debug
.Borrow
and BorrowMut
are implemented for fixed-size arrays.extern fn
s with the “Rust” and “C” ABIs implement common traits including Eq
, Ord
, Debug
, Hash
.&mut T
where T: std::fmt::Write
also implements std::fmt::Write
.VecDeque::push_back
and other capicity-altering methods that caused panics for zero-sized types was fixed.isize
and usize
.cargo update
.&'a Box<Trait>
(or &'a Rc<Trait>
, etc) will change from being interpreted as &'a Box<Trait+'a>
to &'a Box<Trait+'static>
.Duration
API, has been stabilized. This basic unit of timekeeping is employed by other std APIs, as well as out-of-tree time crates.#[prelude_import]
attribute, an internal implementation detail, was accidentally stabilized previously. It has been put behind the prelude_import
feature gate. This change is believed to break no existing code.size_of_val
and align_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is thought to be broken.dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build.size_of_val
and align_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is not known to exist, and suspected to be broken.'static
variables may now be recursive.ref
bindings choose between Deref
and DerefMut
implementations correctly.dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC.Duration
API, has been stabilized, as well as the std::time
module, which presently contains only Duration
.Box<str>
and Box<[T]>
both implement Clone
.CString
, implements Borrow
and the borrowed C string, CStr
, implements ToOwned
. The two of these allow C strings to be borrowed and cloned in generic code.CStr
implements Debug
.AtomicPtr
implements Debug
.Error
trait objects can be downcast to their concrete types in many common configurations, using the is
, downcast
, downcast_ref
and downcast_mut
methods, similarly to the Any
trait.contains
, find
, rfind
, split
. starts_with
and ends_with
are also faster.PartialEq
for slices is much faster.Hash
trait offers the default method, hash_slice
, which is overridden and optimized by the implementations for scalars.Hasher
trait now has a number of specialized write_*
methods for primitive types, for efficiency.std::io::Error
, gained a set of methods for accessing the ‘inner error’, if any: get_ref
, get_mut
, into_inner
. As well, the implementation of std::error::Error::cause
also delegates to the inner error.process::Child
gained the id
method, which returns a u32
representing the platform-specific process identifier.connect
method on slices is deprecated, replaced by the new join
method (note that both of these are on the unstable SliceConcatExt
trait, but through the magic of the prelude are available to stable code anyway).Div
operator is implemented for Wrapping
types.DerefMut
is implemented for String
.HashMap
) is better for long data.AtomicPtr
implements Send
.read_to_end
implementations for Stdin
and File
are now specialized to use uninitalized buffers for increased performance.--explain
flag.dropck
pass, which checks that destructors can't access destroyed values, has been rewritten. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build.rustc
now uses LLVM to write archive files where possible. Eventually this will eliminate the compiler's dependency on the ar utility.unused_mut
, unconditional_recursion
, improper_ctypes
, and negate_unsigned
lints are more strict.-Z no-landing-pads
), panic!
will kill the process instead of leaking.Rc
to contain types without a fixed size, arrays and trait objects, finally enabling use of Rc<[T]>
and completing the implementation of DST.-C codegen-units=N
flag to rustc
.to_uppercase
and to_lowercase
methods on char
now do unicode case mapping, which is a previously-planned change in behavior and considered a bugfix.mem::align_of
now specifies the minimum alignment for T, which is usually the alignment programs are interested in, and the same value reported by clang's alignof
. mem::min_align_of
is deprecated. This is not known to break real code.#[packed]
attribute is no longer silently accepted by the compiler. This attribute did nothing and code that mentioned it likely did not work as intended.associated_type_defaults
feature gate. In 1.1 associated type defaults did not work, but could be mentioned syntactically. As such this breakage has minimal impact.ref mut
now correctly invoke DerefMut
when matching against dereferencable values.Extend
trait, which grows a collection from an iterator, is implemented over iterators of references, for String
, Vec
, LinkedList
, VecDeque
, EnumSet
, BinaryHeap
, VecMap
, BTreeSet
and BTreeMap
. RFC.iter::once
function returns an iterator that yields a single element, and iter::empty
returns an iterator that yields no elements.matches
and rmatches
methods on str
return iterators over substring matches.Cell
and RefCell
both implement Eq
.wrapping_div
, wrapping_rem
, wrapping_neg
, wrapping_shl
, wrapping_shr
. These are in addition to the existing wrapping_add
, wrapping_sub
, and wrapping_mul
methods, and alternatives to the Wrapping
type.. It is illegal for the default arithmetic operations in Rust to overflow; the desire to wrap must be explicit.{:#?}
formatting specifier displays the alternate, pretty-printed form of the Debug
formatter. This feature was actually introduced prior to 1.0 with little fanfare.fmt::Formatter
implements fmt::Write
, a fmt
-specific trait for writing data to formatted strings, similar to io::Write
.fmt::Formatter
adds ‘debug builder’ methods, debug_struct
, debug_tuple
, debug_list
, debug_set
, debug_map
. These are used by code generators to emit implementations of Debug
.str
has new to_uppercase
and to_lowercase
methods that convert case, following Unicode case mapping.PoisonError
type, returned by failing lock operations, exposes into_inner
, get_ref
, and get_mut
, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. The is_poisoned
method of RwLock
and Mutex
can poll for a poisoned lock without attempting to take the lock.FromRawFd
trait is implemented for Stdio
, and AsRawFd
for ChildStdin
, ChildStdout
, ChildStderr
. On Windows the FromRawHandle
trait is implemented for Stdio
, and AsRawHandle
for ChildStdin
, ChildStdout
, ChildStderr
.io::ErrorKind
has a new variant, InvalidData
, which indicates malformed input.rustc
employs smarter heuristics for guessing at typos.rustc
emits more efficient code for no-op conversions between unsafe pointers.std::fs
module has been expanded to expand the set of functionality exposed:DirEntry
now supports optimizations like file_type
and metadata
which don't incur a syscall on some platforms.symlink_metadata
function has been added.fs::Metadata
structure now lowers to its OS counterpart, providing access to all underlying information.--explain
flag to read the explanation. Error explanations are also available online.str::split_whitespace
method splits a string on unicode whitespace boundaries.FromRawFd
and AsRawFd
, on Windows FromRawHandle
and AsRawHandle
. These are implemented for File
, TcpStream
, TcpListener
, and UpdSocket
. Further implementations for std::process
will be stabilized later.std::os::unix::symlink
creates symlinks. On Windows, symlinks can be created with std::os::windows::symlink_dir
and std::os::windows::symlink_file
.mpsc::Receiver
type can now be converted into an iterator with into_iter
on the IntoIterator
trait.Ipv4Addr
can be created from u32
with the From<u32>
implementation of the From
trait.Debug
implementation for RangeFull
creates output that is more consistent with other implementations.Debug
is implemented for File
.Default
implementation for Arc
no longer requires Sync + Send
.Iterator
methods count
, nth
, and last
have been overridden for slices to have O(1) performance instead of O(n).AtomicPtr
gained a Default
implementation.abs
now panics on overflow when debug assertions are enabled.Cloned
iterator, which was accidentally left unstable for 1.0 has been stabilized.Incoming
iterator, which iterates over incoming TCP connections, and which was accidentally unnamable in 1.0, is now properly exported.BinaryHeap
no longer corrupts itself when functions called by sift_up
or sift_down
panic.split_off
method of LinkedList
no longer corrupts the list in certain scenarios.target_env
cfg value, which is used for distinguishing toolchains that are otherwise for the same platform. Presently this is set to gnu
for common GNU Linux targets and for MinGW targets, and musl
for MUSL Linux targets.cargo rustc
command invokes a build with custom flags to rustc.drop_with_repr_extern
lint warns about mixing repr(C)
with Drop
.#[stable]
. It is no longer possible to use unstable features with a stable build of the compiler.0b1234
is now lexed as 0b1234
instead of two tokens, 0b1
and 234
.PhantomFn
and MarkerTrait
lang items, which have been removed.extern crate "foo" as bar
syntax has been replaced with extern crate foo as bar
, and Cargo now automatically translates “-” in package names to underscore for the crate name.Send
no longer implies 'static
.MyType::default()
.SliceExt
.Self: Sized
in their where
clause are considered object-safe, allowing many extension traits like IteratorExt
to be merged into the traits they extended.where
clause.Send
and Sync
are now library-defined.Any
trait is effectively limited to concrete types. This helps retain the potentially-important “parametricity” property: generic code cannot behave differently for different type arguments except in minor ways.unsafe_destructor
feature is now deprecated in favor of the new dropck
. This change is a major reduction in unsafe code.thread_local
module has been renamed to std::thread
.IteratorExt
have been moved to the Iterator
trait itself.AsMut
, AsRef
, From
, and Into
have been centralized in the std::convert
module.FromError
trait was removed in favor of From
.std::thread::sleep_ms
.splitn
function now takes an n
parameter that represents the number of items yielded by the returned iterator instead of the number of ‘splits’.CLOEXEC
by default.PartialOrd
now order enums according to their explicitly-assigned discriminants.Pattern
s, implemented presently by &char
, &str
, FnMut(char) -> bool
and some others.String::from_str
has been deprecated in favor of the From
impl, String::from
.io::Error
implements Sync
.words
method on &str
has been replaced with split_whitespace
, to avoid answering the tricky question, ‘what is a word?’#[stable]
. This was the major library focus for this cycle..
, adjusting the tradeoffs in favor of the most common usage.std
were also stabilized during this cycle; about 75% of the non-deprecated API surface is now stable.Fn
traits are now related via inheritance and provide ergonomic blanket implementations.Index
and IndexMut
traits were changed to take the index by value, enabling code like hash_map["string"]
to work.Copy
now inherits from Clone
, meaning that all Copy
data is known to be Clone
as well.--explain
flag to rustc
.~1300 changes, numerous bugfixes
Highlights
io
module remains temporarily at std::old_io
.#![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.Box<Trait+'static>
when you don’t care about storing references. RFC.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.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.|&:|
, |&mut:|
, |:|
) is obsolete and closure kind is inferred from context.Self
is a keyword.Libraries
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)]
.std::ff::{OsString, OsStr}
, provide strings in platform-specific encodings for easier interop with system APIs. RFC.boxed::into_raw
and Box::from_raw
functions convert between Box<T>
and *mut T
, a common pattern for creating raw pointers.Tooling
/usr/local/lib/rustlib/uninstall.sh
.#[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
~2400 changes, numerous bugfixes
Highlights
isize
and usize
, rather than int
and uint
, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle.std
have been moved out of the Rust distribution into the Cargo ecosystem so they can evolve separately and don't need to be stabilized as quickly, including ‘time’, ‘getopts’, ‘num’, ‘regex’, and ‘term’.Language
where
clauses provide a more versatile and attractive syntax for specifying generic bounds, though the previous syntax remains valid.str
) more deeply into the type system, making it more consistent.i..j
, i..
, and ..j
that produce range types and which, when combined with the Index
operator and multidispatch, leads to a convenient slice notation, [i..j]
.[T; N]
.Copy
trait is no longer implemented automatically. Unsafe pointers no longer implement Sync
and Send
so types containing them don't automatically either. Sync
and Send
are now ‘unsafe traits’ so one can “forcibly” implement them via unsafe impl
if a type confirms to the requirements for them even though the internals do not (e.g. structs containing unsafe pointers like Arc
). These changes are intended to prevent some footguns and are collectively known as opt-in built-in traits (though Sync
and Send
will soon become pure library types unknown to the compiler).String
to be compared with &str
.if let
and while let
are no longer feature-gated.macro_rules!
has been declared stable. Though it is a flawed system it is sufficiently popular that it must be usable for 1.0. Effort has gone into future-proofing it in ways that will allow other macro systems to be developed in parallel, and won't otherwise impact the evolution of the language.vec![1i32, 2, 3].len()
work as expected.#[derive(...)]
not #[deriving(...)]
for consistency with other naming conventions.self
instead of mod
, as in use foo::{self, bar}
box
operator and box
patterns have been feature-gated pending a redesign. For now unique boxes should be allocated like other containers, with Box::new
.Libraries
fail!
macro has been renamed to panic!
so that it is easier to discuss failure in the context of error handling without making clarifications as to whether you are referring to the ‘fail’ macro or failure more generally.OsRng
prefers the new, more reliable getrandom
syscall when available.Show
formatter, typically implemented with #[derive(Show)]
is now requested with the {:?}
specifier and is intended for use by all types, for uses such as println!
debugging. The new String
formatter must be implemented by hand, uses the {}
specifier, and is intended for full-fidelity conversions of things that can logically be represented as strings.Tooling
Misc
Option<Vec<T>>
and Option<String>
take up no more space than the inner types themselves.~1900 changes, numerous bugfixes
Highlights
std
have been reviewed and updated for consistency with the in-development Rust coding guidelines. The standard library documentation tracks stabilization progress.Language
Index
and IndexMut
traits.if let
construct takes a branch only if the let
pattern matches, currently behind the ‘if_let’ feature gate.[0..4]
) has been introduced behind the ‘slicing_syntax’ feature gate, and can be overloaded with the Slice
or SliceMut
traits...
instead of prefix (.e.g. [a, b, c..]
), for consistency with other uses of ..
and to future-proof potential additional uses of the syntax.0..3
to 0...4
to be consistent with the exclusive range syntax for slicing.[a.., b, c]
) has been put behind the ‘advanced_slice_patterns’ feature gate and may be removed in the future.value.0
syntax, currently behind the tuple_indexing
feature gate.#[crate_id]
attribute is no longer supported; versioning is handled by the package manager.extern crate foo as bar
instead of extern crate bar = foo
.use foo as bar
instead of use bar = foo
.let
and match
bindings and argument names in macros are now hygienic.move
has been added as a keyword, for indicating closures that capture by value.Share
trait is now called Sync
to free up the term ‘shared’ to refer to ‘shared reference’ (the default reference type.Sized
trait has been introduced, which qualifying types implement by default, and which type parameters expect by default. To specify that a type parameter does not need to be sized, write <Sized? T>
. Most types are Sized
, notable exceptions being unsized arrays ([T]
) and trait types.!
, as in || -> !
or proc() -> !
.Gc<T>
which was once denoted by the @
sigil, has finally been removed. GC will be revisited in the future.Libraries
std::time::Duration
type has been added for use in I/O methods that rely on timers, as well as in the ‘time’ crate's Timespec
arithmetic.collections::btree
has been rewritten to have a more idiomatic and efficient design.Tooling
--crate-name
flag can specify the name of the crate being compiled, like #[crate_name]
.-C metadata
specifies additional metadata to hash into symbol names, and -C extra-filename
specifies additional information to put into the output filename, for use by the package manager for versioning.-C codegen-units
flag.Misc
~1700 changes, numerous bugfixes
Language
uint
instead of any integral type.b
.<'a>|A, B|: 'b + K -> T
priv
keyword has been removed from the language.use foo, bar, baz;
syntax has been removed from the language.int
, and floating point literals no longer default to f64
. Literals must be suffixed with an appropriate type if inference cannot determine the type of the literal.Libraries
rev()
on their forward-iteration counterparts.--cfg ndebug
is passed to the compiler.Tooling
[breaking-change]
to allow for easy discovery of breaking changes.mod foo;
.pub use
has been greatly improved.~1500 changes, numerous bugfixes
Language
@
-pointers have been removed from the language.~[T]
) have been removed from the language.~str
) have been removed from the language.@str
has been removed from the language.@[T]
has been removed from the language.@self
has been removed from the language.@Trait
has been removed from the language.~
allocations which contain @
boxes inside the type for reference counting have been removed.macro_rules!
macros as well as syntax extensions such as format!
.#[deriving]
with raw pointerslog_syntax!
are now behind feature gates.#[simd]
attribute is now behind a feature gate.extern crate
statements, and unnecessary visibility (priv
) is no longer allowed on use
statements.do
keyword has been removed, it is now a reserved keyword.extern mod
is now extern crate
Freeze
trait has been removed.Share
trait has been added for types that can be shared among threads.{}
now.static mut
locations has been tweaked.*
and .
operators are now overloadable through the Deref
and DerefMut
traits.~Trait
and proc
no longer have Send
bounds by default._
type marker.Unsafe
type was introduced for interior mutability. It is now considered undefined to transmute from &T
to &mut T
without using the Unsafe
type.#[foo];
to #![foo]
.Pod
was renamed to Copy
.Libraries
libextra
library has been removed. It has now been decomposed into component libraries with smaller and more focused nuggets of functionality. The full list of libraries can be found on the documentation index page.std::condition
has been removed. All I/O errors are now propagated through the Result
type. In order to assist with error handling, a try!
macro for unwrapping errors with an early return and a lint for unused results has been added. See #12039 for more information.vec
module has been renamed to slice
.Vec<T>
, has been added in preparation for DST. This will become the only growable vector in the future.std::io
now has more public-reexports. Types such as BufferedReader
are now found at std::io::BufferedReader
instead of std::io::buffered::BufferedReader
.print
and println
are no longer in the prelude, the print!
and println!
macros are intended to be used instead.Rc
now has a Weak
pointer for breaking cycles, and it no longer attempts to statically prevent cycles.slice::last()
) now return Option<T>
instead of T
+ failing.fmt::Default
has been renamed to fmt::Show
, and it now has a new deriving mode: #[deriving(Show)]
.ToStr
is now implemented for all types implementing Show
.&self
instead of &T
invert()
method on iterators has been renamed to rev()
std::num
has seen a reduction in the genericity of its traits, consolidating functionality into a few core traits.RUST_BACKTRACE
is present.eof()
has been removed from the Reader
trait. Specific types may still implement the function.assert_approx_eq!
has been removede
and E
formatting specifiers for floats have been added to print them in exponential notation.Times
trait has been removedstd::kinds::marker
nowhash
has been rewritten, IterBytes
has been removed, and #[deriving(Hash)]
is now possible.SharedChan
has been removed, Sender
is now cloneable.Chan
and Port
were renamed to Sender
and Receiver
.Chan::new
is now channel()
.select!
macro is now provided for selecting over Receiver
s.hashmap
and trie
have been moved to libcollections
run
has been rolled into io::process
assert_eq!
now uses {}
instead of {:?}
rand
has moved to librand
.to_{lower,upper}case
has been implemented for char
.liblog
.HashMap
has been rewritten for higher performance and less memory usage.libnative
. If libgreen
is desired, it can be booted manually. The runtime guide has more information and examples.libgreen
has been optimized with stack caching and various trimming of code.libgreen
now have an unmapped guard page.extra::sync
module has been updated to modern rust (and moved to the sync
library), tweaking and improving various interfaces while dropping redundant functionality.Barrier
type has been added to the sync
library.base64
module has seen some improvement. It treats newlines better, has non-string error values, and has seen general cleanup.fourcc!
macro was introducedhexfloat!
macro was implemented for specifying floats via a hexadecimal literal.Tooling
rustpkg
has been deprecated and removed from the main repository. Its replacement, cargo
, is under development.--emit
flag.--crate-type
flag.-C
flag.rustdoc
improvements:~1800 changes, numerous bugfixes
Language
float
type has been removed. Use f32
or f64
instead.#[feature(foo)]
attribute.#[feature(managed_boxes)]
) in preparation for future removal. Use the standard library's Gc
or Rc
types instead.@mut
has been removed. Use std::cell::{Cell, RefCell}
instead.continue
instead of loop
.r"foo"
syntax or with matched hash delimiters, as in r###"foo"###
.~fn
is now written proc (args) -> retval { ... }
and may only be called once.&fn
type is now written |args| -> ret
to match the literal form.@fn
s have been removed.do
only works with procs in order to make it obvious what the cost of do
is.#[link(...)]
attribute has been replaced with #[crate_id = "name#vers"]
.impl
s must be terminated with empty braces and may not be terminated with a semicolon.self
lifetime no longer has any special meaning.fmt!
string formatting macro has been removed.printf!
and printfln!
(old-style formatting) removed in favor of print!
and println!
.mut
works in patterns now, as in let (mut x, y) = (1, 2);
.extern mod foo (name = "bar")
syntax has been removed. Use extern mod foo = "bar"
instead.alignof
, offsetof
, sizeof
.asm!
macro is feature-gated (#[feature(asm)]
).as
.repr
attribute can be used to override the discriminant size, as in #[repr(int)]
for integer-sized, and #[repr(C)]
to match C enums.0o7777
.concat!
syntax extension performs compile-time string concatenation.#[fixed_stack_segment]
and #[rust_stack]
attributes have been removed as Rust no longer uses segmented stacks.#[feature(non_ascii_idents)]
)...
, not *
; ignoring remaining fields of a struct is also done with ..
, not _
; ignoring a slice of a vector is done with ..
, not .._
.rustc
supports the “win64” calling convention via extern "win64"
.rustc
supports the “system” calling convention, which defaults to the preferred convention for the target platform, “stdcall” on 32-bit Windows, “C” elsewhere.type_overflow
lint (default: warn) checks literals for overflow.unsafe_block
lint (default: allow) checks for usage of unsafe
.attribute_usage
lint (default: warn) warns about unknown attributes.unknown_features
lint (default: warn) warns about unknown feature gates.dead_code
lint (default: warn) checks for dead code.#[link_args]
is behind the link_args
feature gate.#[link(name = "foo")]
#[link(name = "foo", kind = "static")]
).#[link(name = "foo", kind = "framework")]
).#[thread_local]
attribute creates thread-local (not task-local) variables. Currently behind the thread_local
feature gate.return
keyword may be used in closures.Pod
kind.cfg
attribute can now be used on struct fields and enum variants.Libraries
option
and result
API's have been overhauled to make them simpler, more consistent, and more composable.std::io
module has been replaced with one that is more comprehensive and that properly interfaces with the underlying scheduler. File, TCP, UDP, Unix sockets, pipes, and timers are all implemented.io::util
contains a number of useful implementations of Reader
and Writer
, including NullReader
, NullWriter
, ZeroReader
, TeeReader
.extra::rc
moved into std.Gc
type in the gc
module will replace @
(it is currently just a wrapper around it).Either
type has been removed.fmt::Default
can be implemented for any type to provide default formatting to the format!
macro, as in format!("{}", myfoo)
.rand
API continues to be tweaked.rust_begin_unwind
function, useful for inserting breakpoints on failure in gdb, is now named rust_fail
.each_key
and each_value
methods on HashMap
have been replaced by the keys
and values
iterators.sys
module to the mem
module.path
module was written and API changed.str::from_utf8
has been changed to cast instead of allocate.starts_with
and ends_with
methods added to vectors via the ImmutableEqVector
trait, which is in the prelude.get_opt
method, which returns None
if the index is out of bounds.Any
type can be used for dynamic typing.~Any
can be passed to the fail!
macro and retrieved via task::try
._iter
suffix now.cell::Cell
and cell::RefCell
can be used to introduce mutability roots (mutable fields, etc.). Use instead of e.g. @mut
.util::ignore
renamed to prelude::drop
.sort
and sort_by
methods via the MutableVector
trait.vec::raw
has seen a lot of cleanup and API changes.comm
module has been rewritten to be much faster, have a simpler, more consistent API, and to work for both native and green threading.flatpipes
module had bitrotted and was removed.c_vec
has been modernized.sort
module has been removed. Use the sort
method on mutable slices.Tooling
rust
and rusti
commands have been removed, due to lack of maintenance.rustdoc
was completely rewritten.rustdoc
can test code examples in documentation.rustpkg
can test packages with the argument, ‘test’.rustpkg
supports arbitrary dependencies, including C libraries.rustc
's support for generating debug info is improved again.rustc
has better error reporting for unbalanced delimiters.rustc
's JIT support was removed due to bitrot.rustc
adds a --dep-info
flag for communicating dependencies to build tools.~2200 changes, numerous bugfixes
Language
for
loop syntax has changed to work with the Iterator
trait.copy
is no longer a keyword. It has been replaced by the Clone
trait.debug!
macro if it is passed --cfg ndebug
mod foo;
, rustc will now look for foo.rs, then foo/mod.rs, and will generate an error when both are present.std::c_str
module provides new mechanisms for converting to C strings.extern "C" fn
instead of `*u8'.#[fixed_stack_segment]
attribute.externfn!
macro can be used to declare both a foreign function and a #[fixed_stack_segment]
wrapper at once.pub
and priv
modifiers on extern
blocks are no longer parsed.unsafe
is no longer allowed on extern fns - they are all unsafe.priv
is disallowed everywhere except for struct fields and enum variants.&T
(besides &'static T
) is no longer allowed in @T
.ref
bindings in irrefutable patterns work correctly now.char
is now prevented from containing invalid code points.bool
is no longer allowed.\0
is now accepted as an escape in chars and strings.yield
is a reserved keyword.typeof
is a reserved keyword.extern mod foo = "url";
.enum E { V = 0u }
static foo: [u8, .. 100]: [0, .. 100];
.static foo: Foo = Foo { a: 5, .. bar };
.cfg!
can be used to conditionally execute code based on the crate configuration, similarly to #[cfg(...)]
.unnecessary_qualification
lint detects unneeded module prefixes (default: allow).std::unstable::simd
.format!
implements a completely new, extensible, and higher-performance string formatting system. It will replace fmt!
.print!
and println!
write formatted strings (using the format!
extension) to stdout.write!
and writeln!
write formatted strings (using the format!
extension) to the new Writers in std::rt::io
.#[link_section = "..."]
.proto!
syntax extension for defining bounded message protocols was removed.macro_rules!
is hygienic for let
declarations.#[export_name]
attribute specifies the name of a symbol.unreachable!
can be used to indicate unreachable code, and fails if executed.Libraries
rt::io
, based on the new runtime.range
function was added to the prelude, replacing uint::range
and friends.range_rev
no longer exists. Since range is an iterator it can be reversed with range(lo, hi).invert()
.chain
method on option renamed to and_then
; unwrap_or_default
renamed to unwrap_or
.iterator
module was renamed to iter
.checked_add
, checked_sub
, and checked_mul
operations for detecting overflow.str
, vec
, option,
result` were renamed for consistency.to_foo
for copying, into_foo
for moving, as_foo
for temporary and cheap casts.CString
type in c_str
provides new ways to convert to and from C strings.DoubleEndedIterator
can yield elements in two directions.mut_split
method on vectors partitions an &mut [T]
into two splices.str::from_bytes
renamed to str::from_utf8
.pop_opt
and shift_opt
methods added to vectors.swap_unwrap
method of Option
renamed to take_unwrap
.SharedPort
to comm
.Eq
has a default method for ne
; only eq
is required in implementations.Ord
has default methods for le
, gt
and ge
; only lt
is required in implementations.is_utf8
performance is improved, impacting many string functions.os::MemoryMap
provides cross-platform mmap.ptr::offset
is now unsafe, but also more optimized. Offsets that are not ‘in-bounds’ are considered undefined.vec
removed in favor of methods.FromIterator
so can be created by the collect
method.unstable::atomics
.comm::PortSet
removed.Set
and Map
traits have been moved into the MutableSet
and MutableMap
traits. Container::is_empty
, Map::contains_key
, MutableMap::insert
, and MutableMap::remove
have default implementations.from_str
functions were removed in favor of a generic from_str
which is available in the prelude.util::unreachable
removed in favor of the unreachable!
macro.dlist
, the doubly-linked list was modernized.hex
module with ToHex
and FromHex
traits.glob
module, replacing std::os::glob
.rope
was removed.deque
was renamed to ringbuf
. RingBuf
implements Deque
.net
, and timer
were removed. The experimental replacements are std::rt::io::net
and std::rt::io::timer
.SmallIntMap
.Bitv
and BitvSet
.SmallIntSet
removed. Use BitvSet
.semver
updated to SemVer 2.0.0.term
handles more terminals correctly.dbg
module removed.par
module removed.future
was cleaned up, with some method renames.getopts
were converted to methods.Other
-Z debug-info
) is greatly improved.--target-cpu
to compile to a specific CPU architecture, similarly to gcc's --march
flag.--test
now support the -h
and --help
flags.rustdoc
command.~2000 changes, numerous bugfixes
Language
impl
s no longer accept a visibility qualifier. Put them on methods instead.self
parameter no longer implicitly means &'self self
, and can be explicitly marked with a lifetime.+=
, etc.) have been temporarily removed due to bugs.for
loop protocol now requires for
-iterators to return bool
so they compose better.Durable
trait is replaced with the 'static
bounds.#[packed]
attribute have byte alignment and no padding between fields.Copy
must now be copied explicitly with the copy
keyword.Option<~T>
is now represented as a nullable pointer.@mut
does dynamic borrow checks correctly.main
function is only detected at the topmost level of the crate. The #[main]
attribute is still valid anywhere.#[no_send]
attribute makes a type that would otherwise be Send
, not.#[no_freeze]
attribute makes a type that would otherwise be Freeze
, not.RUST_MAX_STACK
environment variable (default: 1GB).vecs_implicitly_copyable
lint mode has been removed. Vectors are never implicitly copyable.#[static_assert]
makes compile-time assertions about static bools.use mod
statement no longer exists.Syntax extensions
fail!
and assert!
accept ~str
, &'static str
or fmt!
-style argument list.Encodable
, Decodable
, Ord
, TotalOrd
, TotalEq
, DeepClone
, Rand
, Zero
and ToStr
can all be automatically derived with #[deriving(...)]
.bytes!
macro returns a vector of bytes for string, u8, char, and unsuffixed integer literals.Libraries
core
crate was renamed to std
.std
crate was renamed to extra
.iterator
module for external iterator objects.Iterator
.any
, all
. removed.finalize
method of Drop
renamed to drop
.drop
method now takes &mut self
instead of &self
.print
, println
, FromStr
, ApproxEq
, Equiv
, Iterator
, IteratorUtil
, many numeric traits, many tuple traits.Fractional
, Real
, RealExt
, Integer
, Ratio
, Algebraic
, Trigonometric
, Exponential
, Primitive
.(0, 1, 2).n2()
or (0, 1, 2).n2_ref()
.Clone
.path
type renamed to Path
.mut
module and Mut
type removed.vec
, str
. In the future methods will also work as functions.reinterpret_cast
removed. Use transmute
.std::ascii
.Rand
is implemented for ~/@.run
module for spawning processes overhauled.unstable::atomic
.Zero
.LinearMap
and LinearSet
renamed to HashMap
and HashSet
.ptr
to borrow
.os::mkdir_recursive
.os::glob
function performs filesystems globs.FuzzyEq
renamed to ApproxEq
.Map
now defines pop
and swap
methods.Cell
constructors converted to static methods.rc
module adds the reference counted pointers, Rc
and RcMut
.flate
module moved from std
to extra
.fileinput
module for iterating over a series of files.Complex
number type and complex
module.Rational
number type and rational
module.BigInt
, BigUint
implement numeric and comparison traits.term
uses terminfo now, is more correct.arc
functions converted to methods.Tooling
unused_variable
lint mode for unused variables (default: warn).unused_unsafe
lint mode for detecting unnecessary unsafe
blocks (default: warn).unused_mut
lint mode for identifying unused mut
qualifiers (default: warn).dead_assignment
lint mode for unread variables (default: warn).unnecessary_allocation
lint mode detects some heap allocations that are immediately borrowed so could be written without allocating (default: warn).missing_doc
lint mode (default: allow).unreachable_code
lint mode (default: warn).rusti
command has been rewritten and a number of bugs addressed.--link-args
flag to pass arguments to the linker.-Z print-link-args
flag for debugging linkage.-g
will make the binary record information about dynamic borrowcheck failures for debugging.~2100 changes, numerous bugfixes
Syntax changes
Self
self
parameter in trait and impl methods must now be explicitly named (for example: fn f(&self) { }
). Implicit self is deprecated.static
keyword and instead are distinguished by the lack of a self
parameterDurable
trait with the 'static
lifetimesuper
is a keyword, and may be prefixed to paths+
instead of whitespaceimpl Trait for Type
instead of impl Type: Trait
&'l foo
instead of &l/foo
export
keyword has finally been removedmove
keyword has been removed (see “Semantic changes”)[mut T]
, has been removed. Use &mut [T]
, etc.mut
is no longer valid in ~mut T
. Use inherited mutabilityfail
is no longer a keyword. Use fail!()
assert
is no longer a keyword. Use assert!()
log
is no longer a keyword. use debug!
, etc.(T,)
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 { ... }
const
renamed to static
to correspond to lifetime name, and make room for future static mut
unsafe mutable globals.#[deriving_eq]
with #[deriving(Eq)]
, etc.Clone
implementations can be automatically generated with #[deriving(Clone)]
@foo as @Bar
instead of foo as Bar
.[int, .. 3]
instead of [int * 3]
.[int, .. GL_BUFFER_SIZE - 2]
)Semantic changes
move
keyworduse
statements may no longer be “chained” - they cannot import identifiers imported by previous use
statementsuse
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.Libraries
std::bigint
core::oldcomm
modulecore::comm
modulecore::num
vec::slice
finally returns a slicedebug!
and friends don't require a format string, e.g. debug!(Foo)
core::container
core::dvec
removed, ~[T]
is a drop-in replacementcore::send_map
renamed to core::hashmap
std::map
removed; replaced with core::hashmap
std::treemap
reimplemented as an owned balanced treestd::deque
and std::smallintmap
reimplemented as owned containerscore::trie
added as a fast ordered map for integer keyscore::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 typesOther
rustc --test
now supports benchmarks with the #[bench]
attribute~900 changes, numerous bugfixes
Syntax changes
<-
move operator#fmt
extension syntax to fmt!
[T]/N
quote_tokens!
, quote_expr!
, etc.a.b()
is always parsed as a method call, never as a field projectionEq
and IterBytes
implementations can be automatically generated with #[deriving_eq]
and #[deriving_iter_bytes]
respectively.rc
filesSemantic changes
&
and ~
pointers may point to objectsstruct Foo(Bar, Baz)
. Will replace newtype enums.move
explicitly&T
may now be coerced to *T
let
statements as well as function callsuse
statements now take crate-relative pathsImproved support for language features
self
, &self
@self
, and ~self
all generally work as expectedLibraries
core::condition
std::sort
std::priority_queue
getopts
definitionsstd
core::comm
renamed to oldcomm
. Still deprecatedrustdoc
and cargo
are libraries nowMisc
rusti
~2000 changes, numerous bugfixes
Syntax
ret
became return
and alt
became match
import
is now use
; use is now
extern mod`extern mod { ... }
is now extern { ... }
use mod
is the recommended way to import modulespub
and priv
replace deprecated export listsmatch
pattern arms now uses fat arrow (=>)main
no longer accepts an args vector; use os::args
insteadSemantics
Libraries
std::net::url
for representing URLscore::send_map
Concurrency
core::pipes
std::arc
, an atomically reference counted, immutable, shared memory typestd::sync
, various exotic synchronization tools based on arcs and pipesOther
~1900 changes, numerous bugfixes
New coding conveniences
Semantic cleanup
Experimental new language features
Type reflection
Removal of various obsolete features
Keywords: ‘be’, ‘prove’, ‘syntax’, ‘note’, ‘mutable’, ‘bind’, ‘crust’, ‘native’ (now ‘extern’), ‘cont’ (now ‘again’)
Constructs: do-while loops (‘do’ repurposed), fn binding, resources (replaced by destructors)
Compiler reorganization
New library code
Tool improvements
1500 changes, numerous bugfixes
New docs and doc tooling
New port: FreeBSD x86_64
Compilation model enhancements
Scheduling, stack and threading fixes
Experimental new language features
Various language extensions
New library code
Most language features work, including:
Compiler works with the following configurations:
Cross compilation / multi-target configuration supported.
Preliminary API-documentation and package-management tools included.
Known issues:
Documentation is incomplete.
Performance is below intended target.
Standard library APIs are subject to extensive change, reorganization.
Language-level versioning is not yet operational - future code will break unexpectedly.