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.