Releases: rust-lang/rust
Releases · rust-lang/rust
Rust 1.15.0
Language
- Basic procedural macros allowing custom
#[derive]
, aka "macros 1.1", are stable. This allows popular code-generating crates like Serde and Diesel to work ergonomically. RFC 1681. - Tuple structs may be empty. Unary and empty tuple structs may be instantiated with curly braces. Part of RFC 1506.
- A number of minor changes to name resolution have been activated. They add up to more consistent semantics, allowing for future evolution of Rust macros. Specified in RFC 1560, see its section on "changes" for details of what is different. The breaking changes here have been transitioned through the
legacy_imports
lint since 1.14, with no known regressions. - In
macro_rules
,path
fragments can now be parsed as type parameter bounds ?Sized
can be used inwhere
clauses- There is now a limit on the size of monomorphized types and it can be modified with the
#![type_size_limit]
crate attribute, similarly to the#![recursion_limit]
attribute
Compiler
- On Windows, the compiler will apply dllimport attributes when linking to extern functions. Additional attributes and flags can control which library kind is linked and its name. RFC 1717.
- Rust-ABI symbols are no longer exported from cdylibs
- The
--test
flag works with procedural macro crates - Fix
extern "aapcs" fn
ABI - The
-C no-stack-check
flag is deprecated. It does nothing. - The
format!
expander recognizes incorrectprintf
and shell-style formatting directives and suggests the correct format. - Only report one error for all unused imports in an import list
Compiler Performance
- Avoid unnecessary
mk_ty
calls inTy::super_fold_with
- Avoid more unnecessary
mk_ty
calls inTy::super_fold_with
- Don't clone in
UnificationTable::probe
- Remove
scope_auxiliary
to cut RSS by 10% - Use small vectors in type walker
- Macro expansion performance was improved
- Change
HirVec<P<T>>
toHirVec<T>
inhir::Expr
- Replace FNV with a faster hash function
Stabilized APIs
std::iter::Iterator::min_by
std::iter::Iterator::max_by
std::os::*::fs::FileExt
std::sync::atomic::Atomic*::get_mut
std::sync::atomic::Atomic*::into_inner
std::vec::IntoIter::as_slice
std::vec::IntoIter::as_mut_slice
std::sync::mpsc::Receiver::try_iter
std::os::unix::process::CommandExt::before_exec
std::rc::Rc::strong_count
std::rc::Rc::weak_count
std::sync::Arc::strong_count
std::sync::Arc::weak_count
std::char::encode_utf8
std::char::encode_utf16
std::cell::Ref::clone
std::io::Take::into_inner
Libraries
- The standard sorting algorithm has been rewritten for dramatic performance improvements. It is a hybrid merge sort, drawing influences from Timsort. Previously it was a naive merge sort.
Iterator::nth
no longer has aSized
boundExtend<&T>
is specialized forVec
whereT: Copy
to improve performance.chars().count()
is much faster and so arechars().last()
andchar_indices().last()
- Fix ARM Objective-C ABI in
std::env::args
- Chinese characters display correctly in
fmt::Debug
- Derive
Default
forDuration
- Support creation of anonymous pipes on WinXP/2k
mpsc::RecvTimeoutError
implementsError
- Don't pass overlapped handles to processes
Cargo
- In this release, Cargo build scripts no longer have access to the
OUT_DIR
environment variable at build time viaenv!("OUT_DIR")
. They should instead check the variable at runtime withstd::env
. That the value was set at build time was a bug, and incorrect when cross-compiling. This change is known to cause breakage. - Add
--all
flag tocargo test
- Compile statically against the MSVC CRT
- Mix feature flags into fingerprint/metadata shorthash
- Link OpenSSL statically on OSX
- Apply new fingerprinting to build dir outputs
- Test for bad path overrides with summaries
- Require
cargo install --vers
to take a semver version - Fix retrying crate downloads for network errors
- Implement string lookup for
build.rustflags
config key - Emit more info on --message-format=json
- Assume
build.rs
in the same directory asCargo.toml
is a build script - Don't ignore errors in workspace manifest
- Fix
--message-format JSON
when rustc emits non-JSON warnings
Tooling
- Test runners (binaries built with
--test
) now support a--list
argument that lists the tests it contains - Test runners now support a
--exact
argument that makes the test filter match exactly, instead of matching only a substring of the test name - rustdoc supports a
--playground-url
flag - rustdoc provides more details about
#[should_panic]
errors
Misc
- The Rust build system is now written in Rust. The Makefiles may continue to be used in this release by passing
--disable-rustbuild
to the configure script, but they will be deleted soon. Note that the new build system uses a different on-disk layout that will likely affect any scripts building Rust. - Rust supports i686-unknown-openbsd. Tier 3 support. No testing or releases.
- Rust supports the MSP430. Tier 3 support. No testing or releases.
- Rust supports the ARMv5TE architecture. Tier 3 support. No testing or releases.
Compatibility Notes
- A number of minor changes to name resolution have been activated. They add up to more consistent semantics, allowing for future evolution of Rust macros. Specified in RFC 1560, see its section on "changes" for details of what is different. The breaking changes here have been transitioned through the [`lega...
Rust 1.14.0
Language
..
matches multiple tuple fields in enum variants, structs and tuples. RFC 1492.- Safe
fn
items can be coerced tounsafe fn
pointers use *
anduse ::*
both glob-import from the crate root- It's now possible to call a
Vec<Box<Fn()>>
without explicit dereferencing
Compiler
- Mark enums with non-zero discriminant as non-zero
- Lower-case
static mut
names are linted like other statics and consts - Fix ICE on some macros in const integer positions (e.g.
[u8; m!()]
) - Improve error message and snippet for "did you mean
x
" - Add a panic-strategy field to the target specification
- Include LLVM version in
--version --verbose
Compile-time Optimizations
- Improve macro expansion performance
- Shrink
Expr_::ExprInlineAsm
- Replace all uses of SHA-256 with BLAKE2b
- Reduce the number of bytes hashed by
IchHasher
- Avoid more allocations when compiling html5ever
- Use
SmallVector
inCombineFields::instantiate
- Avoid some allocations in the macro parser
- Use a faster deflate setting
- Add
ArrayVec
andAccumulateVec
to reduce heap allocations during interning of slices - Optimize
write_metadata
- Don't process obligation forest cycles when stalled
- Avoid many
CrateConfig
clones - Optimize
Substs::super_fold_with
- Optimize
ObligationForest
'sNodeState
handling - Speed up
plug_leaks
Libraries
println!()
, with no arguments, prints newline. Previously, an empty string was required to achieve the same.Wrapping
impls standard binary and unary operators, as well as theSum
andProduct
iterators- Implement
From<Cow<str>> for String
andFrom<Cow<[T]>> for Vec<T>
- Improve
fold
performance forchain
,cloned
,map
, andVecDeque
iterators - Improve
SipHasher
performance on small values - Add Iterator trait TrustedLen to enable better FromIterator / Extend
- Expand
.zip()
specialization to.map()
and.cloned()
ReadDir
implementsDebug
- Implement
RefUnwindSafe
for atomic types - Specialize
Vec::extend
toVec::extend_from_slice
- Avoid allocations in
Decoder::read_str
io::Error
implementsFrom<io::ErrorKind>
- Impl
Debug
for raw pointers to unsized data - Don't reuse
HashMap
random seeds - The internal memory layout of
HashMap
is more cache-friendly, for significant improvements in some operations HashMap
uses less memory on 32-bit architectures- Impl
Add<{str, Cow<str>}>
forCow<str>
Cargo
- Expose rustc cfg values to build scripts
- Allow cargo to work with read-only
CARGO_HOME
- Fix passing --features when testing multiple packages
- Use a single profile set per workspace
- Load
replace
sections from lock files - Ignore
panic
configuration for test/bench profiles
Tooling
- rustup is the recommended Rust installation method
- This release includes host (rustc) builds for Linux on MIPS, PowerPC, and S390x. These are tier 2 platforms and may have major defects. Follow the instructions on the website to install, or add the targets to an existing installation with
rustup target add
. The new target triples are:mips-unknown-linux-gnu
mipsel-unknown-linux-gnu
mips64-unknown-linux-gnuabi64
mips64el-unknown-linux-gnuabi64
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
s390x-unknown-linux-gnu
- This release includes target (std) builds for ARM Linux running MUSL libc. These are tier 2 platforms and may have major defects. Add the following triples to an existing rustup installation with
rustup target add
:arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
- This release includes experimental support for WebAssembly, via the
wasm32-unknown-emscripten
target. This target is known to have major defects. Please test, report, and fix. - rustup no longer installs documentation by default. Run
rustup component add rust-docs
to install. - Fix line stepping in debugger
- Enable line number debuginfo in releases
Misc
- Disable jemalloc on aarch64/powerpc/mips
- Add support for Fuchsia OS
- Detect local-rebuild by only MAJOR.MINOR version
Compatibility Notes
- A number of forward-compatibility lints used by the compiler to gradually introduce language changes have been converted to deny by default:
- "use of inaccessible extern crate erroneously allowed"
- "type parameter default erroneously allowed in invalid location"
- "detects super or self keywords at the beginning of global path"
- "two overlapping inherent impls define an item with the same name were erroneously allowed"
- "floating-point constants cannot be used in patterns"
- "constants of struct or enum type can only be used in a pattern if the struct or enum has
#[derive(PartialEq, Eq)]
" - "lifetimes or labels named
'_
were erroneously allowed"
- Prohibit patterns in trait methods without bodies
- The atomic
Ordering
enum may not be matched exhaustively - Future-proofing
#[no_link]
breaks some obscure cases - The
$crate
macro variable is accepted in fewer locations - Impls specifying extra region requirements beyond the trait they implement are rejected
- Enums may not be unsized. Unsized enums are intended to work but never have. For now they are forbidden.
- Enforce the shadowing restrictions from RFC 1560 for today's macros
Rust 1.13.0
Language
- Stabilize the
?
operator.?
is a simple way to propagate errors, like thetry!
macro, described in RFC 0243. - Stabilize macros in type position. Described in RFC 873.
- Stabilize attributes on statements. Described in RFC 0016.
- Fix
#[derive]
for empty tuple structs/variants - Fix lifetime rules for 'if' conditions
- Avoid loading and parsing unconfigured non-inline modules
Compiler
- Add the
-C link-arg
argument - Remove the old AST-based backend from rustc_trans
- Don't enable NEON by default on armv7 Linux
- Fix debug line number info for macro expansions
- Do not emit "class method" debuginfo for types that are not DICompositeType
- Warn about multiple conflicting #[repr] hints
- When sizing DST, don't double-count nested struct prefixes
- Default RUST_MIN_STACK to 16MiB for now
- Improve rlib metadata format. Reduces rlib size significantly.
- Reject macros with empty repetitions to avoid infinite loop
- Expand macros without recursing to avoid stack overflows
Diagnostics
- Replace macro backtraces with labeled local uses
- Improve error message for misplaced doc comments
- Buffer unix and lock windows to prevent message interleaving
- Update lifetime errors to specifically note temporaries
- Special case a few colors for Windows
- Suggest
use self
when such an import resolves - Be more specific when type parameter shadows primitive type
- Many minor improvements
Compile-time Optimizations
- Compute and cache HIR hashes at beginning
- Don't hash types in loan paths
- Cache projections in trans
- Optimize the parser's last token handling
- Only instantiate #[inline] functions in codegen units referencing them. This leads to big improvements in cases where crates export define many inline functions without using them directly.
- Lazily allocate TypedArena's first chunk
- Don't allocate during default HashSet creation
Stabilized APIs
Libraries
- Add
assert_ne!
anddebug_assert_ne!
- Make
vec_deque::Drain
,hash_map::Drain
, andhash_set::Drain
covariant - Implement
AsRef<[T]>
forstd::slice::Iter
- Implement
Debug
forstd::vec::IntoIter
CString
: avoid excessive growth just to 0-terminate- Implement
CoerceUnsized
for{Cell, RefCell, UnsafeCell}
- Use arc4rand on FreeBSD
- memrchr: Correct aligned offset computation
- Improve Demangling of Rust Symbols
- Use monotonic time in condition variables
- Implement
Debug
forstd::path::{Components,Iter}
- Implement conversion traits for
char
- Fix illegal instruction caused by overflow in channel cloning
- Zero first byte of CString on drop
- Inherit overflow checks for sum and product
- Add missing Eq implementations
- Implement
Debug
forDirEntry
- When
getaddrinfo
returnsEAI_SYSTEM
retrieve actual error fromerrno
SipHasher
is deprecated. UseDefaultHasher
.- Implement more traits for
std::io::ErrorKind
- Optimize BinaryHeap bounds checking
- Work around pointer aliasing issue in
Vec::extend_from_slice
,extend_with_element
- Fix overflow checking in unsigned pow()
Cargo
- This release includes security fixes to both curl and OpenSSL.
- Fix transitive doctests when panic=abort
- Add --all-features flag to cargo
- Reject path-based dependencies in
cargo package
- Don't parse the home directory more than once
- Don't try to generate Cargo.lock on empty workspaces
- Update OpenSSL to 1.0.2j
- Add license and license_file to cargo metadata output
- Make crates-io registry URL optional in config; ignore all changes to source.crates-io
- Don't download dependencies from other platforms
- Build transitive dev-dependencies when needed
- Add support for per-target rustflags in .cargo/config
- Avoid updating registry when adding existing deps
- Warn about path overrides that won't work
- Use workspaces during
cargo install
- Leak mspdbsrv.exe processes on Windows
- Add --message-format flag
- Pass target environment for rustdoc
- Use
CommandExt::exec
forcargo run
on Unix - Update curl and curl-sys
- Call rustdoc test with the correct cfg flags of a package
Tooling
- rustdoc: Add the
--sysroot
argument - rustdoc: Fix a couple of issues with the search results
- rustdoc: remove the
!
from macro URLs and titles - gdb: Fix pretty-printing special-cased Rust types
- rustdoc: Filter more incorrect methods inherited through Deref
Misc
- Remove unmaintained style guide
- Add s390x support
- Initial work at Haiku OS support
- Add mips-uclibc targets
- Crate-ify compiler-rt into compiler-builtins
- Add rustc version info (git hash + date) to dist tarball
- Many documentation improvements
Compatibility Notes
SipHasher
is deprecated. UseDefaultHasher
.- Deny (by default) transmuting from fn item types to pointer-sized types. Continuing the long transition to zero-sized fn items, per [RFC 401](https://github.com/rust-lang/rfcs/blob/master/text/0...
Rust 1.12.1
Regression Fixes
- ICE: 'rustc' panicked at 'assertion failed: concrete_substs.is_normalized_for_trans()' #36381
- Confusion with double negation and booleans
- rustc 1.12.0 fails with SIGSEGV in release mode (syn crate 0.8.0)
- Rustc 1.12.0 Windows build of
ethcore
crate fails with LLVM error - 1.12.0: High memory usage when linking in release mode with debug info
- Corrupted memory after updated to 1.12
- "Let NullaryConstructor = something;" causes internal compiler error: "tried to overwrite interned AdtDef"
- Fix ICE: inject bitcast if types mismatch for invokes/calls/stores
- debuginfo: Handle spread_arg case in MIR-trans in a more stable way.
Rust 1.12.0
Highlights
rustc
translates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.rustc
presents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.
Compiler
rustc
translates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.- Print the Rust target name, not the LLVM target name, with
--print target-list
- The computation of
TypeId
is correct in some cases where it was previously producing inconsistent results - The
mips-unknown-linux-gnu
target uses hardware floating point by default - The
rustc
arguments,--print target-cpus
,--print target-features
,--print relocation-models
, and--print code-models
print the available options to the-C target-cpu
,-C target-feature
,-C relocation-model
and-C code-model
code generation arguments rustc
supports three new MUSL targets on ARM:arm-unknown-linux-musleabi
,arm-unknown-linux-musleabihf
, andarmv7-unknown-linux-musleabihf
. These targets produce statically-linked binaries. There are no binary release builds yet though.
Diagnostics
rustc
presents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.- In error descriptions, references are now described in plain English, instead of as "&-ptr"
- In error type descriptions, unknown numeric types are named
{integer}
or{float}
instead of_
rustc
emits a clearer error when inner attributes follow a doc comment
Language
macro_rules!
invocations can be made withinmacro_rules!
invocationsmacro_rules!
meta-variables are hygienicmacro_rules!
tt
matchers can be reparsed correctly, making them much more usefulmacro_rules!
stmt
matchers correctly consume the entire contents when inside non-braces invocations- Semicolons are properly required as statement delimiters inside
macro_rules!
invocations cfg_attr
works onpath
attributes
Stabilized APIs
Cell::as_ptr
RefCell::as_ptr
IpAddr::is_unspecified
IpAddr::is_loopback
IpAddr::is_multicast
Ipv4Addr::is_unspecified
Ipv6Addr::octets
LinkedList::contains
VecDeque::contains
ExitStatusExt::from_raw
. Both on Unix and Windows.Receiver::recv_timeout
RecvTimeoutError
BinaryHeap::peek_mut
PeekMut
iter::Product
iter::Sum
OccupiedEntry::remove_entry
VacantEntry::into_key
Libraries
- The
format!
macro and friends now allow a single argument to be formatted in multiple styles - The lifetime bounds on
[T]::binary_search_by
and[T]::binary_search_by_key
have been adjusted to be more flexible Option
implementsFrom
for its contained typeCell
,RefCell
andUnsafeCell
implementFrom
for their contained typeRwLock
panics if the reader count overflowsvec_deque::Drain
,hash_map::Drain
andhash_set::Drain
are covariantvec::Drain
andbinary_heap::Drain
are covariantCow<str>
implementsFromIterator
forchar
,&str
andString
- Sockets on Linux are correctly closed in subprocesses via
SOCK_CLOEXEC
hash_map::Entry
,hash_map::VacantEntry
andhash_map::OccupiedEntry
implementDebug
btree_map::Entry
,btree_map::VacantEntry
andbtree_map::OccupiedEntry
implementDebug
String
implementsAddAssign
- Variadic
extern fn
pointers implement theClone
,PartialEq
,Eq
,PartialOrd
,Ord
,Hash
,fmt::Pointer
, andfmt::Debug
traits FileType
implementsDebug
- References to
Mutex
andRwLock
are unwind-safe mpsc::sync_channel
Receiver
s return any available message before reporting a disconnect- Unicode definitions have been updated to 9.0
env
iterators implementDoubleEndedIterator
Cargo
- Support local mirrors of registries
- Add support for command aliases
- Allow
opt-level="s"
/opt-level="z"
in profile overrides - Make
cargo doc --open --target
work as expected - Speed up noop registry updates
- Update OpenSSL
- Fix
--panic=abort
with plugins - Always pass
-C metadata
to the compiler - Fix depending on git repos with workspaces
- Add a
--lib
flag tocargo new
- Add
http.cainfo
for custom certs - Indicate the compilation profile after compiling
- Allow enabling features for dependencies with
--features
- Add
--jobs
flag tocargo package
- Add
--dry-run
tocargo publish
- Add support for
RUSTDOCFLAGS
Performance
panic::catch_unwind
is more optimizedpanic::catch_unwind
no longer accesses thread-local storage on entry
Tooling
- Test binaries now support a
--test-threads
argument to specify the number of threads used to run tests, and which acts the same as theRUST_TEST_THREADS
environment variable - The test runner now emits a warning when tests run over 60 seconds
- rustdoc: Fix methods in search results
rust-lldb
warns about unsupported versions of LLDB- [Rust releases now come with source p...
Rust 1.11.0
Language
- Support nested
cfg_attr
attributes - Allow statement-generating braced macro invocations at the end of blocks
- Macros can be expanded inside of trait definitions
#[macro_use]
works properly when it is itself expanded from a macro
Stabilized APIs
BinaryHeap::append
BTreeMap::append
BTreeMap::split_off
BTreeSet::append
BTreeSet::split_off
f32::to_degrees
(in libcore - previously stabilized in libstd)f32::to_radians
(in libcore - previously stabilized in libstd)f64::to_degrees
(in libcore - previously stabilized in libstd)f64::to_radians
(in libcore - previously stabilized in libstd)Iterator::sum
Iterator::product
Cell::get_mut
RefCell::get_mut
Libraries
- The
thread_local!
macro supports multiple definitions in a single invocation, and can apply attributes Cow
implementsDefault
Wrapping
implements binary, octal, lower-hex and upper-hexDisplay
formatting- The range types implement
Hash
lookup_host
ignores unknown address typesassert_eq!
accepts a custom error message, likeassert!
does- The main thread is now called "main" instead of "<main>"
Cargo
- Disallow specifying features of transitive deps
- Add color support for Windows consoles
- Fix
harness = false
on[lib]
sections - Don't panic when
links
contains a '.' - Build scripts can emit warnings, and
-vv
prints warnings for all crates. - Ignore file locks on OS X NFS mounts
- Don't warn about
package.metadata
keys. This provides room for expansion by arbitrary tools. - Add support for cdylib crate types
- Prevent publishing crates when files are dirty
- Don't fetch all crates on clean
- Propagate --color option to rustc
- Fix
cargo doc --open
on Windows - Improve autocompletion
- Configure colors of stderr as well as stdout
Performance
- Caching projections speeds up type check dramatically for some workloads
- The default
HashMap
hasher is SipHash 1-3 instead of SipHash 2-4 This hasher is faster, but is believed to provide sufficient protection from collision attacks. - Comparison of
Ipv4Addr
is 10x faster
Rustdoc
- Fix empty implementation section on some module pages
- Fix inlined renamed re-exports in import lists
- Fix search result layout for enum variants and struct fields
- Fix issues with source links to external crates
- Fix redirect pages for renamed re-exports
Tooling
- rustc is better at finding the MSVC toolchain
- When emitting debug info, rustc emits frame pointers for closures, shims and glue, as it does for all other functions
- rust-lldb warns about unsupported versions of LLDB
- Many more errors have been given error codes and extended explanations
- API documentation continues to be improved, with many new examples
Misc
- rustc no longer hangs when dependencies recursively re-export submodules
- rustc requires LLVM 3.7+
- The 'How Safe and Unsafe Interact' chapter of The Rustonomicon was rewritten
- rustc support 16-bit pointer sizes. No targets use this yet, but it works toward AVR support.
Compatibility Notes
const
s andstatic
s may not have unsized types- The new follow-set rules that place restrictions on
macro_rules!
in order to ensure syntax forward-compatibility have been enabled This was an amendment to RFC 550, and has been a warning since 1.10. cfg
attribute process has been refactored to fix various bugs. This causes breakage in some corner cases.
Rust 1.10.0
Language
Copy
types are required to have a trivial implementation ofClone
. RFC 1521.- Single-variant enums support the
#[repr(..)]
attribute. - Fix
#[derive(RustcEncodable)]
in the presence of otherencode
methods. panic!
can be converted to a runtime abort with the-C panic=abort
flag. RFC 1513.- Add a new crate type, 'cdylib'. cdylibs are dynamic libraries suitable for loading by non-Rust hosts. RFC 1510. Note that Cargo does not yet directly support cdylibs.
Stabilized APIs
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
Default for sync::Weak
panic::set_hook
panic::take_hook
panic::PanicInfo
panic::PanicInfo::payload
panic::PanicInfo::location
panic::Location
panic::Location::file
panic::Location::line
ffi::CStr::from_bytes_with_nul
ffi::CStr::from_bytes_with_nul_unchecked
ffi::FromBytesWithNulError
fs::Metadata::modified
fs::Metadata::accessed
fs::Metadata::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
SocketAddr::as_pathname
UnixStream::connect
UnixStream::pair
UnixStream::try_clone
UnixStream::local_addr
UnixStream::peer_addr
UnixStream::set_read_timeout
UnixStream::set_write_timeout
UnixStream::read_timeout
UnixStream::write_timeout
UnixStream::set_nonblocking
UnixStream::take_error
UnixStream::shutdown
- Read/Write/RawFd impls for
UnixStream
UnixListener::bind
UnixListener::accept
UnixListener::try_clone
UnixListener::local_addr
UnixListener::set_nonblocking
UnixListener::take_error
UnixListener::incoming
- RawFd impls for
UnixListener
UnixDatagram::bind
UnixDatagram::unbound
UnixDatagram::pair
UnixDatagram::connect
UnixDatagram::try_clone
UnixDatagram::local_addr
UnixDatagram::peer_addr
UnixDatagram::recv_from
UnixDatagram::recv
UnixDatagram::send_to
UnixDatagram::send
UnixDatagram::set_read_timeout
UnixDatagram::set_write_timeout
UnixDatagram::read_timeout
UnixDatagram::write_timeout
UnixDatagram::set_nonblocking
UnixDatagram::take_error
UnixDatagram::shutdown
- RawFd impls for
UnixDatagram
{BTree,Hash}Map::values_mut
<[_]>::binary_search_by_key
Libraries
- The
abs_sub
method of floats is deprecated. 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.
- On Linux, if
HashMap
s can't be initialized withgetrandom
they will fall back to/dev/urandom
temporarily to avoid blocking during early boot. - Implemented negation for wrapping numerals.
- Implement
Clone
forbinary_heap::IntoIter
. - Implement
Display
andHash
forstd::num::Wrapping
. - Add
Default
implementation for&CStr
,CString
. - Implement
From<Vec<T>>
andInto<Vec<T>>
forVecDeque<T>
. - Implement
Default
forUnsafeCell
,fmt::Error
,Condvar
,Mutex
,RwLock
.
Cargo
- Cargo.toml supports the
profile.*.panic
option. 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. - Report status to stderr instead of stdout.
- Build scripts are passed a
CARGO_MANIFEST_LINKS
environment variable that corresponds to thelinks
field of the manifest. - Ban keywords from crate names.
- Canonicalize
CARGO_HOME
on Windows. - Retry network requests. 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#267...
Rust 1.9.0
Language
- 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.
Stabilized APIs
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:...
Rust 1.8.0
Language
- 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.
Libraries
- 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
.
Performance
- 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.
Misc
- 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
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
.
Compatibility Notes
- 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...
Rust 1.7.0
Libraries
- 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
.
Misc
- 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
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.
Compatibility Notes
- 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 br...