Rust 1.19.0
Language
- Numeric fields can now be used for creating tuple structs. RFC 1506 For example
struct Point(u32, u32); let x = Point { 0: 7, 1: 0 };
. - Macro recursion limit increased to 1024 from 64.
- Added lint for detecting unused macros.
loop
can now return a value withbreak
. RFC 1624 For example:let x = loop { break 7; };
- C compatible
union
s are now available. RFC 1444 They can only containCopy
types and cannot have aDrop
implementation. Example:union Foo { bar: u8, baz: usize }
- Non capturing closures can now be coerced into
fn
s, RFC 1558 Example:let foo: fn(u8) -> u8 = |v: u8| { v };
Compiler
- Add support for bootstrapping the Rust compiler toolchain on Android.
- Change
arm-linux-androideabi
to correspond to thearmeabi
official ABI. If you wish to continue targeting thearmeabi-v7a
ABI you should use--target armv7-linux-androideabi
. - Fixed ICE when removing a source file between compilation sessions.
- Minor optimisation of string operations.
- Compiler error message is now
aborting due to previous error(s)
instead ofaborting due to N previous errors
This was previously inaccurate and would only count certain kinds of errors. - The compiler now supports Visual Studio 2017
- The compiler is now built against LLVM 4.0.1 by default
- Added a lot of new error codes
- Added
target-feature=+crt-static
option RFC 1721 Which allows libraries with C Run-time Libraries(CRT) to be statically linked. - Fixed various ARM codegen bugs
Libraries
String
now implementsFromIterator<Cow<'a, str>>
andExtend<Cow<'a, str>>
Vec
now implementsFrom<&mut [T]>
Box<[u8]>
now implementsFrom<Box<str>>
SplitWhitespace
now implementsClone
[u8]::reverse
is now 5x faster and[u16]::reverse
is now 1.5x fastereprint!
andeprintln!
macros added to prelude. Same as theprint!
macros, but for printing to stderr.
Stabilized APIs
Cargo
- Build scripts can now add environment variables to the environment the crate is being compiled in. Example:
println!("cargo:rustc-env=FOO=bar");
- Subcommands now replace the current process rather than spawning a new child process
- Workspace members can now accept glob file patterns
- Added
--all
flag to thecargo bench
subcommand to run benchmarks of all the members in a given workspace. - Updated
libssh2-sys
to 0.2.6 - Target directory path is now in the cargo metadata
- Cargo no longer checks out a local working directory for the crates.io index This should provide smaller file size for the registry, and improve cloning times, especially on Windows machines.
- Added an
--exclude
option for excluding certain packages when using the--all
option - Cargo will now automatically retry when receiving a 5xx error from crates.io
- The
--features
option now accepts multiple comma or space delimited values. - Added support for custom target specific runners
Misc
- Added
rust-windbg.cmd
for loading rust.natvis
files in the Windows Debugger. - Rust will now release XZ compressed packages
- rustup will now prefer to download rust packages with XZ compression over GZip packages.
- Added the ability to escape
#
in rust documentation By adding additional#
's ie.##
is now#
Compatibility Notes
MutexGuard<T>
may only beSync
ifT
isSync
.-Z
flags are now no longer allowed to be used on the stable compiler. This has been a warning for a year previous to this.- As a result of the
-Z
flag change, thecargo-check
plugin no longer works. Users should migrate to the built-incheck
command, which has been available since 1.16. - Ending a float literal with
._
is now a hard error. Example:42._
. - Any use of a private
extern crate
outside of its module is now a hard error. This was previously a warning. use ::self::foo;
is now a hard error.self
paths are always relative while the::
prefix makes a path absolute, but was ignored and the path was relative regardless.- Floating point constants in match patterns is now a hard error This was previously a warning.
- Struct or enum constants that don't derive
PartialEq
&Eq
used match patterns is now a hard error This was previously a warning. - Lifetimes named
'_
are no longer allowed. This was previously a warning. - From the pound escape, lines consisting of multiple
#
s are now visible - It is an error to re-export private enum variants. This is known to break a number of crates that depend on an older version of mustache.
- On Windows, if
VCINSTALLDIR
is set incorrectly,rustc
will try to use it to find the linker, and the build will fail where it did not previously