Releases: rust-lang/rust
Rust 1.24.1
Rust 1.24.0
Language
- External
sysv64ffi is now available. eg.extern "sysv64" fn foo () {}
Compiler
- rustc now uses 16 codegen units by default for release builds. For the fastest builds, utilize
codegen-units=1. - Added
armv4t-unknown-linux-gnueabitarget. - Add
aarch64-unknown-openbsdsupport
Libraries
str::find::<char>now uses memchr. This should lead to a 10x improvement in performance in the majority of cases.OsStr'sDebugimplementation is now lossless and consistent with Windows.time::{SystemTime, Instant}now implementHash.- impl
From<bool>forAtomicBool - impl
From<{CString, &CStr}>for{Arc<CStr>, Rc<CStr>} - impl
From<{OsString, &OsStr}>for{Arc<OsStr>, Rc<OsStr>} - impl
From<{PathBuf, &Path}>for{Arc<Path>, Rc<Path>} - float::from_bits now just uses transmute. This provides some optimisations from LLVM.
- Copied
AsciiExtmethods ontochar - Remove
T: Sizedrequirement onptr::is_null() - impl
From<RecvError>for{TryRecvError, RecvTimeoutError} - Optimised
f32::{min, max}to generate more efficient x86 assembly [u8]::containsnow uses memchr which provides a 3x speed improvement
Stabilized APIs
The following functions can now be used in a constant expression. eg. let buffer: [u8; size_of::<usize>()];, static COUNTER: AtomicUsize = AtomicUsize::new(1);
AtomicBool::newAtomicUsize::newAtomicIsize::newAtomicPtr::newCell::new{integer}::min_value{integer}::max_valuemem::size_ofmem::align_ofptr::nullptr::null_mutRefCell::newUnsafeCell::new
Cargo
- Added a
workspace.default-membersconfig that overrides implied--allin virtual workspaces. - Enable incremental by default on development builds. Also added configuration keys to
Cargo.tomland.cargo/configto disable on a per-project or global basis respectively.
Misc
Compatibility Notes
- Floating point types
Debugimpl now always prints a decimal point. Ipv6Addrnow rejects superfluous::'s in IPv6 addresses This is in accordance with IETF RFC 4291 §2.2.- Unwinding will no longer go past FFI boundaries, and will instead abort.
Formatter::flagsmethod is now deprecated. Thesign_plus,sign_minus,alternate, andsign_aware_zero_padshould be used instead.- Leading zeros in tuple struct members is now an error
column!()macro is one-based instead of zero-basedfmt::Argumentscan no longer be shared across threads- Access to
#[repr(packed)]struct fields is now unsafe - Cargo sets a different working directory for the compiler
Rust 1.23.0
Language
- Arbitrary
autotraits are now permitted in trait objects. - rustc now uses subtyping on the left hand side of binary operations. Which should fix some confusing errors in some operations.
Compiler
- Enabled
TrapUnreachablein LLVM which should mitigate the impact of undefined behavior. - rustc now suggests renaming import if names clash.
- Display errors/warnings correctly when there are zero-width or wide characters.
- rustc now avoids unnecessary copies of arguments that are simple bindings This should improve memory usage on average by 5-10%.
- Updated musl used to build musl rustc to 1.1.17
Libraries
- Allow a trailing comma in
assert_eq/nemacro - Implement Hash for raw pointers to unsized types
- impl
From<*mut T>forAtomicPtr<T> - impl
From<usize/isize>forAtomicUsize/AtomicIsize. - Removed the
T: Syncrequirement forRwLock<T>: Send - Removed
T: Sizedrequirement for{<*const T>, <*mut T>}::as_refand<*mut T>::as_mut - Optimized
Thread::{park, unpark}implementation - Improved
SliceExt::binary_searchperformance. - impl
FromIterator<()>for() - Copied
AsciiExttrait methods to primitive types. Use ofAsciiExtis now deprecated.
Stabilized APIs
Cargo
- Cargo now supports uninstallation of multiple packages eg.
cargo uninstall foo baruninstallsfooandbar. - Added unit test checking to
cargo check - Cargo now lets you install a specific version using
cargo install --version
Misc
- Releases now ship with the Cargo book documentation.
- rustdoc now prints rendering warnings on every run.
Compatibility Notes
- Changes have been made to type equality to make it more correct, in rare cases this could break some code. Tracking issue for further information
char::escape_debugnow uses Unicode 10 over 9.- Upgraded Android SDK to 27, and NDK to r15c. This drops support for Android 9, the minimum supported version is Android 14.
- Bumped the minimum LLVM to 3.9
Rust 1.22.1
Rust 1.22.0
Language
non_snake_caselint now allows extern no-mangle functions- Now accepts underscores in unicode escapes
T op= &Tnow works for numeric types. eg.let mut x = 2; x += &8;- types that impl
Dropare now allowed inconstandstatictypes
Compiler
- rustc now defaults to having 16 codegen units at debug on supported platforms.
- rustc will no longer inline in codegen units when compiling for debug This should decrease compile times for debug builds.
- strict memory alignment now enabled on ARMv6
- Remove support for the PNaCl target
le32-unknown-nacl
Libraries
- Allow atomic operations up to 32 bits on
armv5te_unknown_linux_gnueabi Box<Error>now implsFrom<Cow<str>>std::mem::Discriminantis now guaranteed to beSend + Syncfs::copynow returns the length of the main stream on NTFS.- Properly detect overflow in
Instant += Duration. - impl
Hasherfor{&mut Hasher, Box<Hasher>} - impl
fmt::DebugforSplitWhitespace. Option<T>now implsTryThis allows for using?withOptiontypes.
Stabilized APIs
Cargo
- Cargo will now build multi file examples in subdirectories of the
examplesfolder that have amain.rsfile. - Changed
[root]to[package]inCargo.lockPackages with the old format will continue to work and can be updated withcargo update. - Now supports vendoring git repositories
Misc
libbacktraceis now available on Apple platforms.- Stabilised the
compile_failattribute for code fences in doc-comments. This now lets you specify that a given code example will fail to compile.
Compatibility Notes
Rust 1.21.0
Language
- You can now use static references for literals. Example:
fn main() { let x: &'static u32 = &0; }
- Relaxed path syntax. Optional
::before<is now allowed in all contexts. Example:my_macro!(Vec<i32>::new); // Always worked my_macro!(Vec::<i32>::new); // Now works
Compiler
- Upgraded jemalloc to 4.5.0
- Enabled unwinding panics on Redox
- Now runs LLVM in parallel during translation phase. This should reduce peak memory usage.
Libraries
- Generate builtin impls for
Clonefor all arrays and tuples that areT: Clone Stdin,Stdout, andStderrnow implementAsRawFd.RcandArcnow implementFrom<&[T]> where T: Clone,From<str>,From<String>,From<Box<T>> where T: ?Sized, andFrom<Vec<T>>.
Stabilized APIs
Cargo
- You can now call
cargo installwith multiple package names - Cargo commands inside a virtual workspace will now implicitly pass
--all - Added a
[patch]section toCargo.tomlto handle prepublication dependencies RFC 1969 include&excludefields inCargo.tomlnow accept gitignore like patterns- Added the
--all-targetsoption - Using required dependencies as a feature is now deprecated and emits a warning
Misc
- Cargo docs are moving to doc.rust-lang.org/cargo
- The rustdoc book is now available at doc.rust-lang.org/rustdoc
- Added a preview of RLS has been made available through rustup Install with
rustup component add rls-preview std::osdocumentation for Unix, Linux, and Windows now appears on doc.rust-lang.org Previously only showedstd::os::unix.
Compatibility Notes
- Changes in method matching against higher-ranked types This may cause breakage in subtyping corner cases. A more in-depth explanation is available.
- rustc's JSON error output's byte position start at top of file. Was previously relative to the rustc's internal
CodeMapstruct which required the unstable librarylibsyntaxto correctly use. unused_resultslint no longer ignores booleans
Rust 1.20.0
Language
Compiler
- Struct fields are now properly coerced to the expected field type.
- Enabled wasm LLVM backend WASM can now be built with the
wasm32-experimental-emscriptentarget. - Changed some of the error messages to be more helpful.
- Add support for RELRO(RELocation Read-Only) for platforms that support it.
- rustc now reports the total number of errors on compilation failure previously this was only the number of errors in the pass that failed.
- Expansion in rustc has been sped up 29x.
- added
msp430-none-elftarget. - rustc will now suggest one-argument enum variant to fix type mismatch when applicable
- Fixes backtraces on Redox
- rustc now identifies different versions of same crate when absolute paths of different types match in an error message.
Libraries
- Relaxed Debug constraints on
{HashMap,BTreeMap}::{Keys,Values}. - Impl
PartialEq,Eq,PartialOrd,Ord,Debug,Hashfor unsized tuples. - Impl
fmt::{Display, Debug}forRef,RefMut,MutexGuard,RwLockReadGuard,RwLockWriteGuard - Impl
CloneforDefaultHasher. - Impl
SyncforSyncSender. - Impl
FromStrforchar - Fixed how
{f32, f64}::{is_sign_negative, is_sign_positive}handles NaN. - allow messages in the
unimplemented!()macro. ie.unimplemented!("Waiting for 1.21 to be stable") pub(restricted)is now supported in thethread_local!macro.- Upgrade to Unicode 10.0.0
- Reimplemented
{f32, f64}::{min, max}in Rust instead of using CMath. - Skip the main thread's manual stack guard on Linux
- Iterator::nth for
ops::{Range, RangeFrom}is now done in O(1) time #[repr(align(N))]attribute max number is now 2^31 - 1. This was previously 2^15.{OsStr, Path}::Displaynow avoids allocations where possible
Stabilized APIs
CStr::into_c_stringCString::as_c_strCString::into_boxed_c_strChain::get_mutChain::get_refChain::into_innerOption::get_or_insert_withOption::get_or_insertOsStr::into_os_stringOsString::into_boxed_os_strTake::get_mutTake::get_refUtf8Error::error_lenchar::EscapeDebugchar::escape_debugcompile_error!f32::from_bitsf32::to_bitsf64::from_bitsf64::to_bitsmem::ManuallyDropslice::sort_unstable_by_keyslice::sort_unstable_byslice::sort_unstablestr::from_boxed_utf8_uncheckedstr::as_bytes_mutstr::as_bytes_mutstr::from_utf8_mutstr::from_utf8_unchecked_mutstr::get_mutstr::get_unchecked_mutstr::get_uncheckedstr::getstr::into_boxed_bytes
Cargo
- Cargo API token location moved from
~/.cargo/configto~/.cargo/credentials. - Cargo will now build
main.rsbinaries that are in sub-directories ofsrc/bin. ie. Havingsrc/bin/server/main.rsandsrc/bin/client/main.rsgeneratestarget/debug/serverandtarget/debug/client - You can now specify version of a binary when installed through
cargo installusing--vers. - Added
--no-fail-fastflag to cargo to run all benchmarks regardless of failure. - Changed the convention around which file is the crate root.
Compatibility Notes
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.
loopcan now return a value withbreak. RFC 1624 For example:let x = loop { break 7; };- C compatible
unions are now available. RFC 1444 They can only containCopytypes and cannot have aDropimplementation. Example:union Foo { bar: u8, baz: usize } - Non capturing closures can now be coerced into
fns, 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-androideabito correspond to thearmeabiofficial ABI. If you wish to continue targeting thearmeabi-v7aABI 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 errorsThis 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-staticoption RFC 1721 Which allows libraries with C Run-time Libraries(CRT) to be statically linked. - Fixed various ARM codegen bugs
Libraries
Stringnow implementsFromIterator<Cow<'a, str>>andExtend<Cow<'a, str>>Vecnow implementsFrom<&mut [T]>Box<[u8]>now implementsFrom<Box<str>>SplitWhitespacenow implementsClone[u8]::reverseis now 5x faster and[u16]::reverseis 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
--allflag to thecargo benchsubcommand to run benchmarks of all the members in a given workspace. - Updated
libssh2-systo 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
--excludeoption for excluding certain packages when using the--alloption - Cargo will now automatically retry when receiving a 5xx error from crates.io
- The
--featuresoption now accepts multiple comma or space delimited values. - Added support for custom target specific runners
Misc
- Added
rust-windbg.cmdfor loading rust.natvisfiles 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 beSyncifTisSync.-Zflags 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
-Zflag change, thecargo-checkplugin no longer works. Users should migrate to the built-incheckcommand, 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 crateoutside of its module is now a hard error. This was previously a warning. use ::self::foo;is now a hard error.selfpaths 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&Eqused 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
VCINSTALLDIRis set incorrectly,rustcwill try to use it to find the linker, and the build will fail where it did not previously
Rust 1.18.0
Language
- Stabilize pub(restricted)
pubcan now accept a module path to make the item visible to just that module tree. Also accepts the keywordcrateto make something public to the whole crate but not users of the library. Example:pub(crate) mod utils;. RFC 1422. - Stabilize
#![windows_subsystem]attribute conservative exposure of the/SUBSYSTEMlinker flag on Windows platforms. RFC 1665. - Refactor of trait object type parsing Now
tyin macros can accept types likeWrite + Send, trailing+are now supported in trait objects, and better error reporting for trait objects starting with?Sized. - 0e+10 is now a valid floating point literal
- Now warns if you bind a lifetime parameter to 'static
- Tuples, Enum variant fields, and structs with no
reprattribute or with#[repr(Rust)]are reordered to minimize padding and produce a smaller representation in some cases.
Compiler
- rustc can now emit mir with
--emit mir - Improved LLVM IR for trivial functions
- Added explanation for E0090(Wrong number of lifetimes are supplied)
- rustc compilation is now 15%-20% faster Thanks to optimisation opportunities found through profiling
- Improved backtrace formatting when panicking
Libraries
- Specialized
Vec::from_iterbeing passedvec::IntoIterif the iterator hasn't been advanced the originalVecis reassembled with no actual iteration or reallocation. - Simplified HashMap Bucket interface provides performance improvements for iterating and cloning.
- Specialize Vec::from_elem to use calloc
- Fixed Race condition in fs::create_dir_all
- No longer caching stdio on Windows
- Optimized insertion sort in slice insertion sort in some cases 2.50%~ faster and in one case now 12.50% faster.
- Optimized
AtomicBool::fetch_nand
Stabilized APIs
Child::try_waitHashMap::retainHashSet::retainPeekMut::popTcpStream::peekUdpSocket::peekUdpSocket::peek_from
Cargo
- Added partial Pijul support Pijul is a version control system in Rust. You can now create new cargo projects with Pijul using
cargo new --vcs pijul - Now always emits build script warnings for crates that fail to build
- Added Android build support
- Added
--binsand--testsflags now you can build all programs of a certain type, for examplecargo build --binswill build all binaries. - Added support for haiku
Misc
- rustdoc can now use pulldown-cmark with the
--enable-commonmarkflag - Rust now uses the official cross compiler for NetBSD
- rustdoc now accepts
#at the start of files - Fixed jemalloc support for musl
Compatibility Notes
-
Changes to how the
0flag works in format! Padding zeroes are now always placed after the sign if it exists and before the digits. With the#flag the zeroes are placed after the prefix and before the digits. -
Due to the struct field optimisation, using
transmuteon structs that have noreprattribute or#[repr(Rust)]will no longer work. This has always been undefined behavior, but is now more likely to break in practice. -
The refactor of trait object type parsing fixed a bug where
+was receiving the wrong priority parsing things like&for<'a> Tr<'a> + Sendas&(for<'a> Tr<'a> + Send)instead of(&for<'a> Tr<'a>) + Send -
rustc main.rs -o out --emit=asm,llvm-irNow will outputout.asmandout.llinstead of only one of the filetypes. -
calling a function that returns
Selfwill no longer work when the size ofSelfcannot be statically determined. -
rustc now builds with a "pthreads" flavour of MinGW for Windows GNU this has caused a few regressions namely:
- Changed the link order of local static/dynamic libraries (respecting the order on given rather than having the compiler reorder).
- Changed how MinGW is linked, native code linked to dynamic libraries may require manually linking to the gcc support library (for the native code itself)
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
Selfmay be included in thewhereclause ofimpls. RFC 1647- When coercing to an unsized type lifetimes must be equal. That is, there is no subtyping between
TandUwhenT: Unsize<U>. For example, coercing&mut [&'a X; N]to&mut [&'b X]requires'abe 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-modelmore correctly determine whether the linker creates a position-independent executable - Add
-C overflow-checksto 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
Selfto appear inimplwhereclauses. - 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_rawArc::from_rawArc::ptr_eqRc::into_rawRc::from_rawRc::ptr_eqOrdering::thenOrdering::then_withBTreeMap::rangeBTreeMap::range_mutcollections::Boundprocess::abortptr::read_unalignedptr::write_unalignedResult::expect_errCell::swapCell::replaceCell::into_innerCell::take
Libraries
BTreeMapandBTreeSetcan iterate over rangesCellcan store non-Copytypes. RFC 1651StringimplementsFromIterator<&char>Boximplements 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::FromBytesWithNulErrorimplementsErrorandDisplay- Specialize
PartialOrd<A> for [A] where A: Ord - Slightly optimize
slice::sort - Add
ToStringtrait specialization forCow<'a, str>andString Box<[T]>implementsFrom<&[T]> where T: Copy,Box<str>implementsFrom<&str>IpAddrimplementsFromfor various arrays.SocketAddrimplementsFrom<(I, u16)> where I: Into<IpAddr>format!estimates the needed capacity before writing a string- Support unprivileged symlink creation in Windows
PathBufimplementsDefault- Implement
PartialEq<[A]>forVecDeque<A> HashMapresizes 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.rsis a build script - Find workspace via
workspace_rootlink 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
rustcis linked statically on Windows MSVC targets, allowing it to run without installing the MSVC runtime.rustdoc --testincludes file names in test names- This release includes builds of
stdforsparc64-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
TypeIdimplementsPartialOrdandOrd--test-threads=0produces an errorrustupinstalls 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
TandUwhenT: Unsize<U>, e.g. coercing&mut [&'a X; N]to&mut [&'b X]requires'abe equal to'b. Soundness fix. format!andDisplay::to_stringpanic if an underlying formatting implementation returns an error. Previously the error was silently ignored. It is incorrect forwrite_fmtto 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 i...