Version 1.8.0 (2016-04-14)
Language
- Rust supports overloading of compound assignment statements like
+=by implementing theAddAssign,SubAssign,MulAssign,DivAssign,RemAssign,BitAndAssign,BitOrAssign,BitXorAssign,ShlAssign, orShrAssigntraits. RFC 953. - Empty structs can be defined with braces, as in
struct Foo { }, in addition to the non-braced form,struct Foo;. RFC 218.
Libraries
- Stabilized APIs:
str::encode_utf16(renamed fromutf16_units)str::EncodeUtf16(renamed fromUtf16Units)Ref::mapRefMut::mapptr::drop_in_placetime::Instanttime::SystemTimeInstant::nowInstant::duration_since(renamed fromduration_from_earlier)Instant::elapsedSystemTime::nowSystemTime::duration_since(renamed fromduration_from_earlier)SystemTime::elapsed- Various
Add/Subimpls forTimeandSystemTime SystemTimeErrorSystemTimeError::duration- Various impls for
SystemTimeError UNIX_EPOCHAddAssign,SubAssign,MulAssign,DivAssign,RemAssign,BitAndAssign,BitOrAssign,BitXorAssign,ShlAssign,ShrAssign.
- The
write!andwriteln!macros correctly emit errors if any of their arguments can't be formatted. - Various I/O functions support large files on 32-bit Linux.
- The Unix-specific
rawmodules, which contain a number of redefined C types are deprecated, includingos::raw::unix,os::raw::macos, andos::raw::linux. These modules defined types such asino_tanddev_t. The inconsistency of these definitions across platforms was making it difficult to implementstdcorrectly. Those that need these definitions should use thelibccrate. RFC 1415. - The Unix-specific
MetadataExttraits, includingos::unix::fs::MetadataExt, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. btree_set::{IntoIter, Iter, Range}are covariant.- Atomic loads and stores are not volatile.
- All types in
sync::mpscimplementfmt::Debug.
Performance
- Inlining hash functions lead to a 3% compile-time improvement in some workloads.
- When using jemalloc, its symbols are unprefixed so that it overrides the libc malloc implementation. This means that for rustc, LLVM is now using jemalloc, which results in a 6% compile-time improvement on a specific workload.
- Avoid quadratic growth in function size due to cleanups.
Misc
- 32-bit MSVC builds finally implement unwinding. i686-pc-windows-msvc is now considered a tier-1 platform.
- The
--print targetsflag prints a list of supported targets. - The
--print cfgflag prints thecfgs defined for the current target. rustccan be built with an new Cargo-based build system, written in Rust. It will eventually replace Rust's Makefile-based build system. To enable it configure withconfigure --rustbuild.- Errors for non-exhaustive
matchpatterns now list up to 3 missing variants while also indicating the total number of missing variants if more than 3. - Executable stacks are disabled on Linux and BSD.
- The Rust Project now publishes binary releases of the standard
library for a number of tier-2 targets:
armv7-unknown-linux-gnueabihf,powerpc-unknown-linux-gnu,powerpc64-unknown-linux-gnu,powerpc64le-unknown-linux-gnux86_64-rumprun-netbsd. These can be installed with tools such as multirust.
Cargo
cargo initcreates a new Cargo project in the current directory. It is otherwise likecargo new.- Cargo has configuration keys for
-vand--color.verboseandcolor, respectively, go in the[term]section of.cargo/config. - Configuration keys that evaluate to strings or integers can be set
via environment variables. For example the
build.jobskey can be set viaCARGO_BUILD_JOBS. Environment variables take precedence over config files. - Target-specific dependencies support Rust
cfgsyntax for describing targets so that dependencies for multiple targets can be specified together. RFC 1361. - The environment variables
CARGO_TARGET_ROOT,RUSTC, andRUSTDOCtake precedence over thebuild.target-dir,build.rustc, andbuild.rustdocconfiguration values. - The child process tree is killed on Windows when Cargo is killed.
- The
build.targetconfiguration value sets the target platform, like--target.
Compatibility Notes
- Unstable compiler flags have been further restricted. Since
1.0
-Zflags have been considered unstable, and other flags that were considered unstable additionally required passing-Z unstable-optionsto access. Unlike unstable language and library features though, these options have been accessible on the stable release channel. Going forward, new unstable flags will not be available on the stable release channel, and old unstable flags will warn about their usage. In the future, all unstable flags will be unavailable on the stable release channel. - It is no longer possible to
matchon empty enum variants using theVariant(..)syntax. This has been a warning since 1.6. - The Unix-specific
MetadataExttraits, includingos::unix::fs::MetadataExt, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. - Modules sourced from the filesystem cannot appear within arbitrary blocks, but only within other modules.
--cfgcompiler flags are parsed strictly as identifiers.- On Unix, stack overflow triggers a runtime abort instead of a SIGSEGV.
Command::spawnand its equivalents return an error if any of its command-line arguments contain interiorNULs.- Tuple and unit enum variants from other crates are in the type namespace.
- On Windows
rustcemits.libfiles for thestaticliblibrary type instead of.afiles. Additionally, for the MSVC toolchain,rustcemits import libraries namedfoo.dll.libinstead offoo.lib.