Releases: rust-lang/rust
Rust 1.20.0
Language
Compiler
- Struct fields are now properly coerced to the expected field type.
- Enabled wasm LLVM backend WASM can now be built with the
wasm32-experimental-emscripten
target. - Changed some of the error messages to be more helpful.
- Add support for RELRO(RELocation Read-Only) for platforms that support it.
- rustc now reports the total number of errors on compilation failure previously this was only the number of errors in the pass that failed.
- Expansion in rustc has been sped up 29x.
- added
msp430-none-elf
target. - rustc will now suggest one-argument enum variant to fix type mismatch when applicable
- Fixes backtraces on Redox
- rustc now identifies different versions of same crate when absolute paths of different types match in an error message.
Libraries
- Relaxed Debug constraints on
{HashMap,BTreeMap}::{Keys,Values}
. - Impl
PartialEq
,Eq
,PartialOrd
,Ord
,Debug
,Hash
for unsized tuples. - Impl
fmt::{Display, Debug}
forRef
,RefMut
,MutexGuard
,RwLockReadGuard
,RwLockWriteGuard
- Impl
Clone
forDefaultHasher
. - Impl
Sync
forSyncSender
. - Impl
FromStr
forchar
- Fixed how
{f32, f64}::{is_sign_negative, is_sign_positive}
handles NaN. - allow messages in the
unimplemented!()
macro. ie.unimplemented!("Waiting for 1.21 to be stable")
pub(restricted)
is now supported in thethread_local!
macro.- Upgrade to Unicode 10.0.0
- Reimplemented
{f32, f64}::{min, max}
in Rust instead of using CMath. - Skip the main thread's manual stack guard on Linux
- Iterator::nth for
ops::{Range, RangeFrom}
is now done in O(1) time #[repr(align(N))]
attribute max number is now 2^31 - 1. This was previously 2^15.{OsStr, Path}::Display
now avoids allocations where possible
Stabilized APIs
CStr::into_c_string
CString::as_c_str
CString::into_boxed_c_str
Chain::get_mut
Chain::get_ref
Chain::into_inner
Option::get_or_insert_with
Option::get_or_insert
OsStr::into_os_string
OsString::into_boxed_os_str
Take::get_mut
Take::get_ref
Utf8Error::error_len
char::EscapeDebug
char::escape_debug
compile_error!
f32::from_bits
f32::to_bits
f64::from_bits
f64::to_bits
mem::ManuallyDrop
slice::sort_unstable_by_key
slice::sort_unstable_by
slice::sort_unstable
str::from_boxed_utf8_unchecked
str::as_bytes_mut
str::as_bytes_mut
str::from_utf8_mut
str::from_utf8_unchecked_mut
str::get_mut
str::get_unchecked_mut
str::get_unchecked
str::get
str::into_boxed_bytes
Cargo
- Cargo API token location moved from
~/.cargo/config
to~/.cargo/credentials
. - Cargo will now build
main.rs
binaries that are in sub-directories ofsrc/bin
. ie. Havingsrc/bin/server/main.rs
andsrc/bin/client/main.rs
generatestarget/debug/server
andtarget/debug/client
- You can now specify version of a binary when installed through
cargo install
using--vers
. - Added
--no-fail-fast
flag to cargo to run all benchmarks regardless of failure. - Changed the convention around which file is the crate root.
Compatibility Notes
Rust 1.19.0
Language
- Numeric fields can now be used for creating tuple structs. RFC 1506 For example
struct Point(u32, u32); let x = Point { 0: 7, 1: 0 };
. - Macro recursion limit increased to 1024 from 64.
- Added lint for detecting unused macros.
loop
can now return a value withbreak
. RFC 1624 For example:let x = loop { break 7; };
- C compatible
union
s are now available. RFC 1444 They can only containCopy
types and cannot have aDrop
implementation. Example:union Foo { bar: u8, baz: usize }
- Non capturing closures can now be coerced into
fn
s, RFC 1558 Example:let foo: fn(u8) -> u8 = |v: u8| { v };
Compiler
- Add support for bootstrapping the Rust compiler toolchain on Android.
- Change
arm-linux-androideabi
to correspond to thearmeabi
official ABI. If you wish to continue targeting thearmeabi-v7a
ABI you should use--target armv7-linux-androideabi
. - Fixed ICE when removing a source file between compilation sessions.
- Minor optimisation of string operations.
- Compiler error message is now
aborting due to previous error(s)
instead ofaborting due to N previous errors
This was previously inaccurate and would only count certain kinds of errors. - The compiler now supports Visual Studio 2017
- The compiler is now built against LLVM 4.0.1 by default
- Added a lot of new error codes
- Added
target-feature=+crt-static
option RFC 1721 Which allows libraries with C Run-time Libraries(CRT) to be statically linked. - Fixed various ARM codegen bugs
Libraries
String
now implementsFromIterator<Cow<'a, str>>
andExtend<Cow<'a, str>>
Vec
now implementsFrom<&mut [T]>
Box<[u8]>
now implementsFrom<Box<str>>
SplitWhitespace
now implementsClone
[u8]::reverse
is now 5x faster and[u16]::reverse
is now 1.5x fastereprint!
andeprintln!
macros added to prelude. Same as theprint!
macros, but for printing to stderr.
Stabilized APIs
Cargo
- Build scripts can now add environment variables to the environment the crate is being compiled in. Example:
println!("cargo:rustc-env=FOO=bar");
- Subcommands now replace the current process rather than spawning a new child process
- Workspace members can now accept glob file patterns
- Added
--all
flag to thecargo bench
subcommand to run benchmarks of all the members in a given workspace. - Updated
libssh2-sys
to 0.2.6 - Target directory path is now in the cargo metadata
- Cargo no longer checks out a local working directory for the crates.io index This should provide smaller file size for the registry, and improve cloning times, especially on Windows machines.
- Added an
--exclude
option for excluding certain packages when using the--all
option - Cargo will now automatically retry when receiving a 5xx error from crates.io
- The
--features
option now accepts multiple comma or space delimited values. - Added support for custom target specific runners
Misc
- Added
rust-windbg.cmd
for loading rust.natvis
files in the Windows Debugger. - Rust will now release XZ compressed packages
- rustup will now prefer to download rust packages with XZ compression over GZip packages.
- Added the ability to escape
#
in rust documentation By adding additional#
's ie.##
is now#
Compatibility Notes
MutexGuard<T>
may only beSync
ifT
isSync
.-Z
flags are now no longer allowed to be used on the stable compiler. This has been a warning for a year previous to this.- As a result of the
-Z
flag change, thecargo-check
plugin no longer works. Users should migrate to the built-incheck
command, which has been available since 1.16. - Ending a float literal with
._
is now a hard error. Example:42._
. - Any use of a private
extern crate
outside of its module is now a hard error. This was previously a warning. use ::self::foo;
is now a hard error.self
paths are always relative while the::
prefix makes a path absolute, but was ignored and the path was relative regardless.- Floating point constants in match patterns is now a hard error This was previously a warning.
- Struct or enum constants that don't derive
PartialEq
&Eq
used match patterns is now a hard error This was previously a warning. - Lifetimes named
'_
are no longer allowed. This was previously a warning. - From the pound escape, lines consisting of multiple
#
s are now visible - It is an error to re-export private enum variants. This is known to break a number of crates that depend on an older version of mustache.
- On Windows, if
VCINSTALLDIR
is set incorrectly,rustc
will try to use it to find the linker, and the build will fail where it did not previously
Rust 1.18.0
Language
- Stabilize pub(restricted)
pub
can now accept a module path to make the item visible to just that module tree. Also accepts the keywordcrate
to make something public to the whole crate but not users of the library. Example:pub(crate) mod utils;
. RFC 1422. - Stabilize
#![windows_subsystem]
attribute conservative exposure of the/SUBSYSTEM
linker flag on Windows platforms. RFC 1665. - Refactor of trait object type parsing Now
ty
in macros can accept types likeWrite + Send
, trailing+
are now supported in trait objects, and better error reporting for trait objects starting with?Sized
. - 0e+10 is now a valid floating point literal
- Now warns if you bind a lifetime parameter to 'static
- Tuples, Enum variant fields, and structs with no
repr
attribute or with#[repr(Rust)]
are reordered to minimize padding and produce a smaller representation in some cases.
Compiler
- rustc can now emit mir with
--emit mir
- Improved LLVM IR for trivial functions
- Added explanation for E0090(Wrong number of lifetimes are supplied)
- rustc compilation is now 15%-20% faster Thanks to optimisation opportunities found through profiling
- Improved backtrace formatting when panicking
Libraries
- Specialized
Vec::from_iter
being passedvec::IntoIter
if the iterator hasn't been advanced the originalVec
is reassembled with no actual iteration or reallocation. - Simplified HashMap Bucket interface provides performance improvements for iterating and cloning.
- Specialize Vec::from_elem to use calloc
- Fixed Race condition in fs::create_dir_all
- No longer caching stdio on Windows
- Optimized insertion sort in slice insertion sort in some cases 2.50%~ faster and in one case now 12.50% faster.
- Optimized
AtomicBool::fetch_nand
Stabilized APIs
Child::try_wait
HashMap::retain
HashSet::retain
PeekMut::pop
TcpStream::peek
UdpSocket::peek
UdpSocket::peek_from
Cargo
- Added partial Pijul support Pijul is a version control system in Rust. You can now create new cargo projects with Pijul using
cargo new --vcs pijul
- Now always emits build script warnings for crates that fail to build
- Added Android build support
- Added
--bins
and--tests
flags now you can build all programs of a certain type, for examplecargo build --bins
will build all binaries. - Added support for haiku
Misc
- rustdoc can now use pulldown-cmark with the
--enable-commonmark
flag - Rust now uses the official cross compiler for NetBSD
- rustdoc now accepts
#
at the start of files - Fixed jemalloc support for musl
Compatibility Notes
-
Changes to how the
0
flag works in format! Padding zeroes are now always placed after the sign if it exists and before the digits. With the#
flag the zeroes are placed after the prefix and before the digits. -
Due to the struct field optimisation, using
transmute
on structs that have norepr
attribute or#[repr(Rust)]
will no longer work. This has always been undefined behavior, but is now more likely to break in practice. -
The refactor of trait object type parsing fixed a bug where
+
was receiving the wrong priority parsing things like&for<'a> Tr<'a> + Send
as&(for<'a> Tr<'a> + Send)
instead of(&for<'a> Tr<'a>) + Send
-
rustc main.rs -o out --emit=asm,llvm-ir
Now will outputout.asm
andout.ll
instead of only one of the filetypes. -
calling a function that returns
Self
will no longer work when the size ofSelf
cannot be statically determined. -
rustc now builds with a "pthreads" flavour of MinGW for Windows GNU this has caused a few regressions namely:
- Changed the link order of local static/dynamic libraries (respecting the order on given rather than having the compiler reorder).
- Changed how MinGW is linked, native code linked to dynamic libraries may require manually linking to the gcc support library (for the native code itself)
Rust 1.17.0
Language
- The lifetime of statics and consts defaults to
'static
. RFC 1623 - Fields of structs may be initialized without duplicating the field/variable names. RFC 1682
Self
may be included in thewhere
clause ofimpls
. RFC 1647- When coercing to an unsized type lifetimes must be equal. That is, there is no subtyping between
T
andU
whenT: Unsize<U>
. For example, coercing&mut [&'a X; N]
to&mut [&'b X]
requires'a
be equal to'b
. Soundness fix. - Values passed to the indexing operator,
[]
, automatically coerce - Static variables may contain references to other statics
Compiler
- Exit quickly on only
--emit dep-info
- Make
-C relocation-model
more correctly determine whether the linker creates a position-independent executable - Add
-C overflow-checks
to directly control whether integer overflow panics - The rustc type checker now checks items on demand instead of in a single in-order pass. This is mostly an internal refactoring in support of future work, including incremental type checking, but also resolves RFC 1647, allowing
Self
to appear inimpl
where
clauses. - Optimize vtable loads
- Turn off vectorization for Emscripten targets
- Provide suggestions for unknown macros imported with
use
- Fix ICEs in path resolution
- Strip exception handling code on Emscripten when
panic=abort
- Add clearer error message using
&str + &str
Stabilized APIs
Arc::into_raw
Arc::from_raw
Arc::ptr_eq
Rc::into_raw
Rc::from_raw
Rc::ptr_eq
Ordering::then
Ordering::then_with
BTreeMap::range
BTreeMap::range_mut
collections::Bound
process::abort
ptr::read_unaligned
ptr::write_unaligned
Result::expect_err
Cell::swap
Cell::replace
Cell::into_inner
Cell::take
Libraries
BTreeMap
andBTreeSet
can iterate over rangesCell
can store non-Copy
types. RFC 1651String
implementsFromIterator<&char>
Box
implements a number of new conversions:From<Box<str>> for String
,From<Box<[T]>> for Vec<T>
,From<Box<CStr>> for CString
,From<Box<OsStr>> for OsString
,From<Box<Path>> for PathBuf
,Into<Box<str>> for String
,Into<Box<[T]>> for Vec<T>
,Into<Box<CStr>> for CString
,Into<Box<OsStr>> for OsString
,Into<Box<Path>> for PathBuf
,Default for Box<str>
,Default for Box<CStr>
,Default for Box<OsStr>
,From<&CStr> for Box<CStr>
,From<&OsStr> for Box<OsStr>
,From<&Path> for Box<Path>
ffi::FromBytesWithNulError
implementsError
andDisplay
- Specialize
PartialOrd<A> for [A] where A: Ord
- Slightly optimize
slice::sort
- Add
ToString
trait specialization forCow<'a, str>
andString
Box<[T]>
implementsFrom<&[T]> where T: Copy
,Box<str>
implementsFrom<&str>
IpAddr
implementsFrom
for various arrays.SocketAddr
implementsFrom<(I, u16)> where I: Into<IpAddr>
format!
estimates the needed capacity before writing a string- Support unprivileged symlink creation in Windows
PathBuf
implementsDefault
- Implement
PartialEq<[A]>
forVecDeque<A>
HashMap
resizes adaptively to guard against DOS attacks and poor hash functions.
Cargo
- Add
cargo check --all
- Add an option to ignore SSL revocation checking
- Add
cargo run --package
- Add
required_features
- Assume
build.rs
is a build script - Find workspace via
workspace_root
link in containing member
Misc
- Documentation is rendered with mdbook instead of the obsolete, in-tree
rustbook
- The "Unstable Book" documents nightly-only features
- Improve the style of the sidebar in rustdoc output
- Configure build correctly on 64-bit CPU's with the armhf ABI
- Fix MSP430 breakage due to
i128
- Preliminary Solaris/SPARCv9 support
rustc
is linked statically on Windows MSVC targets, allowing it to run without installing the MSVC runtime.rustdoc --test
includes file names in test names- This release includes builds of
std
forsparc64-unknown-linux-gnu
,aarch64-unknown-linux-fuchsia
, andx86_64-unknown-linux-fuchsia
. - Initial support for
aarch64-unknown-freebsd
- Initial support for
i686-unknown-netbsd
- This release no longer includes the old makefile build system. Rust is built with a custom build system, written in Rust, and with Cargo.
- Add Debug implementations for libcollection structs
TypeId
implementsPartialOrd
andOrd
--test-threads=0
produces an errorrustup
installs documentation by default- The Rust source includes NatVis visualizations. These can be used by WinDbg and Visual Studio to improve the debugging experience.
Compatibility Notes
- Rust 1.17 does not correctly detect the MSVC 2017 linker. As a workaround, either use MSVC 2015 or run vcvars.bat.
- When coercing to an unsized type lifetimes must be equal. That is, disallow subtyping between
T
andU
whenT: Unsize<U>
, e.g. coercing&mut [&'a X; N]
to&mut [&'b X]
requires'a
be equal to'b
. Soundness fix. format!
andDisplay::to_string
panic if an underlying formatting implementation returns an error. Previously the error was silently ignored. It is incorrect forwrite_fmt
to return an error when writing to a string.- In-tree crates are verified to be unstable. Previously, some minor crates were marked stable and could be accessed from the stable toolchain.
- Rust git source no longer includes vendored crates. Those that need to build with vendored crates should build from release tarballs.
- [Fix i...
Rust 1.16.0
Language
- The compiler's
dead_code
lint now accounts for type aliases. - Uninhabitable enums (those without any variants) no longer permit wildcard match patterns
- Clean up semantics of
self
in an import list Self
may appear inimpl
headersSelf
may appear in struct expressions
Compiler
rustc
now supports--emit=metadata
, which causes rustc to emit a.rmeta
file containing only crate metadata. This can be used by tools like the Rust Language Service to perform metadata-only builds.- Levenshtein based typo suggestions now work in most places, while previously they worked only for fields and sometimes for local variables. Together with the overhaul of "no resolution"/"unexpected resolution" errors (#38154) they result in large and systematic improvement in resolution diagnostics.
- Fix
transmute::<T, U>
whereT
requires a bigger alignment thanU
- rustc: use -Xlinker when specifying an rpath with ',' in it
rustc
no longer attempts to provide "consider using an explicit lifetime" suggestions. They were inaccurate.
Stabilized APIs
VecDeque::truncate
VecDeque::resize
String::insert_str
Duration::checked_add
Duration::checked_sub
Duration::checked_div
Duration::checked_mul
str::replacen
str::repeat
SocketAddr::is_ipv4
SocketAddr::is_ipv6
IpAddr::is_ipv4
IpAddr::is_ipv6
Vec::dedup_by
Vec::dedup_by_key
Result::unwrap_or_default
<*const T>::wrapping_offset
<*mut T>::wrapping_offset
CommandExt::creation_flags
File::set_permissions
String::split_off
Libraries
[T]::binary_search
and[T]::binary_search_by_key
now take their argument byBorrow
parameter- All public types in std implement
Debug
IpAddr
implementsFrom<Ipv4Addr>
andFrom<Ipv6Addr>
Ipv6Addr
implementsFrom<[u16; 8]>
- Ctrl-Z returns from
Stdin.read()
when reading from the console on Windows - std: Fix partial writes in
LineWriter
- std: Clamp max read/write sizes on Unix
- Use more specific panic message for
&str
slicing errors TcpListener::set_only_v6
is deprecated. This functionality cannot be achieved in std currently.writeln!
, likeprintln!
, now accepts a form with no string or formatting arguments, to just print a newline- Implement
iter::Sum
anditer::Product
forResult
- Reduce the size of static data in
std_unicode::tables
char::EscapeDebug
,EscapeDefault
,EscapeUnicode
,CaseMappingIter
,ToLowercase
,ToUppercase
, implementDisplay
Duration
implementsSum
String
implementsToSocketAddrs
Cargo
- The
cargo check
command does a type check of a project without building it - crates.io will display CI badges from Travis and AppVeyor, if specified in Cargo.toml
- crates.io will display categories listed in Cargo.toml
- Compilation profiles accept integer values for
debug
, in addition totrue
andfalse
. These are passed torustc
as the value to-C debuginfo
- Implement
cargo --version --verbose
- All builds now output 'dep-info' build dependencies compatible with make and ninja
- Build all workspace members with
build --all
- Document all workspace members with
doc --all
- Path deps outside workspace are not members
Misc
rustdoc
has a--sysroot
argument that, likerustc
, specifies the path to the Rust implementation- The
armv7-linux-androideabi
target no longer enables NEON extensions, per Google's ABI guide - The stock standard library can be compiled for Redox OS
- Rust has initial SPARC support. Tier 3. No builds available.
- Rust has experimental support for Nvidia PTX. Tier 3. No builds available.
- Fix backtraces on i686-pc-windows-gnu by disabling FPO
Compatibility Notes
- Uninhabitable enums (those without any variants) no longer permit wildcard match patterns
- In this release, references to uninhabited types can not be pattern-matched. This was accidentally allowed in 1.15.
- The compiler's
dead_code
lint now accounts for type aliases. - Ctrl-Z returns from
Stdin.read()
when reading from the console on Windows - Clean up semantics of
self
in an import list - Reimplemented lifetime elision. This change was almost entirely compatible with existing code, but it did close a number of small bugs and loopholes, as well as being more accepting in some other cases.
Rust 1.15.1
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.