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 inert attributes from
proc_macro_derives
- During crate resolution, rustc prefers a crate in the sysroot if two crates are otherwise identical. Unlikely to be encountered outside the Rust build system.
- Fixed bugs around how type inference interacts with dead-code. The existing code generally ignores the type of dead-code unless a type-hint is provided; this can cause surprising inference interactions particularly around defaulting. The new code uniformly ignores the result type of dead-code.
- Tuple-struct constructors with private fields are no longer visible
- Lifetime parameters that do not appear in the arguments are now considered early-bound, resolving a soundness bug (#32330). The
hr_lifetime_in_assoc_type
future-compatibility lint has been in effect since April of 2016. - rustdoc: fix doctests with non-feature crate attributes
- Make transmuting from fn item types to pointer-sized types a hard error