- [Allow
concat_idents!
in type positions as well as in expression positions] (rust-lang/rust#33735). - [
Copy
types are required to have a trivial implementation ofClone
] (rust-lang/rust#33420). RFC 1521. - [Single-variant enums support the
#[repr(..)]
attribute] (rust-lang/rust#33355). - [Fix
#[derive(RustcEncodable)]
in the presence of otherencode
methods] (rust-lang/rust#32908). - [
panic!
can be converted to a runtime abort with the-C panic=abort
flag] (rust-lang/rust#32900). RFC 1513. - [Add a new crate type, 'cdylib'] (rust-lang/rust#33553). cdylibs are dynamic libraries suitable for loading by non-Rust hosts. RFC 1510. Note that Cargo does not yet directly support cdylibs.
os::windows::fs::OpenOptionsExt::access_mode
os::windows::fs::OpenOptionsExt::share_mode
os::windows::fs::OpenOptionsExt::custom_flags
os::windows::fs::OpenOptionsExt::attributes
os::windows::fs::OpenOptionsExt::security_qos_flags
os::unix::fs::OpenOptionsExt::custom_flags
- [
sync::Weak::new
] (http://doc.rust-lang.org/alloc/arc/struct.Weak.html#method.new) Default for sync::Weak
- [
panic::set_hook
] (http://doc.rust-lang.org/std/panic/fn.set_hook.html) - [
panic::take_hook
] (http://doc.rust-lang.org/std/panic/fn.take_hook.html) - [
panic::PanicInfo
] (http://doc.rust-lang.org/std/panic/struct.PanicInfo.html) - [
panic::PanicInfo::payload
] (http://doc.rust-lang.org/std/panic/struct.PanicInfo.html#method.payload) - [
panic::PanicInfo::location
] (http://doc.rust-lang.org/std/panic/struct.PanicInfo.html#method.location) - [
panic::Location
] (http://doc.rust-lang.org/std/panic/struct.Location.html) - [
panic::Location::file
] (http://doc.rust-lang.org/std/panic/struct.Location.html#method.file) - [
panic::Location::line
] (http://doc.rust-lang.org/std/panic/struct.Location.html#method.line) - [
ffi::CStr::from_bytes_with_nul
] (http://doc.rust-lang.org/std/ffi/struct.CStr.html#method.from_bytes_with_nul) - [
ffi::CStr::from_bytes_with_nul_unchecked
] (http://doc.rust-lang.org/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked) - [
ffi::FromBytesWithNulError
] (http://doc.rust-lang.org/std/ffi/struct.FromBytesWithNulError.html) - [
fs::Metadata::modified
] (http://doc.rust-lang.org/std/fs/struct.Metadata.html#method.modified) - [
fs::Metadata::accessed
] (http://doc.rust-lang.org/std/fs/struct.Metadata.html#method.accessed) - [
fs::Metadata::created
] (http://doc.rust-lang.org/std/fs/struct.Metadata.html#method.created) sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange
sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak
collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key
os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}
- [
SocketAddr::is_unnamed
] (http://doc.rust-lang.org/std/os/unix/net/struct.SocketAddr.html#method.is_unnamed) - [
SocketAddr::as_pathname
] (http://doc.rust-lang.org/std/os/unix/net/struct.SocketAddr.html#method.as_pathname) - [
UnixStream::connect
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.connect) - [
UnixStream::pair
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.pair) - [
UnixStream::try_clone
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.try_clone) - [
UnixStream::local_addr
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.local_addr) - [
UnixStream::peer_addr
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.peer_addr) - [
UnixStream::set_read_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.read_timeout) - [
UnixStream::set_write_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.write_timeout) - [
UnixStream::read_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.read_timeout) - [
UnixStream::write_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.write_timeout) - [
UnixStream::set_nonblocking
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.set_nonblocking) - [
UnixStream::take_error
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.take_error) - [
UnixStream::shutdown
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.shutdown) - Read/Write/RawFd impls for
UnixStream
- [
UnixListener::bind
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.bind) - [
UnixListener::accept
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.accept) - [
UnixListener::try_clone
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.try_clone) - [
UnixListener::local_addr
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.local_addr) - [
UnixListener::set_nonblocking
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.set_nonblocking) - [
UnixListener::take_error
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.take_error) - [
UnixListener::incoming
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.incoming) - RawFd impls for
UnixListener
- [
UnixDatagram::bind
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.bind) - [
UnixDatagram::unbound
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.unbound) - [
UnixDatagram::pair
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.pair) - [
UnixDatagram::connect
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.connect) - [
UnixDatagram::try_clone
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.try_clone) - [
UnixDatagram::local_addr
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.local_addr) - [
UnixDatagram::peer_addr
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.peer_addr) - [
UnixDatagram::recv_from
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.recv_from) - [
UnixDatagram::recv
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.recv) - [
UnixDatagram::send_to
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.send_to) - [
UnixDatagram::send
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.send) - [
UnixDatagram::set_read_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.set_read_timeout) - [
UnixDatagram::set_write_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.set_write_timeout) - [
UnixDatagram::read_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.read_timeout) - [
UnixDatagram::write_timeout
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.write_timeout) - [
UnixDatagram::set_nonblocking
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.set_nonblocking) - [
UnixDatagram::take_error
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.take_error) - [
UnixDatagram::shutdown
] (http://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.shutdown) - RawFd impls for
UnixDatagram
{BTree,Hash}Map::values_mut
- [
<[_]>::binary_search_by_key
] (http://doc.rust-lang.org/beta/std/primitive.slice.html#method.binary_search_by_key)
- [The
abs_sub
method of floats is deprecated] (rust-lang/rust#33664). The semantics of this minor method are subtle and probably not what most people want. - [Add implementation of Ord for Cell and RefCell where T: Ord] (rust-lang/rust#33306).
- [On Linux, if
HashMap
s can't be initialized withgetrandom
they will fall back to/dev/urandom
temporarily to avoid blocking during early boot] (rust-lang/rust#33086). - [Implemented negation for wrapping numerals] (rust-lang/rust#33067).
- [Implement
Clone
forbinary_heap::IntoIter
] (rust-lang/rust#33050). - [Implement
Display
andHash
forstd::num::Wrapping
] (rust-lang/rust#33023). - [Add
Default
implementation for&CStr
,CString
] (rust-lang/rust#32990). - [Implement
From<Vec<T>>
andInto<Vec<T>>
forVecDeque<T>
] (rust-lang/rust#32866). - [Implement
Default
forUnsafeCell
,fmt::Error
,Condvar
,Mutex
,RwLock
] (rust-lang/rust#32785).
- [Cargo.toml supports the
profile.*.panic
option] (rust-lang/cargo#2687). This controls the runtime behavior of thepanic!
macro and can be either "unwind" (the default), or "abort". RFC 1513. - [Don't throw away errors with
-p
arguments] (rust-lang/cargo#2723). - [Report status to stderr instead of stdout] (rust-lang/cargo#2693).
- [Build scripts are passed a
CARGO_MANIFEST_LINKS
environment variable that corresponds to thelinks
field of the manifest] (rust-lang/cargo#2710). - [Ban keywords from crate names] (rust-lang/cargo#2707).
- [Canonicalize
CARGO_HOME
on Windows] (rust-lang/cargo#2604). - [Retry network requests]
(rust-lang/cargo#2396).
By default they are retried twice, which can be customized with the
net.retry
value in.cargo/config
. - [Don't print extra error info for failing subcommands] (rust-lang/cargo#2674).
- [Add
--force
flag tocargo install
] (rust-lang/cargo#2405). - [Don't use
flock
on NFS mounts] (rust-lang/cargo#2623). - [Prefer building
cargo install
artifacts in temporary directories] (rust-lang/cargo#2610). Makes it possible to install multiple crates in parallel. - [Add
cargo test --doc
] (rust-lang/cargo#2578). - [Add
cargo --explain
] (rust-lang/cargo#2551). - [Don't print warnings when
-q
is passed] (rust-lang/cargo#2576). - [Add
cargo doc --lib
and--bin
] (rust-lang/cargo#2577). - [Don't require build script output to be UTF-8] (rust-lang/cargo#2560).
- [Correctly attempt multiple git usernames] (rust-lang/cargo#2584).
- [rustc memory usage was reduced by refactoring the context used for type checking] (rust-lang/rust#33425).
- [Speed up creation of
HashMap
s by caching the random keys used to initialize the hash state] (rust-lang/rust#33318). - [The
find
implementation forChain
iterators is 2x faster] (rust-lang/rust#33289). - [Trait selection optimizations speed up type checking by 15%] (rust-lang/rust#33138).
- [Efficient trie lookup for boolean Unicode properties] (rust-lang/rust#33098). 10x faster than the previous lookup tables.
- [Special case
#[derive(Copy, Clone)]
to avoid bloat] (rust-lang/rust#31414).
- Many incremental improvements to documentation and rustdoc.
- [rustdoc: List blanket trait impls] (rust-lang/rust#33514).
- [rustdoc: Clean up ABI rendering] (rust-lang/rust#33151).
- [Indexing with the wrong type produces a more informative error] (rust-lang/rust#33401).
- [Improve diagnostics for constants being used in irrefutable patterns] (rust-lang/rust#33406).
- [When many method candidates are in scope limit the suggestions to 10] (rust-lang/rust#33338).
- [Remove confusing suggestion when calling a
fn
type] (rust-lang/rust#33325). - [Do not suggest changing
&mut self
to&mut mut self
] (rust-lang/rust#33319).
- [Update i686-linux-android features to match Android ABI] (rust-lang/rust#33651).
- [Update aarch64-linux-android features to match Android ABI] (rust-lang/rust#33500).
std
no longer prints backtraces on platforms where the running module must be loaded withenv::current_exe
, which can't be relied on.- This release includes std binaries for the i586-unknown-linux-gnu, i686-unknown-linux-musl, and armv7-linux-androideabi targets. The i586 target is for old x86 hardware without SSE2, and the armv7 target is for Android running on modern ARM architectures.
- The
rust-gdb
andrust-lldb
scripts are distributed on all Unix platforms. - [On Unix the runtime aborts by calling
libc::abort
instead of generating an illegal instruction] (rust-lang/rust#31457). - [Rust is now bootstrapped from the previous release of Rust, instead of a snapshot from an arbitrary commit] (rust-lang/rust#32942).
- [
AtomicBool
is now bool-sized, not word-sized] (rust-lang/rust#33579). - [
target_env
for Linux ARM targets is justgnu
, notgnueabihf
,gnueabi
, etc] (rust-lang/rust#33403). - [Consistently panic on overflow in
Duration::new
] (rust-lang/rust#33072). - [Change
String::truncate
to panic less] (rust-lang/rust#32977). - [Add
:block
to the follow set for:ty
and:path
] (rust-lang/rust#32945). Affects how macros are parsed. - [Fix macro hygiene bug] (rust-lang/rust#32923).
- [Feature-gated attributes on macro-generated macro invocations are now rejected] (rust-lang/rust#32791).
- [Suppress fallback and ambiguity errors during type inference] (rust-lang/rust#32258). This caused some minor changes to type inference.
- The
#[deprecated]
attribute when applied to an API will generate warnings when used. The warnings may be suppressed with#[allow(deprecated)]
. RFC 1270. fn
item types are zero sized, and eachfn
names a unique type. This will break code that transmutesfn
s, so callingtransmute
on afn
type will generate a warning for a few cycles, then will be converted to an error.- Field and method resolution understand visibility, so private fields and methods cannot prevent the proper use of public fields and methods.
- The parser considers unicode codepoints in the
PATTERN_WHITE_SPACE
category to be whitespace.
std::panic
std::panic::catch_unwind
(renamed fromrecover
)std::panic::resume_unwind
(renamed frompropagate
)std::panic::AssertUnwindSafe
(renamed fromAssertRecoverSafe
)std::panic::UnwindSafe
(renamed fromRecoverSafe
)str::is_char_boundary
<*const T>::as_ref
<*mut T>::as_ref
<*mut T>::as_mut
AsciiExt::make_ascii_uppercase
AsciiExt::make_ascii_lowercase
char::decode_utf16
char::DecodeUtf16
char::DecodeUtf16Error
char::DecodeUtf16Error::unpaired_surrogate
BTreeSet::take
BTreeSet::replace
BTreeSet::get
HashSet::take
HashSet::replace
HashSet::get
OsString::with_capacity
OsString::clear
OsString::capacity
OsString::reserve
OsString::reserve_exact
OsStr::is_empty
OsStr::len
std::os::unix::thread
RawPthread
JoinHandleExt
JoinHandleExt::as_pthread_t
JoinHandleExt::into_pthread_t
HashSet::hasher
HashMap::hasher
CommandExt::exec
File::try_clone
SocketAddr::set_ip
SocketAddr::set_port
SocketAddrV4::set_ip
SocketAddrV4::set_port
SocketAddrV6::set_ip
SocketAddrV6::set_port
SocketAddrV6::set_flowinfo
SocketAddrV6::set_scope_id
slice::copy_from_slice
ptr::read_volatile
ptr::write_volatile
OpenOptions::create_new
TcpStream::set_nodelay
TcpStream::nodelay
TcpStream::set_ttl
TcpStream::ttl
TcpStream::set_only_v6
TcpStream::only_v6
TcpStream::take_error
TcpStream::set_nonblocking
TcpListener::set_ttl
TcpListener::ttl
TcpListener::set_only_v6
TcpListener::only_v6
TcpListener::take_error
TcpListener::set_nonblocking
UdpSocket::set_broadcast
UdpSocket::broadcast
UdpSocket::set_multicast_loop_v4
UdpSocket::multicast_loop_v4
UdpSocket::set_multicast_ttl_v4
UdpSocket::multicast_ttl_v4
UdpSocket::set_multicast_loop_v6
UdpSocket::multicast_loop_v6
UdpSocket::set_multicast_ttl_v6
UdpSocket::multicast_ttl_v6
UdpSocket::set_ttl
UdpSocket::ttl
UdpSocket::set_only_v6
UdpSocket::only_v6
UdpSocket::join_multicast_v4
UdpSocket::join_multicast_v6
UdpSocket::leave_multicast_v4
UdpSocket::leave_multicast_v6
UdpSocket::take_error
UdpSocket::connect
UdpSocket::send
UdpSocket::recv
UdpSocket::set_nonblocking
std::sync::Once
is poisoned if its initialization function fails.cell::Ref
andcell::RefMut
can contain unsized types.- Most types implement
fmt::Debug
. - The default buffer size used by
BufReader
andBufWriter
was reduced to 8K, from 64K. This is in line with the buffer size used by other languages. Instant
,SystemTime
andDuration
implement+=
and-=
.Duration
additionally implements*=
and/=
.Skip
is aDoubleEndedIterator
.From<[u8; 4]>
is implemented forIpv4Addr
.Chain
implementsBufRead
.HashMap
,HashSet
and iterators are covariant.
- Cargo can now run concurrently.
- Top-level overrides allow specific revisions of crates to be overridden through the entire crate graph. This is intended to make upgrades easier for large projects, by allowing crates to be forked temporarily until they've been upgraded and republished.
- Cargo exports a
CARGO_PKG_AUTHORS
environment variable. - Cargo will pass the contents of the
RUSTFLAGS
variable torustc
on the commandline.rustc
arguments can also be specified in thebuild.rustflags
configuration key.
- The time complexity of comparing variables for equivalence during type unification is reduced from O(n!) to O(n). This leads to major compilation time improvement in some scenarios.
ToString
is specialized forstr
, giving it the same performance asto_owned
.- Spawning processes with
Command::output
no longer creates extra threads. #[derive(PartialEq)]
and#[derive(PartialOrd)]
emit less code for C-like enums.
- Passing the
--quiet
flag to a test runner will produce much-abbreviated output. - The Rust Project now publishes std binaries for the
mips-unknown-linux-musl
,mipsel-unknown-linux-musl
, andi586-pc-windows-msvc
targets.
std::sync::Once
is poisoned if its initialization function fails.- It is illegal to define methods with the same name in overlapping
inherent
impl
blocks. fn
item types are zero sized, and eachfn
names a unique type. This will break code that transmutesfn
s, so callingtransmute
on afn
type will generate a warning for a few cycles, then will be converted to an error.- Improvements to const evaluation may trigger new errors when integer literals are out of range.
- Rust supports overloading of compound assignment statements like
+=
by implementing theAddAssign
,SubAssign
,MulAssign
,DivAssign
,RemAssign
,BitAndAssign
,BitOrAssign
,BitXorAssign
,ShlAssign
, orShrAssign
traits. RFC 953. - Empty structs can be defined with braces, as in
struct Foo { }
, in addition to the non-braced form,struct Foo;
. RFC 218.
- Stabilized APIs:
str::encode_utf16
(renamed fromutf16_units
)str::EncodeUtf16
(renamed fromUtf16Units
)Ref::map
RefMut::map
ptr::drop_in_place
time::Instant
time::SystemTime
Instant::now
Instant::duration_since
(renamed fromduration_from_earlier
)Instant::elapsed
SystemTime::now
SystemTime::duration_since
(renamed fromduration_from_earlier
)SystemTime::elapsed
- Various
Add
/Sub
impls forTime
andSystemTime
SystemTimeError
SystemTimeError::duration
- Various impls for
SystemTimeError
UNIX_EPOCH
AddAssign
,SubAssign
,MulAssign
,DivAssign
,RemAssign
,BitAndAssign
,BitOrAssign
,BitXorAssign
,ShlAssign
,ShrAssign
.
- The
write!
andwriteln!
macros correctly emit errors if any of their arguments can't be formatted. - Various I/O functions support large files on 32-bit Linux.
- The Unix-specific
raw
modules, which contain a number of redefined C types are deprecated, includingos::raw::unix
,os::raw::macos
, andos::raw::linux
. These modules defined types such asino_t
anddev_t
. The inconsistency of these definitions across platforms was making it difficult to implementstd
correctly. Those that need these definitions should use thelibc
crate. RFC 1415. - The Unix-specific
MetadataExt
traits, includingos::unix::fs::MetadataExt
, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. btree_set::{IntoIter, Iter, Range}
are covariant.- Atomic loads and stores are not volatile.
- All types in
sync::mpsc
implementfmt::Debug
.
- Inlining hash functions lead to a 3% compile-time improvement in some workloads.
- When using jemalloc, its symbols are unprefixed so that it overrides the libc malloc implementation. This means that for rustc, LLVM is now using jemalloc, which results in a 6% compile-time improvement on a specific workload.
- Avoid quadratic growth in function size due to cleanups.
- 32-bit MSVC builds finally implement unwinding. i686-pc-windows-msvc is now considered a tier-1 platform.
- The
--print targets
flag prints a list of supported targets. - The
--print cfg
flag prints thecfg
s defined for the current target. rustc
can be built with an new Cargo-based build system, written in Rust. It will eventually replace Rust's Makefile-based build system. To enable it configure withconfigure --rustbuild
.- Errors for non-exhaustive
match
patterns now list up to 3 missing variants while also indicating the total number of missing variants if more than 3. - Executable stacks are disabled on Linux and BSD.
- The Rust Project now publishes binary releases of the standard
library for a number of tier-2 targets:
armv7-unknown-linux-gnueabihf
,powerpc-unknown-linux-gnu
,powerpc64-unknown-linux-gnu
,powerpc64le-unknown-linux-gnu
x86_64-rumprun-netbsd
. These can be installed with tools such as multirust.
cargo init
creates a new Cargo project in the current directory. It is otherwise likecargo new
.- Cargo has configuration keys for
-v
and--color
.verbose
andcolor
, respectively, go in the[term]
section of.cargo/config
. - Configuration keys that evaluate to strings or integers can be set
via environment variables. For example the
build.jobs
key can be set viaCARGO_BUILD_JOBS
. Environment variables take precedence over config files. - Target-specific dependencies support Rust
cfg
syntax for describing targets so that dependencies for multiple targets can be specified together. RFC 1361. - The environment variables
CARGO_TARGET_ROOT
,RUSTC
, andRUSTDOC
take precedence over thebuild.target-dir
,build.rustc
, andbuild.rustdoc
configuration values. - The child process tree is killed on Windows when Cargo is killed.
- The
build.target
configuration value sets the target platform, like--target
.
- Unstable compiler flags have been further restricted. Since
1.0
-Z
flags have been considered unstable, and other flags that were considered unstable additionally required passing-Z unstable-options
to access. Unlike unstable language and library features though, these options have been accessible on the stable release channel. Going forward, new unstable flags will not be available on the stable release channel, and old unstable flags will warn about their usage. In the future, all unstable flags will be unavailable on the stable release channel. - It is no longer possible to
match
on empty enum variants using theVariant(..)
syntax. This has been a warning since 1.6. - The Unix-specific
MetadataExt
traits, includingos::unix::fs::MetadataExt
, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. - Modules sourced from the filesystem cannot appear within arbitrary blocks, but only within other modules.
--cfg
compiler flags are parsed strictly as identifiers.- On Unix, stack overflow triggers a runtime abort instead of a SIGSEGV.
Command::spawn
and its equivalents return an error if any of its command-line arguments contain interiorNUL
s.- Tuple and unit enum variants from other crates are in the type namespace.
- On Windows
rustc
emits.lib
files for thestaticlib
library type instead of.a
files. Additionally, for the MSVC toolchain,rustc
emits import libraries namedfoo.dll.lib
instead offoo.lib
.
- Stabilized APIs
Path
Path::strip_prefix
(renamed from relative_from)path::StripPrefixError
(new error type returned from strip_prefix)
Ipv4Addr
Ipv6Addr
Vec
String
- Slices
<[T]>::
clone_from_slice
, which now requires the two slices to be the same length<[T]>::
sort_by_key
- checked, saturated, and overflowing operations
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
- and checked, saturated, and overflowing operations for other primitive types
- FFI
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
- Hashing
- Validating UTF-8 is faster by a factor of between 7 and 14x for
ASCII input. This means that creating
String
s andstr
s from bytes is faster. - The performance of
LineWriter
(and thusio::stdout
) was improved by usingmemchr
to search for newlines. f32::to_degrees
andf32::to_radians
are stable. Thef64
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
, andRange
are covariant over their contained type.LinkedList
and its iterators,Iter
andIntoIter
are covariant over their contained type.str::replace
now accepts aPattern
, like other string searching methods.Any
is implemented for unsized types.Hash
is implemented forDuration
.
- When running tests with
--test
, rustdoc will pass--cfg
arguments to the compiler. - The compiler is built with RPATH information by default.
This means that it will be possible to run
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 overLD_LIBRARY_PATH
.
cargo rustc
accepts a--profile
flag that runsrustc
under any of the compilation profiles, 'dev', 'bench', or 'test'.- The
rerun-if-changed
build script directive no longer causes the build script to incorrectly run twice in certain scenarios.
- Soundness fixes to the interactions between associated types and lifetimes, specified in RFC 1214, now generate errors for code that violates the new rules. This is a significant change that is known to break existing code, so it has emitted warnings for the new error cases since 1.4 to give crate authors time to adapt. The details of what is changing are subtle; read the RFC for more.
- Several bugs in the compiler's visibility calculations were
fixed. Since this was found to break significant amounts of
code, the new errors will be emitted as warnings for several release
cycles, under the
private_in_public
lint. - Defaulted type parameters were accidentally accepted in positions that were not intended. In this release, defaulted type parameters appearing outside of type definitions will generate a warning, which will become an error in future releases.
- Parsing "." as a float results in an error instead of 0.
That is,
".".parse::<f32>()
returnsErr
, notOk(0.0)
. - Borrows of closure parameters may not outlive the closure.
- The
#![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.
- Stabilized APIs:
Read::read_exact
,ErrorKind::UnexpectedEof
(renamed fromUnexpectedEOF
),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 frompush_all
),Mutex::get_mut
,Mutex::into_inner
,RwLock::get_mut
,RwLock::into_inner
,Iterator::min_by_key
(renamed frommin_by
),Iterator::max_by_key
(renamed frommax_by
). - The core library is stable, as are most of its APIs.
- The
assert_eq!
macro supports arguments that don't implementSized
, such as arrays. In this way it behaves more likeassert!
. - Several timer functions that take duration in milliseconds are
deprecated in favor of those that take
Duration
. These includeCondvar::wait_timeout_ms
,thread::sleep_ms
, andthread::park_timeout_ms
. - The algorithm by which
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 tof32
, nor for 64-bit ints tof32
orf64
. They are also not implemented forisize
andusize
because the implementations would be platform-specific.From
is also implemented fromf32
tof64
.From<&Path>
andFrom<PathBuf>
are implemented forCow<Path>
.From<T>
is implemented forBox<T>
,Rc<T>
andArc<T>
.IntoIterator
is implemented for&PathBuf
and&Path
.BinaryHeap
was refactored for modest performance improvements.- Sorting slices that are already sorted is 50% faster in some cases.
- Cargo will look in
$CARGO_HOME/bin
for subcommands by default. - Cargo build scripts can specify their dependencies by emitting the
rerun-if-changed
key. - crates.io will reject publication of crates with dependencies that have a wildcard version constraint. Crates with wildcard dependencies were seen to cause a variety of problems, as described in RFC 1241. Since 1.5 publication of such crates has emitted a warning.
cargo clean
accepts a--release
flag to clean the release folder. A variety of artifacts that Cargo failed to clean are now correctly deleted.
- The
unreachable_code
lint warns when a function call's argument diverges. - The parser indicates failures that may be caused by confusingly-similar Unicode characters
- Certain macro errors are reported at definition time, not expansion.
- The compiler no longer makes use of the
RUST_PATH
environment variable when locating crates. This was a pre-cargo feature for integrating with the package manager that was accidentally never removed. - A number of bugs were fixed in the privacy checker that could cause previously-accepted code to break.
- Modules and unit/tuple structs may not share the same name.
- Bugs in pattern matching unit structs were fixed. The tuple
struct pattern syntax (
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. - A bug was fixed that causes rustc not to apply default type parameters when resolving certain method implementations of traits defined in other crates.
- ~700 changes, numerous bugfixes
- Stabilized APIs:
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
. - Rust applications hosted on crates.io can be installed locally to
~/.cargo/bin
with thecargo 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 ascargo foo
. - Crates with wildcard (
*
) dependencies will emit warnings when published. In 1.6 it will no longer be possible to publish crates with wildcard dependencies.
- The rules determining when a particular lifetime must outlive a particular value (known as 'dropck') have been modified to not rely on parametricity.
- Implementations of
AsRef
andAsMut
were added toBox
,Rc
, andArc
. Because these smart pointer types implementDeref
, this causes breakage in cases where the interior type contains methods of the same name. - Correct a bug in Rc/Arc that caused dropck to be unaware that they could drop their content. Soundness fix.
- All method invocations are properly checked for well-formedness. Soundness fix.
- Traits whose supertraits contain
Self
are not object safe. Soundness fix. - Target specifications support a
no_default_libraries
setting that controls whether-nodefaultlibs
is passed to the linker, and in turn theis_like_windows
setting no longer affects the-nodefaultlibs
flag. #[derive(Show)]
, long-deprecated, has been removed.- The
#[inline]
and#[repr]
attributes can only appear in valid locations. - Native libraries linked from the local crate are passed to the linker before native libraries from upstream crates.
- Two rarely-used attributes,
#[no_debug]
and#[omit_gdb_pretty_printer_section]
are feature gated. - Negation of unsigned integers, which has been a warning for several releases, is now behind a feature gate and will generate errors.
- The parser accidentally accepted visibility modifiers on enum variants, a bug which has been fixed.
- A bug was fixed that allowed
use
statements to import unstable features.
- When evaluating expressions at compile-time that are not compile-time constants (const-evaluating expressions in non-const contexts), incorrect code such as overlong bitshifts and arithmetic overflow will generate a warning instead of an error, delaying the error until runtime. This will allow the const-evaluator to be expanded in the future backwards-compatibly.
- The
improper_ctypes
lint no longer warns about usingisize
andusize
in FFI.
Arc<T>
andRc<T>
are covariant with respect toT
instead of invariant.Default
is implemented for mutable slices.FromStr
is implemented forSockAddrV4
andSockAddrV6
.- There are now
From
conversions between floating point types where the conversions are lossless. - Thera are now
From
conversions between integer types where the conversions are lossless. fs::Metadata
implementsClone
.- The
parse
method accepts a leading "+" when parsing integers. AsMut
is implemented forVec
.- The
clone_from
implementations forString
andBinaryHeap
have been optimized and no longer rely on the default impl. - The
extern "Rust"
,extern "C"
,unsafe extern "Rust"
andunsafe extern "C"
function types now implementClone
,PartialEq
,Eq
,PartialOrd
,Ord
,Hash
,fmt::Pointer
, andfmt::Debug
for up to 12 arguments. - Dropping
Vec
s is much faster in unoptimized builds when the element types don't implementDrop
. - A bug that caused in incorrect behavior when combining
VecDeque
with zero-sized types was resolved. PartialOrd
for slices is faster.
- Crate metadata size was reduced by 20%.
- Improvements to code generation reduced the size of libcore by 3.3 MB and rustc's memory usage by 18MB.
- Improvements to deref translation increased performance in unoptimized builds.
- Various errors in trait resolution are deduplicated to only be reported once.
- Rust has preliminary support for rumprun kernels.
- Rust has preliminary support for NetBSD on amd64.
- ~1200 changes, numerous bugfixes
- Windows builds targeting the 64-bit MSVC ABI and linker (instead of GNU) are now supported and recommended for use.
- Several changes have been made to fix type soundness and improve the behavior of associated types. See RFC 1214. Although we have mostly introduced these changes as warnings this release, to become errors next release, there are still some scenarios that will see immediate breakage.
- The
str::lines
andBufRead::lines
iterators treat\r\n
as line breaks in addition to\n
. - Loans of
'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 inuse foo::{bar as kitten, baz as puppy}
.- Binops work correctly on fat pointers.
pub extern crate
, which does not behave as expected, issues a warning until a better solution is found.
- Many APIs were stabilized:
<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
. - Some APIs were deprecated:
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
. - Reverse-searching strings is faster with the 'two-way' algorithm.
std::io::copy
allows?Sized
arguments.- The
Windows
,Chunks
, andChunksMut
iterators over slices all overridecount
,nth
andlast
with an O(1) implementation. Default
is implemented for arrays up to[T; 32]
.IntoRawFd
has been added to the Unix-specific prelude,IntoRawSocket
andIntoRawHandle
to the Windows-specific prelude.Extend<String>
andFromIterator<String
are both implemented forString
.IntoIterator
is implemented for references toOption
andResult
.HashMap
andHashSet
implementExtend<&T>
whereT: Copy
as part of RFC 839. This will cause type inferance breakage in rare situations.BinaryHeap
implementsDebug
.Borrow
andBorrowMut
are implemented for fixed-size arrays.extern fn
s with the "Rust" and "C" ABIs implement common traits includingEq
,Ord
,Debug
,Hash
.- String comparison is faster.
&mut T
whereT: std::fmt::Write
also implementsstd::fmt::Write
.- A stable regression in
VecDeque::push_back
and other capicity-altering methods that caused panics for zero-sized types was fixed. - Function pointers implement traits for up to 12 parameters.
- The compiler no longer uses the 'morestack' feature to prevent stack overflow. Instead it uses guard pages and stack probes (though stack probes are not yet implemented on any platform but Windows).
- The compiler matches traits faster when projections are involved.
- The 'improper_ctypes' lint no longer warns about use of
isize
andusize
. - Cargo now displays useful information about what its doing during
cargo update
.
- ~900 changes, numerous bugfixes
- The new object lifetime defaults have been turned
on after a cycle of warnings about the change. Now types
like
&'a Box<Trait>
(or&'a Rc<Trait>
, etc) will change from being interpreted as&'a Box<Trait+'a>
to&'a Box<Trait+'static>
. - The Rustonomicon is a new book in the official documentation that dives into writing unsafe Rust.
- The
Duration
API, has been stabilized. This basic unit of timekeeping is employed by other std APIs, as well as out-of-tree time crates.
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- There is a known regression in how object lifetime elision is interpreted, the proper solution for which is undetermined.
- The
#[prelude_import]
attribute, an internal implementation detail, was accidentally stabilized previously. It has been put behind theprelude_import
feature gate. This change is believed to break no existing code. - The behavior of
size_of_val
andalign_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is thought to be broken. - The
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.
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- Semicolons may now follow types and paths in macros.
- The behavior of
size_of_val
andalign_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 betweenDeref
andDerefMut
implementations correctly.- The
dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC.
- The
Duration
API, has been stabilized, as well as thestd::time
module, which presently contains onlyDuration
. Box<str>
andBox<[T]>
both implementClone
.- The owned C string,
CString
, implementsBorrow
and the borrowed C string,CStr
, implementsToOwned
. The two of these allow C strings to be borrowed and cloned in generic code. CStr
implementsDebug
.AtomicPtr
implementsDebug
.Error
trait objects can be downcast to their concrete types in many common configurations, using theis
,downcast
,downcast_ref
anddowncast_mut
methods, similarly to theAny
trait.- Searching for substrings now employs the two-way algorithm
instead of doing a naive search. This gives major speedups to a
number of methods, including
contains
,find
,rfind
,split
.starts_with
andends_with
are also faster. - The performance of
PartialEq
for slices is much faster. - The
Hash
trait offers the default method,hash_slice
, which is overridden and optimized by the implementations for scalars. - The
Hasher
trait now has a number of specializedwrite_*
methods for primitive types, for efficiency. - The I/O-specific error type,
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 ofstd::error::Error::cause
also delegates to the inner error. process::Child
gained theid
method, which returns au32
representing the platform-specific process identifier.- The
connect
method on slices is deprecated, replaced by the newjoin
method (note that both of these are on the unstableSliceConcatExt
trait, but through the magic of the prelude are available to stable code anyway). - The
Div
operator is implemented forWrapping
types. DerefMut
is implemented forString
.- Performance of SipHash (the default hasher for
HashMap
) is better for long data. AtomicPtr
implementsSend
.- The
read_to_end
implementations forStdin
andFile
are now specialized to use uninitalized buffers for increased performance. - Lifetime parameters of foreign functions are now resolved properly.
- Rust can now, with some coercion, produce programs that run on Windows XP, though XP is not considered a supported platform.
- Porting Rust on Windows from the GNU toolchain to MSVC continues (1, 2, 3, 4). It is still not recommended for use in 1.3, though should be fully-functional in the 64-bit 1.4 beta.
- On Fedora-based systems installation will properly configure the dynamic linker.
- The compiler gained many new extended error descriptions, which can
be accessed with the
--explain
flag. - The
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.- Rust has preliminary support for i686 FreeBSD (it has long supported FreeBSD on x86_64).
- The
unused_mut
,unconditional_recursion
,improper_ctypes
, andnegate_unsigned
lints are more strict. - If landing pads are disabled (with
-Z no-landing-pads
),panic!
will kill the process instead of leaking.
- ~1200 changes, numerous bugfixes
- Dynamically-sized-type coercions allow smart pointer types
like
Rc
to contain types without a fixed size, arrays and trait objects, finally enabling use ofRc<[T]>
and completing the implementation of DST. - Parallel codegen is now working again, which can
substantially speed up large builds in debug mode; It also gets
another ~33% speedup when bootstrapping on a 4 core machine (using 8
jobs). It's not enabled by default, but will be "in the near
future". It can be activated with the
-C codegen-units=N
flag torustc
. - This is the first release with experimental support for linking with the MSVC linker and lib C on Windows (instead of using the GNU variants via MinGW). It is yet recommended only for the most intrepid Rusticians.
- Benchmark compilations are showing a 30% improvement in bootstrapping over 1.1.
- The
to_uppercase
andto_lowercase
methods onchar
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'salignof
.mem::min_align_of
is deprecated. This is not known to break real code.- The
#[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 are now behind the
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.
- Patterns with
ref mut
now correctly invokeDerefMut
when matching against dereferencable values.
- The
Extend
trait, which grows a collection from an iterator, is implemented over iterators of references, forString
,Vec
,LinkedList
,VecDeque
,EnumSet
,BinaryHeap
,VecMap
,BTreeSet
andBTreeMap
. RFC. - The
iter::once
function returns an iterator that yields a single element, anditer::empty
returns an iterator that yields no elements. - The
matches
andrmatches
methods onstr
return iterators over substring matches. Cell
andRefCell
both implementEq
.- A number of methods for wrapping arithmetic are added to the
integral types,
wrapping_div
,wrapping_rem
,wrapping_neg
,wrapping_shl
,wrapping_shr
. These are in addition to the existingwrapping_add
,wrapping_sub
, andwrapping_mul
methods, and alternatives to theWrapping
type.. It is illegal for the default arithmetic operations in Rust to overflow; the desire to wrap must be explicit. - The
{:#?}
formatting specifier displays the alternate, pretty-printed form of theDebug
formatter. This feature was actually introduced prior to 1.0 with little fanfare. fmt::Formatter
implementsfmt::Write
, afmt
-specific trait for writing data to formatted strings, similar toio::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 ofDebug
.str
has newto_uppercase
andto_lowercase
methods that convert case, following Unicode case mapping.- It is now easier to handle poisoned locks. The
PoisonError
type, returned by failing lock operations, exposesinto_inner
,get_ref
, andget_mut
, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. Theis_poisoned
method ofRwLock
andMutex
can poll for a poisoned lock without attempting to take the lock. - On Unix the
FromRawFd
trait is implemented forStdio
, andAsRawFd
forChildStdin
,ChildStdout
,ChildStderr
. On Windows theFromRawHandle
trait is implemented forStdio
, andAsRawHandle
forChildStdin
,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.- Fat pointers are now passed in pairs of immediate arguments, resulting in faster compile times and smaller code.
- ~850 changes, numerous bugfixes
- The
std::fs
module has been expanded to expand the set of functionality exposed:DirEntry
now supports optimizations likefile_type
andmetadata
which don't incur a syscall on some platforms.- A
symlink_metadata
function has been added. - The
fs::Metadata
structure now lowers to its OS counterpart, providing access to all underlying information.
- The compiler now contains extended explanations of many errors. When an error
with an explanation occurs the compiler suggests using the
--explain
flag to read the explanation. Error explanations are also available online. - Thanks to multiple improvements to type checking, as well as other work, the time to bootstrap the compiler decreased by 32%.
- The
str::split_whitespace
method splits a string on unicode whitespace boundaries. - On both Windows and Unix, new extension traits provide conversion of
I/O types to and from the underlying system handles. On Unix, these
traits are
FromRawFd
andAsRawFd
, on WindowsFromRawHandle
andAsRawHandle
. These are implemented forFile
,TcpStream
,TcpListener
, andUpdSocket
. Further implementations forstd::process
will be stabilized later. - On Unix,
std::os::unix::symlink
creates symlinks. On Windows, symlinks can be created withstd::os::windows::symlink_dir
andstd::os::windows::symlink_file
. - The
mpsc::Receiver
type can now be converted into an iterator withinto_iter
on theIntoIterator
trait. Ipv4Addr
can be created fromu32
with theFrom<u32>
implementation of theFrom
trait.- The
Debug
implementation forRangeFull
creates output that is more consistent with other implementations. Debug
is implemented forFile
.- The
Default
implementation forArc
no longer requiresSync + Send
. - The
Iterator
methodscount
,nth
, andlast
have been overridden for slices to have O(1) performance instead of O(n). - Incorrect handling of paths on Windows has been improved in both the compiler and the standard library.
AtomicPtr
gained aDefault
implementation.- In accordance with Rust's policy on arithmetic overflow
abs
now panics on overflow when debug assertions are enabled. - The
Cloned
iterator, which was accidentally left unstable for 1.0 has been stabilized. - The
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 bysift_up
orsift_down
panic.- The
split_off
method ofLinkedList
no longer corrupts the list in certain scenarios.
- Type checking performance has improved notably with multiple improvements.
- The compiler suggests code changes for more errors.
- rustc and it's build system have experimental support for building toolchains against MUSL instead of glibc on Linux.
- The compiler defines the
target_env
cfg value, which is used for distinguishing toolchains that are otherwise for the same platform. Presently this is set tognu
for common GNU Linux targets and for MinGW targets, andmusl
for MUSL Linux targets. - The
cargo rustc
command invokes a build with custom flags to rustc. - Android executables are always position independent.
- The
drop_with_repr_extern
lint warns about mixingrepr(C)
withDrop
.
- ~1500 changes, numerous bugfixes
- The vast majority of the standard library is now
#[stable]
. It is no longer possible to use unstable features with a stable build of the compiler. - Many popular crates on crates.io now work on the stable release channel.
- Arithmetic on basic integer types now checks for overflow in debug builds.
- Several restrictions have been added to trait coherence in order to make it easier for upstream authors to change traits without breaking downstream code.
- Digits of binary and octal literals are lexed more eagerly to
improve error messages and macro behavior. For example,
0b1234
is now lexed as0b1234
instead of two tokens,0b1
and234
. - Trait bounds are always invariant, eliminating the need for
the
PhantomFn
andMarkerTrait
lang items, which have been removed. - "-" is no longer a valid character in crate names, the
extern crate "foo" as bar
syntax has been replaced withextern crate foo as bar
, and Cargo now automatically translates "-" in package names to underscore for the crate name. - Lifetime shadowing is an error.
Send
no longer implies'static
.- UFCS now supports trait-less associated paths like
MyType::default()
. - Primitive types now have inherent methods,
obviating the need for extension traits like
SliceExt
. - Methods with
Self: Sized
in theirwhere
clause are considered object-safe, allowing many extension traits likeIteratorExt
to be merged into the traits they extended. - You can now refer to associated types whose
corresponding trait bounds appear only in a
where
clause. - The final bits of OIBIT landed, meaning that traits
like
Send
andSync
are now library-defined. - A Reflect trait was introduced, which means that
downcasting via the
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. - The
unsafe_destructor
feature is now deprecated in favor of the newdropck
. This change is a major reduction in unsafe code.
- The
thread_local
module has been renamed tostd::thread
. - The methods of
IteratorExt
have been moved to theIterator
trait itself. - Several traits that implement Rust's conventions for type
conversions,
AsMut
,AsRef
,From
, andInto
have been centralized in thestd::convert
module. - The
FromError
trait was removed in favor ofFrom
. - The basic sleep function has moved to
std::thread::sleep_ms
. - The
splitn
function now takes ann
parameter that represents the number of items yielded by the returned iterator instead of the number of 'splits'. - On Unix, all file descriptors are
CLOEXEC
by default. - Derived implementations of
PartialOrd
now order enums according to their explicitly-assigned discriminants. - Methods for searching strings are generic over
Pattern
s, implemented presently by&char
,&str
,FnMut(char) -> bool
and some others. - In method resolution, object methods are resolved before inherent methods.
String::from_str
has been deprecated in favor of theFrom
impl,String::from
.io::Error
implementsSync
.- The
words
method on&str
has been replaced withsplit_whitespace
, to avoid answering the tricky question, 'what is a word?' - The new path and IO modules are complete and
#[stable]
. This was the major library focus for this cycle. - The path API was revised to normalize
.
, adjusting the tradeoffs in favor of the most common usage. - A large number of remaining APIs in
std
were also stabilized during this cycle; about 75% of the non-deprecated API surface is now stable. - The new string pattern API landed, which makes the string slice API much more internally consistent and flexible.
- A new set of generic conversion traits replaced many existing ad hoc traits.
- Generic numeric traits were completely removed. This was made possible thanks to inherent methods for primitive types, and the removal gives maximal flexibility for designing a numeric hierarchy in the future.
- The
Fn
traits are now related via inheritance and provide ergonomic blanket implementations. - The
Index
andIndexMut
traits were changed to take the index by value, enabling code likehash_map["string"]
to work. Copy
now inherits fromClone
, meaning that allCopy
data is known to beClone
as well.
- Many errors now have extended explanations that can be accessed with
the
--explain
flag torustc
. - Many new examples have been added to the standard library documentation.
- rustdoc has received a number of improvements focused on completion and polish.
- Metadata was tuned, shrinking binaries by 27%.
- Much headway was made on ecosystem-wide CI, making it possible to compare builds for breakage.
-
~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 atstd::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.
- The various I/O modules were overhauled to reduce
unnecessary abstractions and provide better interoperation with
the underlying platform. The old
-
Language
for
loops now operate on theIntoIterator
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 thatfor 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 implementDrop
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 typeU
, 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
andString
formatting traits have been renamed toDebug
andDisplay
to more clearly reflect their related purposes. Automatically getting a string conversion to use withformat!("{:?}", 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
andBox::from_raw
functions convert betweenBox<T>
and*mut T
, a common pattern for creating raw pointers.
- The
-
Tooling
- Certain long error messages of the form 'expected foo found bar' are now split neatly across multiple lines. Examples in the PR.
- On Unix Rust can be uninstalled by running
/usr/local/lib/rustlib/uninstall.sh
. - The
#[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
- Rust is tested against a LALR grammar, which parses almost all the Rust files that rustc does.
-
~2400 changes, numerous bugfixes
-
Highlights
- The language itself is considered feature complete for 1.0, though there will be many usability improvements and bugfixes before the final release.
- Nearly 50% of the public API surface of the standard library has been declared 'stable'. Those interfaces are unlikely to change before 1.0.
- The long-running debate over integer types has been
[settled][ints]: Rust will ship with types named
isize
andusize
, rather thanint
anduint
, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle. - Most crates that are not
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'. - Documentation continues to be expanded with more API coverage, more examples, and more in-depth explanations. The guides have been consolidated into [The Rust Programming Language][trpl].
- "[Rust By Example][rbe]" is now maintained by the Rust team.
- All official Rust binary installers now come with [Cargo], the Rust package manager.
-
Language
- Closures have been [completely redesigned][unboxed] to be implemented in terms of traits, can now be used as generic type bounds and thus monomorphized and inlined, or via an opaque pointer (boxed) as in the old system. The new system is often referred to as 'unboxed' closures.
- Traits now support [associated types][assoc], allowing families of related types to be defined toget