Rust versions / 1.6
Rust release · Jan 21, 2016
Rust 1.6: what's new, what was stabilized
Short answerRust 1.6 was released on Jan 21, 2016: 5 compatibility notes that can affect existing code.
← Rust 1.5All versionsRust 1.7 →
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:
- The compiler no longer makes use of the [
RUST_PATH][1.6rp] - [A number of bugs were fixed in the privacy checker][1.6p] that
- [Modules and unit/tuple structs may not share the same name][1.6ts].
- [Bugs in pattern matching unit structs were fixed][1.6us]. The tuple
- A bug was fixed that causes [rustc not to apply default type
Use it
rustup update stable # get the newest release
rustup install 1.6 # or exactly this one
rustup override set 1.6 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.6" 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
#![no_std]attribute causes a crate to not be linked to the standard library, but only the [core library][1.6co], 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.
Libraries
- 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][1.6co] is stable, as are most of its APIs.
- [The
assert_eq!macro supports arguments that don't implementSized][1.6ae], 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][1.6ms]. These includeCondvar::wait_timeout_ms,thread::sleep_ms, andthread::park_timeout_ms. - The algorithm by which
Vecreserves additional elements was [tweaked to not allocate excessive space][1.6a] while still growing exponentially. Fromconversions are [implemented from integers to floats][1.6f] in cases where the conversion is lossless. Thus they are not implemented for 32-bit ints tof32, nor for 64-bit ints tof32orf64. They are also not implemented forisizeandusizebecause the implementations would be platform-specific.Fromis also implemented fromf32tof64.From<&Path>andFrom<PathBuf>are implemented forCow<Path>.From<T>is implemented forBox<T>,Rc<T>andArc<T>.IntoIteratoris implemented for&PathBufand&Path.- [
BinaryHeapwas refactored][1.6bh] for modest performance improvements. - Sorting slices that are already sorted [is 50% faster in some cases][1.6s].
Cargo
- Cargo will look in
$CARGO_HOME/binfor subcommands [by default][1.6c]. - Cargo build scripts can specify their dependencies by emitting the [
rerun-if-changed][1.6rr] 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--releaseflag][1.6cc] to clean the release folder. A variety of artifacts that Cargo failed to clean are now correctly deleted.
Misc
- The
unreachable_codelint [warns when a function call's argument diverges][1.6dv]. - The parser indicates [failures that may be caused by confusingly-similar Unicode characters][1.6uc]
- Certain macro errors [are reported at definition time][1.6m], not expansion.
Compatibility Notes
- The compiler no longer makes use of the
RUST_PATHenvironment 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.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.7Released Mar 3, 2016.Read it next →Also worth your time
Did this answer your question?