Rust versions / 1.16
Rust release · Mar 16, 2017
Rust 1.16: what's new, what was stabilized
Short answerRust 1.16 was released on Mar 16, 2017: 21 newly stable APIs (VecDeque::truncate, VecDeque::resize, String::insert_str, Duration::checked_add, ...); 6 compatibility notes that can affect existing code.
← Rust 1.15All versionsRust 1.17 →
21 APIs stabilized
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
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- [Uninhabitable enums (those without any variants) no longer permit wildcard
- In this release, references to uninhabited types can not be
- [The compiler's
dead_codelint now accounts for type aliases][38051]. - [Ctrl-Z returns from
Stdin.read()when reading from the console on - [Clean up semantics of
selfin an import list][38313] - Reimplemented lifetime elision. This change was almost entirely compatible
Use it
rustup update stable # get the newest release
rustup install 1.16 # or exactly this one
rustup override set 1.16 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.16" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- [The compiler's
dead_codelint now accounts for type aliases][38051]. - [Uninhabitable enums (those without any variants) no longer permit wildcard match patterns][38069]
- [Clean up semantics of
selfin an import list][38313] - [
Selfmay appear inimplheaders][38920] - [
Selfmay appear in struct expressions][39282]
Compiler
- [
rustcnow supports--emit=metadata, which causes rustc to emit a.rmetafile containing only crate metadata][38571]. 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][38927]. 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>whereTrequires a bigger alignment thanU][38670] - [rustc: use -Xlinker when specifying an rpath with ',' in it][38798]
- [
rustcno longer attempts to provide "consider using an explicit lifetime" suggestions][37057]. 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_searchand[T]::binary_search_by_keynow take their argument byBorrowparameter][37761] - [All public types in std implement
Debug][38006] - [
IpAddrimplementsFrom<Ipv4Addr>andFrom<Ipv6Addr>][38327] - [
Ipv6AddrimplementsFrom<[u16; 8]>][38131] - [Ctrl-Z returns from
Stdin.read()when reading from the console on Windows][38274] - [std: Fix partial writes in
LineWriter][38062] - [std: Clamp max read/write sizes on Unix][38622]
- [Use more specific panic message for
&strslicing errors][38066] - [
TcpListener::set_only_v6is deprecated][38304]. 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][38469] - [Implement
iter::Sumanditer::ProductforResult][38580] - [Reduce the size of static data in
std_unicode::tables][38781] - [
char::EscapeDebug,EscapeDefault,EscapeUnicode,CaseMappingIter,ToLowercase,ToUppercase, implementDisplay][38909] - [
DurationimplementsSum][38712] - [
StringimplementsToSocketAddrs][39048]
Cargo
- [The
cargo checkcommand does a type check of a project without building it][cargo/3296] - [crates.io will display CI badges from Travis and AppVeyor, if specified in Cargo.toml][cargo/3546]
- [crates.io will display categories listed in Cargo.toml][cargo/3301]
- [Compilation profiles accept integer values for
debug, in addition totrueandfalse. These are passed torustcas the value to-C debuginfo][cargo/3534] - [Implement
cargo --version --verbose][cargo/3604] - [All builds now output 'dep-info' build dependencies compatible with make and ninja][cargo/3557]
- [Build all workspace members with
build --all][cargo/3511] - [Document all workspace members with
doc --all][cargo/3515] - [Path deps outside workspace are not members][cargo/3443]
Misc
- [
rustdochas a--sysrootargument that, likerustc, specifies the path to the Rust implementation][38589] - [The
armv7-linux-androideabitarget no longer enables NEON extensions, per Google's ABI guide][38413] - [The stock standard library can be compiled for Redox OS][38401]
- [Rust has initial SPARC support][38726]. Tier 3. No builds available.
- [Rust has experimental support for Nvidia PTX][38559]. Tier 3. No builds available.
- [Fix backtraces on i686-pc-windows-gnu by disabling FPO][39379]
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_codelint now accounts for type aliases. - Ctrl-Z returns from
Stdin.read()when reading from the console on Windows - Clean up semantics of
selfin 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.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.17Released Apr 27, 2017.Read it next →Also worth your time
Did this answer your question?