655 KiB
Version 1.73.0 (2023-10-05)
Language
- Uplift
clippy::fn_null_checklint asuseless_ptr_null_checks. - Make
noop_method_callwarn by default. - Support interpolated block for
tryandasyncin macros. - Make
unconditional_recursionlint detect recursive drops. - Future compatibility warning for some impls being incorrectly considered not overlapping.
- The
invalid_reference_castinglint is now deny-by-default (instead of allow-by-default)
Compiler
- Write version information in a
.commentsection like GCC/Clang. - Add documentation on v0 symbol mangling.
- Stabilize
extern "thiscall"and"thiscall-unwind"ABIs. - Only check outlives goals on impl compared to trait.
- Infer type in irrefutable slice patterns with fixed length as array.
- Discard default auto trait impls if explicit ones exist.
- Add several new tier 3 targets:
- Add
wasm32-wasi-preview1-threadsas a tier 2 target.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add
Read,WriteandSeekimpls forArc<File>. - Merge functionality of
io::Sinkintoio::Empty. - Implement
RefUnwindSafeforBacktrace - Make
ExitStatusimplementDefault impl SliceIndex<str> for (Bound<usize>, Bound<usize>)- Change default panic handler message format.
- Cleaner
assert_eq!&assert_ne!panic messages. - Correct the (deprecated) Android
statstruct definitions.
Stabilized APIs
- Unsigned
{integer}::div_ceil - Unsigned
{integer}::next_multiple_of - Unsigned
{integer}::checked_next_multiple_of std::ffi::FromBytesUntilNulErrorstd::os::unix::fs::chownstd::os::unix::fs::fchownstd::os::unix::fs::lchownLocalKey::<Cell<T>>::getLocalKey::<Cell<T>>::setLocalKey::<Cell<T>>::takeLocalKey::<Cell<T>>::replaceLocalKey::<RefCell<T>>::with_borrowLocalKey::<RefCell<T>>::with_borrow_mutLocalKey::<RefCell<T>>::setLocalKey::<RefCell<T>>::takeLocalKey::<RefCell<T>>::replace
These APIs are now stable in const contexts:
Cargo
- Encode URL params correctly for
SourceIdinCargo.lock. - Bail out an error when using
cargo::in custom build script.
Misc
Compatibility Notes
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Remove LLVM pointee types, supporting only opaque pointers.
- Port PGO/LTO/BOLT optimized build pipeline to Rust.
- Replace in-tree
rustc_apfloatwith the new version of the crate. - Update to LLVM 17.
- Add
internal_featureslint for internal unstable features. - Mention style for new syntax in tracking issue template.
Version 1.72.1 (2023-09-19)
- Adjust codegen change to improve LLVM codegen
- rustdoc: Fix self ty params in objects with lifetimes
- Fix regression in compile times
- Resolve some ICE regressions in the compiler:
Version 1.72.0 (2023-08-24)
Language
- Replace const eval limit by a lint and add an exponential backoff warning
- expand: Change how
#![cfg(FALSE)]behaves on crate root - Stabilize inline asm for LoongArch64
- Uplift
clippy::undropped_manually_dropslint - Uplift
clippy::invalid_utf8_in_uncheckedlint asinvalid_from_utf8_uncheckedandinvalid_from_utf8 - Uplift
clippy::cast_ref_to_mutlint asinvalid_reference_casting - Uplift
clippy::cmp_nanlint asinvalid_nan_comparisons - resolve: Remove artificial import ambiguity errors
- Don't require associated types with Self: Sized bounds in
dyn Traitobjects
Compiler
- Remember names of
cfg-ed out items to mention them in diagnostics - Support for native WASM exceptions
- Add support for NetBSD/aarch64-be (big-endian arm64).
- Write to stdout if
-is given as output file - Force all native libraries to be statically linked when linking a static binary
- Add Tier 3 support for
loongarch64-unknown-none* - Prevent
.eh_framefrom being emitted for-C panic=abort - Support 128-bit enum variant in debuginfo codegen
- compiler: update solaris/illumos to enable tsan support.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Document memory orderings of
thread::{park, unpark} - io: soften ‘at most one write attempt’ requirement in io::Write::write
- Specify behavior of HashSet::insert
- Relax implicit
T: Sizedbounds onBufReader<T>,BufWriter<T>andLineWriter<T> - Update runtime guarantee for
select_nth_unstable - Return
Okon kill if process has already exited - Implement PartialOrd for
Vecs over different allocators - Use 128 bits for TypeId hash
- Don't drain-on-drop in DrainFilter impls of various collections.
- Make
{Arc,Rc,Weak}::ptr_eqignore pointer metadata
Rustdoc
- Allow whitespace as path separator like double colon
- Add search result item types after their name
- Search for slices and arrays by type with
[] - Clean up type unification and "unboxing"
Stabilized APIs
These APIs are now stable in const contexts:
Cargo
- Enable
-Zdoctest-in-workspaceby default. When running each documentation test, the working directory is set to the root directory of the package the test belongs to. docs #12221 #12288 - Add support of the "default" keyword to reset previously set
build.jobsparallelism back to the default. #12222
Compatibility Notes
- Alter
DisplayforIpv6Addrfor IPv4-compatible addresses - Cargo changed feature name validation check to a hard error. The warning was added in Rust 1.49. These extended characters aren't allowed on crates.io, so this should only impact users of other registries, or people who don't publish to a registry. #12291
- Demoted
mips*-unknown-linux-gnu*targets from host tier 2 to target tier 3 support.
Version 1.71.1 (2023-08-03)
- Fix CVE-2023-38497: Cargo did not respect the umask when extracting dependencies
- Fix bash completion for users of Rustup
- Do not show
suspicious_double_ref_oplint when callingborrow() - Fix ICE: substitute types before checking inlining compatibility
- Fix ICE: don't use
can_eqinderive(..)suggestion for missing method - Fix building Rust 1.71.0 from the source tarball
Version 1.71.0 (2023-07-13)
Language
- Stabilize
raw-dylib,link_ordinal,import_name_typeand-Cdlltool. - Uplift
clippy::{drop,forget}_{ref,copy}lints. - Type inference is more conservative around constrained vars.
- Use fulfillment to check
Dropimpl compatibility
Compiler
- Evaluate place expression in
PlaceMention, makinglet _ =patterns more consistent with respect to the borrow checker. - Add
--print deployment-targetflag for Apple targets. - Stabilize
extern "C-unwind"and friends. The existingextern "C"etc. may change behavior for cross-language unwinding in a future release. - Update the version of musl used on
*-linux-musltargets to 1.2.3, enabling time64 on 32-bit systems. - Stabilize
debugger_visualizerfor embedding metadata like Microsoft's Natvis. - Enable flatten-format-args by default.
- Make
Selfrespect tuple constructor privacy. - Improve niche placement by trying two strategies and picking the better result.
- Use
apple-m1as the target CPU foraarch64-apple-darwin. - Add Tier 3 support for the
x86_64h-apple-darwintarget. - Promote
loongarch64-unknown-linux-gnuto Tier 2 with host tools.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Rework handling of recursive panics.
Additional panics are allowed while unwinding, as long as they are caught before escaping
a
Dropimplementation, but panicking within a panic hook is now an immediate abort. - Loosen
From<&[T]> for Box<[T]>bound toT: Clone. - Remove unnecessary
T: Sendbound inError for mpsc::SendError<T>andTrySendError<T>. - Fix docs for
alloc::reallocto matchLayoutrequirements that the size must not exceedisize::MAX. - Document
const {}syntax forstd::thread_local. This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.
Stabilized APIs
CStr::is_emptyBuildHasher::hash_oneNonZeroI*::is_positiveNonZeroI*::is_negativeNonZeroI*::checked_negNonZeroI*::overflowing_negNonZeroI*::saturating_negNonZeroI*::wrapping_negNeg for NonZeroI*Neg for &NonZeroI*From<[T; N]> for (T...)(array to N-tuple for N in 1..=12)From<(T...)> for [T; N](N-tuple to array for N in 1..=12)windows::io::AsHandle for Box<T>windows::io::AsHandle for Rc<T>windows::io::AsHandle for Arc<T>windows::io::AsSocket for Box<T>windows::io::AsSocket for Rc<T>windows::io::AsSocket for Arc<T>
These APIs are now stable in const contexts:
<*const T>::read<*const T>::read_unaligned<*mut T>::read<*mut T>::read_unalignedptr::readptr::read_unaligned<[T]>::split_at
Cargo
- Allow named debuginfo options in
Cargo.toml. - Add
workspace_default_membersto the output ofcargo metadata. - Automatically inherit workspace fields when running
cargo new/cargo init.
Rustdoc
- Add a new
rustdoc::unescaped_backtickslint for broken inline code. - Support strikethrough with single tildes. (
~~old~~vs.~new~)
Misc
Compatibility Notes
- Remove structural match from
TypeId. Code that uses a constantTypeIdin a pattern will potentially be broken. Known cases have already been fixed -- in particular, users of thelogcrate'skv_unstablefeature should update tolog v0.4.18or later. - Add a
sysrootcrate to represent the standard library crates. This does not affect stable users, but may require adjustment in tools that build their own standard library. - Cargo optimizes its usage under
rustup. When Cargo detects it will runrustcpointing to a rustup proxy, it'll try bypassing the proxy and use the underlying binary directly. There are assumptions around the interaction with rustup andRUSTUP_TOOLCHAIN. However, it's not expected to affect normal users. - When querying a package, Cargo tries only the original name, all hyphens, and all underscores to handle misspellings. Previously, Cargo tried each combination of hyphens and underscores, causing excessive requests to crates.io.
- Cargo now disallows
RUSTUP_HOMEandRUSTUP_TOOLCHAINin the[env]configuration table. This is considered to be not a use case Cargo would like to support, since it will likely cause problems or lead to confusion.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Version 1.70.0 (2023-06-01)
Language
- Relax ordering rules for
asm!operands - Properly allow macro expanded
format_argsinvocations to uses captures - Lint ambiguous glob re-exports
- Perform const and unsafe checking for expressions in
let _ = exprposition.
Compiler
- Extend -Cdebuginfo with new options and named aliases
This provides a smaller version of debuginfo for cases that only need line number information
(
-Cdebuginfo=line-tables-only), which may eventually become the default for-Cdebuginfo=1. - Make
unused_allocationlint againstBox::newtoo - Detect uninhabited types early in const eval
- Switch to LLD as default linker for {arm,thumb}v4t-none-eabi
- Add tier 3 target
loongarch64-unknown-linux-gnu - Add tier 3 target for
i586-pc-nto-qnx700(QNX Neutrino RTOS, version 7.0), - Insert alignment checks for pointer dereferences as debug assertions This catches undefined behavior at runtime, and may cause existing code to fail.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Document NonZeroXxx layout guarantees
- Windows: make
Commandprefer non-verbatim paths - Implement Default for some alloc/core iterators
- Fix handling of trailing bare CR in str::lines
- allow negative numeric literals in
concat! - Add documentation about the memory layout of
Cell - Use
partial_cmpto implement tuplelt/le/ge/gt - Stabilize
atomic_as_ptr - Stabilize
nonnull_slice_from_raw_parts - Partial stabilization of
once_cell - Stabilize
nonzero_min_max - Flatten/inline format_args!() and (string and int) literal arguments into format_args!()
- Stabilize movbe target feature
- don't splice from files into pipes in io::copy
- Add a builtin unstable
FnPtrtrait that is implemented for all function pointers This extendsDebug,Pointer,Hash,PartialEq,Eq,PartialOrd, andOrdimplementations for function pointers with all ABIs.
Stabilized APIs
NonZero*::MIN/MAXBinaryHeap::retainDefault for std::collections::binary_heap::IntoIterDefault for std::collections::btree_map::{IntoIter, Iter, IterMut}Default for std::collections::btree_map::{IntoKeys, Keys}Default for std::collections::btree_map::{IntoValues, Values}Default for std::collections::btree_map::RangeDefault for std::collections::btree_set::{IntoIter, Iter}Default for std::collections::btree_set::RangeDefault for std::collections::linked_list::{IntoIter, Iter, IterMut}Default for std::vec::IntoIterDefault for std::iter::ChainDefault for std::iter::ClonedDefault for std::iter::CopiedDefault for std::iter::EnumerateDefault for std::iter::FlattenDefault for std::iter::FuseDefault for std::iter::RevDefault for std::slice::IterDefault for std::slice::IterMutRc::into_innerArc::into_innerstd::cell::OnceCellOption::is_some_andNonNull::slice_from_raw_partsResult::is_ok_andResult::is_err_andstd::sync::atomic::Atomic*::as_ptrstd::io::IsTerminalstd::os::linux::net::SocketAddrExtstd::os::unix::net::UnixDatagram::bind_addrstd::os::unix::net::UnixDatagram::connect_addrstd::os::unix::net::UnixDatagram::send_to_addrstd::os::unix::net::UnixListener::bind_addrstd::path::Path::as_mut_os_strstd::sync::OnceLock
Cargo
- Add
CARGO_PKG_README - Make
sparsethe default protocol for crates.io - Accurately show status when downgrading dependencies
- Use registry.default for login/logout
- Stabilize
cargo logout
Misc
Compatibility Notes
- Prevent stable
libtestfrom supporting-Zunstable-options - Perform const and unsafe checking for expressions in
let _ = exprposition. - WebAssembly targets enable
sign-extandmutable-globalsfeatures in codegen This may cause incompatibility with older execution environments. - Insert alignment checks for pointer dereferences as debug assertions This catches undefined behavior at runtime, and may cause existing code to fail.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Version 1.69.0 (2023-04-20)
Language
- Deriving built-in traits on packed structs works with
Copyfields. - Stabilize the
cmpxchg16btarget feature on x86 and x86_64. - Improve analysis of trait bounds for associated types.
- Allow associated types to be used as union fields.
- Allow
Self: Autotraitbounds on dyn-safe trait methods. - Treat
stras containing[u8]for auto trait purposes.
Compiler
- Upgrade
*-pc-windows-gnuon CI to mingw-w64 v10 and GCC 12.2. - Rework min_choice algorithm of member constraints.
- Support
trueandfalseas boolean flags in compiler arguments. - Default
repr(C)enums toc_intsize.
Libraries
- Implement the unstable
DispatchFromDynfor cell types, allowing downstream experimentation with custom method receivers. - Document that
fmt::Arguments::as_str()may returnSome(_)in more cases after optimization, subject to change. - Implement
AsFdandAsRawFdforRc.
Stabilized APIs
These APIs are now stable in const contexts:
SocketAddr::newSocketAddr::ipSocketAddr::portSocketAddr::is_ipv4SocketAddr::is_ipv6SocketAddrV4::newSocketAddrV4::ipSocketAddrV4::portSocketAddrV6::newSocketAddrV6::ipSocketAddrV6::portSocketAddrV6::flowinfoSocketAddrV6::scope_id
Cargo
- Cargo now suggests
cargo fixorcargo clippy --fixwhen compilation warnings are auto-fixable. - Cargo now suggests
cargo addif you try to install a library crate. - Cargo now sets the
CARGO_BIN_NAMEenvironment variable also for binary examples.
Rustdoc
- Vertically compact trait bound formatting.
- Only include stable lints in
rustdoc::allgroup. - Compute maximum Levenshtein distance based on the query.
- Remove inconsistently-present sidebar tooltips.
- Search by macro when query ends with
!.
Compatibility Notes
- The
rust-analysiscomponent fromrustupnow only contains a warning placeholder. This was primarily intended for RLS, and the corresponding-Zsave-analysisflag has been removed from the compiler as well. - Unaligned references to packed fields are now a hard error. This has been a warning since 1.53, and denied by default with a future-compatibility warning since 1.62.
- Update the minimum external LLVM to 14.
- Cargo now emits errors on invalid characters in a registry token.
- When
default-featuresis set to false of a workspace dependency, and an inherited dependency of a member hasdefault-features = true, Cargo will enable default features of that dependency. - Cargo denies
CARGO_HOMEin the[env]configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended. - Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.
- The Rust distribution no longer always includes rustdoc
If
tools = [...]is set in config.toml, we will respect a missing rustdoc in that list. By default rustdoc remains included. To retain the prior behavior explicitly add"rustdoc"to the list.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Version 1.68.2 (2023-03-28)
- Update the GitHub RSA host key bundled within Cargo. The key was rotated by GitHub on 2023-03-24 after the old one leaked.
- Mark the old GitHub RSA host key as revoked. This will prevent Cargo from accepting the leaked key even when trusted by the system.
- Add support for
@revokedand a better error message for@cert-authorityin Cargo's SSH host key verification
Version 1.68.1 (2023-03-23)
- Fix miscompilation in produced Windows MSVC artifacts This was introduced by enabling ThinLTO for the distributed rustc which led to miscompilations in the resulting binary. Currently this is believed to be limited to the -Zdylib-lto flag used for rustc compilation, rather than a general bug in ThinLTO, so only rustc artifacts should be affected.
- Fix --enable-local-rust builds
- Treat
$prefix-clangasclangin linker detection code - Fix panic in compiler code
Version 1.68.0 (2023-03-09)
Language
- Stabilize default_alloc_error_handler
This allows usage of
allocon stable without requiring the definition of a handler for allocation failure. Defining custom handlers is still unstable. - Stabilize
efiapicalling convention. - Remove implicit promotion for types with drop glue
Compiler
- Change
bindings_with_variant_nameto deny-by-default - Allow .. to be parsed as let initializer
- Add
armv7-sony-vita-newlibeabihfas a tier 3 target - Always check alignment during compile-time const evaluation
- Disable "split dwarf inlining" by default.
- Add vendor to Fuchsia's target triple
- Enable sanitizers for s390x-linux
Libraries
- Loosen the bound on the Debug implementation of Weak.
- Make
std::task::Context!Send and !Sync - PhantomData layout guarantees
- Don't derive Debug for
OnceWith&RepeatWith - Implement DerefMut for PathBuf
- Add O(1)
Vec -> VecDequeconversion guarantee - Leak amplification for peek_mut() to ensure BinaryHeap's invariant is always met
Stabilized APIs
{core,std}::pin::pin!impl From<bool> for {f32,f64}std::path::MAIN_SEPARATOR_STRimpl DerefMut for PathBuf
These APIs are now stable in const contexts:
Cargo
- Stabilize sparse registry support for crates.io
cargo build --verbosetells you more about why it recompiles.- Show progress of crates.io index update even
net.git-fetch-with-clioption enabled
Misc
Compatibility Notes
- Only support Android NDK 25 or newer
- Add
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSto future-incompat report - Only specify
--targetby default for-Zgcc-ld=lldon wasm - Bump
IMPLIED_BOUNDS_ENTAILMENTto Deny + ReportNow std::task::Contextno longer implements Send and Sync
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Encode spans relative to the enclosing item
- Don't normalize in AstConv
- Find the right lower bound region in the scenario of partial order relations
- Fix impl block in const expr
- Check ADT fields for copy implementations considering regions
- rustdoc: simplify JS search routine by not messing with lev distance
- Enable ThinLTO for rustc on
x86_64-pc-windows-msvc - Enable ThinLTO for rustc on
x86_64-apple-darwin
Version 1.67.1 (2023-02-09)
- Fix interoperability with thin archives.
- Fix an internal error in the compiler build process.
- Downgrade
clippy::uninlined_format_argsto pedantic.
Version 1.67.0 (2023-01-26)
Language
- Make
Sizedpredicates coinductive, allowing cycles. #[must_use]annotations onasync fnalso affect theFuture::Output.- Elaborate supertrait obligations when deducing closure signatures.
- Invalid literals are no longer an error under
cfg(FALSE). - Unreserve braced enum variants in value namespace.
Compiler
- Enable varargs support for calling conventions other than
Corcdecl. - Add new MIR constant propagation based on dataflow analysis.
- Optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones.
- Stabilize native library modifier
verbatim.
Added, updated, and removed targets:
- Add a tier 3 target for PowerPC on AIX,
powerpc64-ibm-aix. - Add a tier 3 target for the Sony PlayStation 1,
mipsel-sony-psx. - Add tier 3
no_stdtargets for the QNX Neutrino RTOS,aarch64-unknown-nto-qnx710andx86_64-pc-nto-qnx710. - Promote UEFI targets to tier 2,
aarch64-unknown-uefi,i686-unknown-uefi, andx86_64-unknown-uefi. - Remove tier 3
linuxkerneltargets (not used by the actual kernel).
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Merge
crossbeam-channelintostd::sync::mpsc. - Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.
- Derive
EqandHashforControlFlow. - Don't build
compiler_builtinswith-C panic=abort.
Stabilized APIs
{integer}::checked_ilog{integer}::checked_ilog2{integer}::checked_ilog10{integer}::ilog{integer}::ilog2{integer}::ilog10NonZeroU*::ilog2NonZeroU*::ilog10NonZero*::BITS
These APIs are now stable in const contexts:
Compatibility Notes
- The layout of
repr(Rust)types now groups m*2^n-sized fields with equivalently aligned ones. This is intended to be an optimization, but it is also known to increase type sizes in a few cases for the placement of enum tags. As a reminder, the layout ofrepr(Rust)types is an implementation detail, subject to change. - 0.5 now rounds to 0 when formatted to 0 decimal places. This makes it consistent with the rest of floating point formatting that rounds ties toward even digits.
- Chains of
&&and||will now drop temporaries from their sub-expressions in evaluation order, left-to-right. Previously, it was "twisted" such that the first expression dropped its temporaries last, after all of the other expressions dropped in order. - Underscore suffixes on string literals are now a hard error. This has been a future-compatibility warning since 1.20.0.
- Stop passing
-export-dynamictowasm-ld. mainis now mangled as__main_voidonwasm32-wasi.- Cargo now emits an error if there are multiple registries in the configuration with the same index URL.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Version 1.66.1 (2023-01-10)
- Added validation of SSH host keys for git URLs in Cargo (CVE-2022-46176)
Version 1.66.0 (2022-12-15)
Language
- Permit specifying explicit discriminants on all
repr(Int)enums#[repr(u8)] enum Foo { A(u8) = 0, B(i8) = 1, C(bool) = 42, } - Allow transmutes between the same type differing only in lifetimes
- Change constant evaluation errors from a deny-by-default lint to a hard error
- Trigger
must_useonimpl Traitfor supertraits This makesimpl ExactSizeIteratorrespect the existing#[must_use]annotation onIterator. - Allow
..=Xin patterns - Uplift
clippy::for_loops_over_fallibleslint into rustc - Stabilize
symoperands in inline assembly - Update to Unicode 15
- Opaque types no longer imply lifetime bounds This is a soundness fix which may break code that was erroneously relying on this behavior.
Compiler
- Add armv5te-none-eabi and thumbv5te-none-eabi tier 3 targets
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
- Add support for linking against macOS universal libraries
Libraries
- Fix
#[derive(Default)]on a generic#[default]enum adding unnecessaryDefaultbounds - Update to Unicode 15
Stabilized APIs
proc_macro::Span::source_textuX::{checked_add_signed, overflowing_add_signed, saturating_add_signed, wrapping_add_signed}iX::{checked_add_unsigned, overflowing_add_unsigned, saturating_add_unsigned, wrapping_add_unsigned}iX::{checked_sub_unsigned, overflowing_sub_unsigned, saturating_sub_unsigned, wrapping_sub_unsigned}BTreeSet::{first, last, pop_first, pop_last}BTreeMap::{first_key_value, last_key_value, first_entry, last_entry, pop_first, pop_last}- Add
AsFdimplementations for stdio lock types on WASI. impl TryFrom<Vec<T>> for Box<[T; N]>core::hint::black_boxDuration::try_from_secs_{f32,f64}Option::unzipstd::os::fd
Rustdoc
Cargo
- Added
cargo removeto remove dependencies from Cargo.toml cargo publishnow waits for the new version to be downloadable before exiting
See detailed release notes for more.
Compatibility Notes
- Only apply
ProceduralMasqueradehack to older versions ofrental - Don't export
__heap_baseand__data_endon wasm32-wasi. - Don't export
__wasm_init_memoryon WebAssembly. - Only export
__tls_*on wasm32-unknown-unknown. - Don't link to
libresolvin libstd on Darwin - Update libstd's libc to 0.2.135 (to make
libstdno longer pull inlibiconv.dylibon Darwin) - Opaque types no longer imply lifetime bounds This is a soundness fix which may break code that was erroneously relying on this behavior.
- Make
order_dependent_trait_objectsshow up in future-breakage reports - Change std::process::Command spawning to default to inheriting the parent's signal mask
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
Version 1.65.0 (2022-11-03)
Language
- Error on
ascasts of enums with#[non_exhaustive]variants - Stabilize
let else - Stabilize generic associated types (GATs)
- Add lints
let_underscore_dropandlet_underscore_lockfrom Clippy - Stabilize
breaking from arbitrary labeled blocks ("label-break-value") - Uninitialized integers, floats, and raw pointers are now considered immediate UB.
Usage of
MaybeUninitis the correct way to work with uninitialized memory. - Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a
- Do not allow
Dropimpl on foreign ADTs
Compiler
- Stabilize -Csplit-debuginfo on Linux
- Use niche-filling optimization even when multiple variants have data
- Associated type projections are now verified to be well-formed prior to resolving the underlying type
- Stringify non-shorthand visibility correctly
- Normalize struct field types when unsizing
- Update to LLVM 15
- Fix aarch64 call abi to correctly zeroext when needed
- debuginfo: Generalize C++-like encoding for enums
- Add
special_module_namelint - Add support for generating unique profraw files by default when using
-C instrument-coverage - Allow dynamic linking for iOS/tvOS targets
New targets:
- Add armv4t-none-eabi as a tier 3 target
- Add powerpc64-unknown-openbsd and riscv64-unknown-openbsd as tier 3 targets
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Don't generate
PartialEq::nein derive(PartialEq) - Windows RNG: Use
BCRYPT_RNG_ALG_HANDLEby default - Forbid mixing
Systemwith direct system allocator calls - Document no support for writing to non-blocking stdio/stderr
std::layout::Layoutsize must not overflowisize::MAXwhen rounded up toalignThis also changes the safety conditions onLayout::from_size_align_unchecked.
Stabilized APIs
std::backtrace::BacktraceBound::as_refstd::io::read_to_string<*const T>::cast_mut<*mut T>::cast_const
These APIs are now stable in const contexts:
Cargo
- Apply GitHub fast path even for partial hashes
- Do not add home bin path to PATH if it's already there
- Take priority into account within the pending queue. This slightly optimizes job scheduling by Cargo, with typically small improvements on larger crate graph builds.
Compatibility Notes
std::layout::Layoutsize must not overflowisize::MAXwhen rounded up toalign. This also changes the safety conditions onLayout::from_size_align_unchecked.PollFnnow only implementsUnpinif the closure isUnpin. This is a possible breaking change if users were relying on the blanket unpin implementation. See discussion on the PR for details of why this change was made.- Drop ExactSizeIterator impl from std::char::EscapeAscii This is a backwards-incompatible change to the standard library's surface area, but is unlikely to affect real world usage.
- Do not consider a single repeated lifetime eligible for elision in the return type This behavior was unintentionally changed in 1.64.0, and this release reverts that change by making this an error again.
- Reenable disabled early syntax gates as future-incompatibility lints
- Update the minimum external LLVM to 13
- Don't duplicate file descriptors into stdio fds
- Sunset RLS
- Deny usage of
#![cfg_attr(..., crate_type = ...)]to set the crate type This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny. llvm-has-rust-patchesallows setting the build system to treat the LLVM as having Rust-specific patches This option may need to be set for distributions that are building Rust with a patched LLVM viallvm-config, not the built-in LLVM.- Combining three or more languages (e.g. Objective C, C++ and Rust) into one binary may hit linker limitations when using
lld. For more information, see issue 102754.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Add
x.shandx.ps1shell scripts - compiletest: use target cfg instead of hard-coded tables
- Use object instead of LLVM for reading bitcode from rlibs
- Enable MIR inlining for optimized compilations This provides a 3-10% improvement in compiletimes for real world crates. See perf results.
Version 1.64.0 (2022-09-22)
Language
- Unions with mutable references or tuples of allowed types are now allowed
- It is now considered valid to deallocate memory pointed to by a shared reference
&Tif every byte inTis inside anUnsafeCell - Unused tuple struct fields are now warned against in an allow-by-default lint,
unused_tuple_struct_fields, similar to the existing warning for unused struct fields. This lint will become warn-by-default in the future.
Compiler
- Add Nintendo Switch as tier 3 target
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
- Only compile
#[used]as llvm.compiler.used for ELF targets - Add the
--diagnostic-widthcompiler flag to define the terminal width. - Add support for link-flavor
rust-lldfor iOS, tvOS and watchOS
Libraries
- Remove restrictions on compare-exchange memory ordering.
- You can now
write!orwriteln!into anOsString: Implementfmt::WriteforOsString - Make RwLockReadGuard covariant
- Implement
FusedIteratorforstd::net::[Into]Incoming impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>ptr::copyandptr::swapare doing untyped copies- Add cgroupv1 support to
available_parallelism - Mitigate many incorrect uses of
mem::uninitialized
Stabilized APIs
future::IntoFuturefuture::poll_fntask::ready!num::NonZero*::checked_mulnum::NonZero*::checked_pownum::NonZero*::saturating_mulnum::NonZero*::saturating_pownum::NonZeroI*::absnum::NonZeroI*::checked_absnum::NonZeroI*::overflowing_absnum::NonZeroI*::saturating_absnum::NonZeroI*::unsigned_absnum::NonZeroI*::wrapping_absnum::NonZeroU*::checked_addnum::NonZeroU*::checked_next_power_of_twonum::NonZeroU*::saturating_addos::unix::process::CommandExt::process_groupos::windows::fs::FileTypeExt::is_symlink_diros::windows::fs::FileTypeExt::is_symlink_file
These types were previously stable in std::ffi, but are now also available in core and alloc:
core::ffi::CStrcore::ffi::FromBytesWithNulErroralloc::ffi::CStringalloc::ffi::FromVecWithNulErroralloc::ffi::IntoStringErroralloc::ffi::NulError
These types were previously stable in std::os::raw, but are now also available in core::ffi and std::ffi:
ffi::c_charffi::c_doubleffi::c_floatffi::c_intffi::c_longffi::c_longlongffi::c_scharffi::c_shortffi::c_ucharffi::c_uintffi::c_ulongffi::c_ulonglongffi::c_ushort
These APIs are now usable in const contexts:
Cargo
- Packages can now inherit settings from the workspace so that the settings
can be centralized in one place. See
workspace.packageandworkspace.dependenciesfor more details on how to define these common settings. - Cargo commands can now accept multiple
--targetflags to build for multiple targets at once, and thebuild.targetconfig option may now take an array of multiple targets. - The
--jobsargument can now take a negative number to count backwards from the max CPUs. cargo addwill now updateCargo.lock.- Added the
--crate-typeflag tocargo rustcto override the crate type. - Significantly improved the performance fetching git dependencies from GitHub
when using a hash in the
revfield.
Misc
Compatibility Notes
- The minimum required versions for all
-linux-gnutargets are now at least kernel 3.2 and glibc 2.17, for targets that previously supported older versions: Increase the minimum linux-gnu versions - Network primitives are now implemented with the ideal Rust layout, not the C system layout. This can cause problems when transmuting the types.
- Add assertion that
transmute_copy'sUis not larger thanT - A soundness bug in
BTreeMapwas fixed that allowed data it was borrowing to be dropped before the container. - The Drop behavior of C-like enums cast to ints has changed. These are already discouraged by a compiler warning.
- Relate late-bound closure lifetimes to parent fn in NLL
- Errors at const-eval time are now in future incompatibility reports
- On the
thumbv6m-none-eabitarget, some incorrectasm!statements were erroneously accepted if they used the high registers (r8 to r14) as an input/output operand. This is no longer accepted. impl Traitwas accidentally accepted as the associated type value of return-positionimpl Trait, without fulfilling all the trait bounds of that associated type, as long as the hidden type satisfies said bounds. This has been fixed.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Windows builds now use profile-guided optimization, providing 10-20% improvements to compiler performance: Utilize PGO for windows x64 rustc dist builds
- Stop keeping metadata in memory before writing it to disk
- compiletest: strip debuginfo by default for mode=ui
- Many improvements to generated code for derives, including performance improvements:
- Bump to clap 3
- fully move dropck to mir
- Optimize
Vec::insertfor the case whereindex == len. - Convert rust-analyzer to an in-tree tool
Version 1.63.0 (2022-08-11)
Language
- Remove migrate borrowck mode for pre-NLL errors.
- Modify MIR building to drop repeat expressions with length zero.
- Remove label/lifetime shadowing warnings.
- Allow explicit generic arguments in the presence of
impl Traitargs. - Make
cenum_impl_drop_castwarnings deny-by-default. - Prevent unwinding when
-C panic=abortis used regardless of declared ABI. - lub: don't bail out due to empty binders.
Compiler
- Stabilize the
bundlenative library modifier, also removing the deprecatedstatic-nobundlelinking kind. - Add Apple WatchOS compile targets*.
- Add a Windows application manifest to rustc-main.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Implement
Copy,Clone,PartialEqandEqforcore::fmt::Alignment. - Extend
ptr::nullandnull_mutto all thin (including extern) types. impl Read and Write for VecDeque<u8>.- STD support for the Nintendo 3DS.
- Use rounding in float to Duration conversion methods.
- Make write/print macros eagerly drop temporaries.
- Implement internal traits that enable
[OsStr]::join. - Implement
Hashforcore::alloc::Layout. - Add capacity documentation for
OsString. - Put a bound on collection misbehavior.
- Make
std::mem::needs_dropaccept?Sized. impl Termination for Infallibleand then make theResultimpls ofTerminationmore generic.- Document Rust's stance on
/proc/self/mem.
Stabilized APIs
array::from_fnBox::into_pinBinaryHeap::try_reserveBinaryHeap::try_reserve_exactOsString::try_reserveOsString::try_reserve_exactPathBuf::try_reservePathBuf::try_reserve_exactPath::try_existsRef::filter_mapRefMut::filter_mapNonNull::<[T]>::lenToOwned::clone_intoIpv6Addr::to_ipv4_mappedunix::io::AsFdunix::io::BorrowedFd<'fd>unix::io::OwnedFdwindows::io::AsHandlewindows::io::BorrowedHandle<'handle>windows::io::OwnedHandlewindows::io::HandleOrInvalidwindows::io::HandleOrNullwindows::io::InvalidHandleErrorwindows::io::NullHandleErrorwindows::io::AsSocketwindows::io::BorrowedSocket<'handle>windows::io::OwnedSocketthread::scopethread::Scopethread::ScopedJoinHandle
These APIs are now usable in const contexts:
array::from_refslice::from_refintrinsics::copyintrinsics::copy_nonoverlapping<*const T>::copy_to<*const T>::copy_to_nonoverlapping<*mut T>::copy_to<*mut T>::copy_to_nonoverlapping<*mut T>::copy_from<*mut T>::copy_from_nonoverlappingstr::from_utf8Utf8Error::error_lenUtf8Error::valid_up_toCondvar::newMutex::newRwLock::new
Cargo
- Stabilize the
--config pathcommand-line argument. - Expose rust-version in the environment as
CARGO_PKG_RUST_VERSION.
Compatibility Notes
#[link]attributes are now checked more strictly, which may introduce errors for invalid attribute arguments that were previously ignored.- Rounding is now used when converting a float to a
Duration. The converted duration can differ slightly from what it was.
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.62.1 (2022-07-19)
Rust 1.62.1 addresses a few recent regressions in the compiler and standard library, and also mitigates a CPU vulnerability on Intel SGX.
- The compiler fixed unsound function coercions involving
impl Traitreturn types. - The compiler fixed an incremental compilation bug with
async fnlifetimes. - Windows added a fallback for overlapped I/O in synchronous reads and writes.
- The
x86_64-fortanix-unknown-sgxtarget added a mitigation for the MMIO stale data vulnerability, advisory INTEL-SA-00615.
Version 1.62.0 (2022-06-30)
Language
- Stabilize
#[derive(Default)]on enums with a#[default]variant - Teach flow sensitive checks that visibly uninhabited call expressions never return
- Fix constants not getting dropped if part of a diverging expression
- Support unit struct/enum variant in destructuring assignment
- Remove mutable_borrow_reservation_conflict lint and allow the code pattern
constfunctions may now specifyextern "C"orextern "Rust"
Compiler
- linker: Stop using whole-archive on dependencies of dylibs
- Make
unaligned_referenceslint deny-by-default This lint is also a future compatibility lint, and is expected to eventually become a hard error. - Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
- Reject
#[thread_local]attribute on non-static items - Add tier 3
aarch64-pc-windows-gnullvmandx86_64-pc-windows-gnullvmtargets* - Implement a lint to warn about unused macro rules
- Promote
x86_64-unknown-nonetarget to Tier 2*
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Windows: Use a pipe relay for chaining pipes
- Replace Linux Mutex and Condvar with futex based ones.
- Replace RwLock by a futex based one on Linux
- std: directly use pthread in UNIX parker implementation
Stabilized APIs
bool::then_somef32::total_cmpf64::total_cmpStdin::lineswindows::CommandExt::raw_argimpl<T: Default> Default for AssertUnwindSafe<T>From<Rc<str>> for Rc<[u8]>From<Arc<str>> for Arc<[u8]>FusedIterator for EncodeWide- RDM intrinsics on aarch64
Clippy
Cargo
- Added the
cargo addcommand for adding dependencies toCargo.tomlfrom the command-line. docs - Package ID specs now support
name@versionsyntax in addition to the previousname:versionto align with the behavior incargo addand other tools.cargo installandcargo yankalso now support this syntax so the version does not need to passed as a separate flag. - The
gitandregistrydirectories in Cargo's home directory (usually~/.cargo) are now marked as cache directories so that they are not included in backups or content indexing (on Windows). - Added automatic
@argfile support, which will use "response files" if the command-line torustcexceeds the operating system's limit.
Compatibility Notes
cargo testnow passes--targettorustdocif the specified target is the same as the host target. #10594- rustdoc: doctests are now run on unexported
macro_rules!macros, matching other private items - rustdoc: Remove .woff font files
- Enforce Copy bounds for repeat elements while considering lifetimes
- Windows: Fix potential unsoundness by aborting if
Filereads or writes cannot complete synchronously.
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.61.0 (2022-05-19)
Language
const fnsignatures can now include generic trait boundsconst fnsignatures can now useimpl Traitin argument and return position- Function pointers can now be created, cast, and passed around in a
const fn - Recursive calls can now set the value of a function's opaque
impl Traitreturn type
Compiler
- Linking modifier syntax in
#[link]attributes and on the command line, as well as thewhole-archivemodifier specifically, are now supported - The
chartype is now described as UTF-32 in debuginfo - The
#[target_feature]attribute can now be used with aarch64 features - X86
#[target_feature = "adx"]is now stable
Libraries
ManuallyDrop<T>is now documented to have the same layout asT#[ignore = "…"]messages are printed when running tests- Consistently show absent stdio handles on Windows as NULL handles
- Make
std::io::stdio::lock()return'statichandles. Previously, the creation of locked handles to stdin/stdout/stderr would borrow the handles being locked, which prevented writinglet out = std::io::stdout().lock();becauseoutwould outlive the return value ofstdout(). Such code now works, eliminating a common pitfall that affected many Rust users. Vec::from_raw_partsis now less restrictive about its inputsstd::thread::available_parallelismnow takes cgroup quotas into account. Sinceavailable_parallelismis often used to create a thread pool for parallel computation, which may be CPU-bound for performance,available_parallelismwill return a value consistent with the ability to use that many threads continuously, if possible. For instance, in a container with 8 virtual CPUs but quotas only allowing for 50% usage,available_parallelismwill return 4.
Stabilized APIs
Pin::static_mutPin::static_refVec::retain_mutVecDeque::retain_mutWriteforCursor<[u8; N]>std::os::unix::net::SocketAddr::from_pathnamestd::process::ExitCodeandstd::process::Termination. The stabilization of these two APIs now makes it possible for programs to return errors frommainwith custom exit codes.std::thread::JoinHandle::is_finished
These APIs are now usable in const contexts:
<*const T>::offsetand<*mut T>::offset<*const T>::wrapping_offsetand<*mut T>::wrapping_offset<*const T>::addand<*mut T>::add<*const T>::suband<*mut T>::sub<*const T>::wrapping_addand<*mut T>::wrapping_add<*const T>::wrapping_suband<*mut T>::wrapping_sub<[T]>::as_mut_ptr<[T]>::as_ptr_range<[T]>::as_mut_ptr_range
Cargo
No feature changes, but see compatibility notes.
Compatibility Notes
- Previously native static libraries were linked as
whole-archivein some cases, but now rustc tries not to usewhole-archiveunless explicitly requested. This change may result in linking errors in some cases. To fix such errors, native libraries linked from the command line, build scripts, or#[link]attributes need to- (more common) either be reordered to respect dependencies between them (if
adepends onbthenashould go first andbsecond) - (less common) or be updated to use the
+whole-archivemodifier.
- (more common) either be reordered to respect dependencies between them (if
- Catching a second unwind from FFI code while cleaning up from a Rust panic now causes the process to abort
- Proc macros no longer see
identmatchers wrapped in groups - The number of
#inr#raw string literals is now required to be less than 256 - When checking that a dyn type satisfies a trait bound, supertrait bounds are now enforced
cargo vendornow only accepts one value for each--syncflagcfgpredicates inall()andany()are always evaluated to detect errors, instead of short-circuiting. The compatibility considerations here arise in nightly-only code that used the short-circuiting behavior ofallto write something likecfg(all(feature = "nightly", syntax-requiring-nightly)), which will now fail to compile. Instead, use eithercfg_attr(feature = "nightly", ...)or nested uses ofcfg.- bootstrap: static-libstdcpp is now enabled by default, and can now be disabled when llvm-tools is enabled
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.60.0 (2022-04-07)
Language
- Stabilize
#[cfg(panic = "...")]for either"unwind"or"abort". - Stabilize
#[cfg(target_has_atomic = "...")]for each integer size and"ptr".
Compiler
- Enable combining
+crt-staticandrelocation-model=piconx86_64-unknown-linux-gnu - Fixes wrong
unreachable_publints on nested and glob public reexport - Stabilize
-Z instrument-coverageas-C instrument-coverage - Stabilize
-Z print-link-argsas--print link-args - Add new Tier 3 target
mips64-openwrt-linux-musl* - Add new Tier 3 target
armv7-unknown-linux-uclibceabi(softfloat)* - Fix invalid removal of newlines from doc comments
- Add kernel target for RustyHermit
- Deny mixing bin crate type with lib crate types
- Make rustc use
RUST_BACKTRACE=fullby default - Upgrade to LLVM 14
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Guarantee call order for
sort_by_cached_key - Improve
Duration::try_from_secs_f32/f64accuracy by directly processing exponent and mantissa - Make
Instant::{duration_since, elapsed, sub}saturating - Remove non-monotonic clocks workarounds in
Instant::now - Make
BuildHasherDefault,iter::Emptyandfuture::Pendingcovariant
Stabilized APIs
Arc::new_cyclicRc::new_cyclicslice::EscapeAscii<[u8]>::escape_asciiu8::escape_asciiVec::spare_capacity_mutMaybeUninit::assume_init_dropMaybeUninit::assume_init_readi8::abs_diffi16::abs_diffi32::abs_diffi64::abs_diffi128::abs_diffisize::abs_diffu8::abs_diffu16::abs_diffu32::abs_diffu64::abs_diffu128::abs_diffusize::abs_diffDisplay for io::ErrorKindFrom<u8> for ExitCodeNot for !(the "never" type)- Op
Assign<$t> for Wrapping<$t> arch::is_aarch64_feature_detected!
Cargo
- Port cargo from
toml-rstotoml_edit - Stabilize
-Ztimingsas--timings - Stabilize namespaced and weak dependency features.
- Accept more
cargo:rustc-link-arg-*types from build script output. - cargo-new should not add ignore rule on Cargo.lock inside subdirs
Misc
- Ship docs on Tier 2 platforms by reusing the closest Tier 1 platform docs
- Drop rustc-docs from complete profile
- bootstrap: tidy up flag handling for llvm build
Compatibility Notes
- Remove compiler-rt linking hack on Android
- Mitigations for platforms with non-monotonic clocks have been removed from
Instant::now. On platforms that don't provide monotonic clocks, an instant is not guaranteed to be greater than an earlier instant anymore. Instant::{duration_since, elapsed, sub}do not panic anymore on underflow, saturating to0instead. In the real world the panic happened mostly on platforms with buggy monotonic clock implementations rather than catching programming errors like reversing the start and end times. Such programming errors will now results in0rather than a panic.- In a future release we're planning to increase the baseline requirements for the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love your feedback in PR #95026.
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.59.0 (2022-02-24)
Language
- Stabilize default arguments for const parameters and remove the ordering restriction for type and const parameters
- Stabilize destructuring assignment
- Relax private in public lint on generic bounds and where clauses of trait impls
- Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64, and RISC-V
Compiler
- Stabilize new symbol mangling format, leaving it opt-in (-Csymbol-mangling-version=v0)
- Emit LLVM optimization remarks when enabled with
-Cremark - Fix sparc64 ABI for aggregates with floating point members
- Warn when a
#[test]-like built-in attribute macro is present multiple times. - Add support for riscv64gc-unknown-freebsd
- Stabilize
-Z emit-future-incompatas--json future-incompat - Soft disable incremental compilation
This release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable. This is due to a known and relatively frequently occurring bug in incremental compilation, which causes builds to issue internal compiler errors. This particular bug is already fixed on nightly, but that fix has not yet rolled out to stable and is deemed too risky for a direct stable backport.
As always, we encourage users to test with nightly and report bugs so that we can track failures and fix issues earlier.
See 94124 for more details.
Libraries
Stabilized APIs
std::thread::available_parallelismResult::copiedResult::clonedarch::asm!arch::global_asm!ops::ControlFlow::is_breakops::ControlFlow::is_continueTryFrom<char> for u8char::TryFromCharErrorimplementingClone,Debug,Display,PartialEq,Copy,Eq,Erroriter::zipNonZeroU8::is_power_of_twoNonZeroU16::is_power_of_twoNonZeroU32::is_power_of_twoNonZeroU64::is_power_of_twoNonZeroU128::is_power_of_twoNonZeroUsize::is_power_of_twoDoubleEndedIterator for ToLowercaseDoubleEndedIterator for ToUppercaseTryFrom<&mut [T]> for [T; N]UnwindSafe for OnceRefUnwindSafe for Once- armv8 neon intrinsics for aarch64
Const-stable:
mem::MaybeUninit::as_ptrmem::MaybeUninit::assume_initmem::MaybeUninit::assume_init_refffi::CStr::from_bytes_with_nul_unchecked
Cargo
- Stabilize the
stripprofile option - Stabilize future-incompat-report
- Support abbreviating
--releaseas-r - Support
term.quietconfiguration - Remove
--hostfrom cargo {publish,search,login}
Compatibility Notes
- Refactor weak symbols in std::sys::unix This may add new, versioned, symbols when building with a newer glibc, as the standard library uses weak linkage rather than dynamically attempting to load certain symbols at runtime.
- Deprecate crate_type and crate_name nested inside
#![cfg_attr]This adds a future compatibility lint to supporting the use of cfg_attr wrapping either crate_type or crate_name specification within Rust files; it is recommended that users migrate to setting the equivalent command line flags. - Remove effect of
#[no_link]attribute on name resolution This may expose new names, leading to conflicts with preexisting names in a given namespace and a compilation failure. - Cargo will document libraries before binaries.
- Respect doc=false in dependencies, not just the root crate
- Weaken guarantee around advancing underlying iterators in zip
- Make split_inclusive() on an empty slice yield an empty output
- Update std::env::temp_dir to use GetTempPath2 on Windows when available.
- unreachable! was updated to match other formatting macro behavior on Rust 2021
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.58.1 (2022-01-20)
- Fix race condition in
std::fs::remove_dir_all(CVE-2022-21658) - Handle captured arguments in the
useless_formatClippy lint - Move
non_send_fields_in_send_tyClippy lint to nursery - Fix wrong error message displayed when some imports are missing
- Fix rustfmt not formatting generated files from stdin
Version 1.58.0 (2022-01-13)
Language
- Format strings can now capture arguments simply by writing
{ident}in the string. This works in all macros accepting format strings. Support for this inpanic!(panic!("{ident}")) requires the 2021 edition; panic invocations in previous editions that appear to be trying to use this will result in a warning lint about not having the intended effect. *const Tpointers can now be dereferenced in const contexts.- The rules for when a generic struct implements
Unsizehave been relaxed.
Compiler
- Add LLVM CFI support to the Rust compiler
- Stabilize -Z strip as -C strip. Note that while release builds already don't add debug symbols for the code you compile, the compiled standard library that ships with Rust includes debug symbols, so you may want to use the
stripoption to remove these symbols to produce smaller release binaries. Note that this release only includes support in rustc, not directly in cargo. - Add support for LLVM coverage mapping format versions 5 and 6
- Emit LLVM optimization remarks when enabled with
-Cremark - Update the minimum external LLVM to 12
- Add
x86_64-unknown-noneat Tier 3* - Build musl dist artifacts with debuginfo enabled. When building release binaries using musl, you may want to use the newly stabilized strip option to remove these debug symbols, reducing the size of your binaries.
- Don't abort compilation after giving a lint error
- Error messages point at the source of trait bound obligations in more places
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- All remaining functions in the standard library have
#[must_use]annotations where appropriate, producing a warning when ignoring their return value. This helps catch mistakes such as expecting a function to mutate a value in place rather than return a new value. - Paths are automatically canonicalized on Windows for operations that support it
- Re-enable debug checks for
copyandcopy_nonoverlapping - Implement
RefUnwindSafeforRc<T> - Make RSplit<T, P>: Clone not require T: Clone
- Implement
TerminationforResult<Infallible, E>. This allows writingfn main() -> Result<Infallible, ErrorType>, for a program whose successful exits never involve returning frommain(for instance, a program that callsexit, or that usesexecto run another program).
Stabilized APIs
Metadata::is_symlinkPath::is_symlink{integer}::saturating_divOption::unwrap_uncheckedResult::unwrap_uncheckedResult::unwrap_err_uncheckedFile::options
These APIs are now usable in const contexts:
Duration::newDuration::checked_addDuration::saturating_addDuration::checked_subDuration::saturating_subDuration::checked_mulDuration::saturating_mulDuration::checked_div
Cargo
Rustdoc
Compatibility Notes
- Try all stable method candidates first before trying unstable ones. This change ensures that adding new nightly-only methods to the Rust standard library will not break code invoking methods of the same name from traits outside the standard library.
- Windows:
std::process::Commandwill no longer search the current directory for executables. - All proc-macro backward-compatibility lints are now deny-by-default.
- proc_macro: Append .0 to unsuffixed float if it would otherwise become int token
- Refactor weak symbols in std::sys::unix. This optimizes accesses to glibc functions, by avoiding the use of dlopen. This does not increase the minimum expected version of glibc. However, software distributions that use symbol versions to detect library dependencies, and which take weak symbols into account in that analysis, may detect rust binaries as requiring newer versions of glibc.
- rustdoc now rejects some unexpected semicolons in doctests
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- Implement coherence checks for negative trait impls
- Add rustc lint, warning when iterating over hashmaps
- Optimize live point computation
- Enable verification for 1/32nd of queries loaded from disk
- Implement version of normalize_erasing_regions that allows for normalization failure
Version 1.57.0 (2021-12-02)
Language
- Macro attributes may follow
#[derive]and will see the original (pre-cfg) input. - Accept curly-brace macros in expressions, like
m!{ .. }.method()andm!{ .. }?. - Allow panicking in constant evaluation.
- Ignore derived
CloneandDebugimplementations during dead code analysis.
Compiler
- Create more accurate debuginfo for vtables.
- Add
armv6k-nintendo-3dsat Tier 3*. - Add
armv7-unknown-linux-uclibceabihfat Tier 3*. - Add
m68k-unknown-linux-gnuat Tier 3*. - Add SOLID targets at Tier 3*:
aarch64-kmc-solid_asp3,armv7a-kmc-solid_asp3-eabi,armv7a-kmc-solid_asp3-eabihf
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Avoid allocations and copying in
Vec::leak - Add
#[repr(i8)]toOrdering - Optimize
File::read_to_endandread_to_string - Update to Unicode 14.0
- Many more functions are marked
#[must_use], producing a warning when ignoring their return value. This helps catch mistakes such as expecting a function to mutate a value in place rather than return a new value.
Stabilised APIs
[T; N]::as_mut_slice[T; N]::as_slicecollections::TryReserveErrorHashMap::try_reserveHashSet::try_reserveString::try_reserveString::try_reserve_exactVec::try_reserveVec::try_reserve_exactVecDeque::try_reserveVecDeque::try_reserve_exactIterator::map_whileiter::MapWhileproc_macro::is_availableCommand::get_programCommand::get_argsCommand::get_envsCommand::get_current_dirCommandArgsCommandEnvs
These APIs are now usable in const contexts:
Cargo
Compatibility notes
- Ignore derived
CloneandDebugimplementations during dead code analysis. This will break some builds that set#![deny(dead_code)].
Internal changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Version 1.56.1 (2021-11-01)
- New lints to detect the presence of bidirectional-override Unicode codepoints in the compiled source code (CVE-2021-42574)
Version 1.56.0 (2021-10-21)
Language
- The 2021 Edition is now stable. See the edition guide for more details.
- The pattern in
binding @ patterncan now also introduce new bindings. - Union field access is permitted in
const fn.
Compiler
- Upgrade to LLVM 13.
- Support memory, address, and thread sanitizers on aarch64-unknown-freebsd.
- Allow specifying a deployment target version for all iOS targets
- Warnings can be forced on with
--force-warn. This feature is primarily intended for usage bycargo fix, rather than end users. - Promote
aarch64-apple-ios-simto Tier 2*. - Add
powerpc-unknown-freebsdat Tier 3*. - Add
riscv32imc-esp-espidfat Tier 3*.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Allow writing of incomplete UTF-8 sequences via stdout/stderr on Windows. The Windows console still requires valid Unicode, but this change allows splitting a UTF-8 character across multiple write calls. This allows, for instance, programs that just read and write data buffers (e.g. copying a file to stdout) without regard for Unicode or character boundaries.
- Prefer
AtomicU{64,128}over Mutex for Instant backsliding protection. For this use case, atomics scale much better under contention. - Implement
Extend<(A, B)>for(Extend<A>, Extend<B>) - impl Default, Copy, Clone for std::io::Sink and std::io::Empty
impl From<[(K, V); N]>for all collections.- Remove
P: Unpinbound on impl Future for Pin. - Treat invalid environment variable names as nonexistent.
Previously, the environment functions would panic if given a variable name
with an internal null character or equal sign (
=). Now, these functions will just treat such names as nonexistent variables, since the OS cannot represent the existence of a variable with such a name.
Stabilised APIs
std::os::unix::fs::chrootUnsafeCell::raw_getBufWriter::into_partscore::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}These APIs were previously stable instd, but are now also available incore.Vec::shrink_toString::shrink_toOsString::shrink_toPathBuf::shrink_toBinaryHeap::shrink_toVecDeque::shrink_toHashMap::shrink_toHashSet::shrink_to
These APIs are now usable in const contexts:
Cargo
- Cargo supports specifying a minimum supported Rust version in Cargo.toml. This has no effect at present on dependency version selection. We encourage crates to specify their minimum supported Rust version, and we encourage CI systems that support Rust code to include a crate's specified minimum version in the test matrix for that crate by default.
Compatibility notes
- Update to new argument parsing rules on Windows. This adjusts Rust's standard library to match the behavior of the standard libraries for C/C++. The rules have changed slightly over time, and this PR brings us to the latest set of rules (changed in 2008).
- Disallow the aapcs calling convention on aarch64 This was already not supported by LLVM; this change surfaces this lack of support with a better error message.
- Make
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSwarn by default - Warn when an escaped newline skips multiple lines.
- Calls to
libc::getpid/std::process::idfromCommand::pre_execmay return different values on glibc <= 2.24. Rust now invokes theclone3system call directly, when available, to use new functionality available via that system call. Older versions of glibc cache the result ofgetpid, and only update that cache when calling glibc's clone/fork functions, so a direct system call bypasses that cache update. glibc 2.25 and newer no longer cachegetpidfor exactly this reason.
Internal changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- LLVM is compiled with PGO in published x86_64-unknown-linux-gnu artifacts. This improves the performance of most Rust builds.
- Unify representation of macros in internal data structures. This change fixes a host of bugs with the handling of macros by the compiler, as well as rustdoc.
Version 1.55.0 (2021-09-09)
Language
- You can now write open "from" range patterns (
X..), which will start atXand will end at the maximum value of the integer. - You can now explicitly import the prelude of different editions
through
std::prelude(e.g.use std::prelude::rust_2021::*;).
Compiler
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Updated std's float parsing to use the Eisel-Lemire algorithm. These improvements should in general provide faster string parsing of floats, no longer reject certain valid floating point values, and reduce the produced code size for non-stripped artifacts.
string::Drainnow implementsAsRef<str>andAsRef<[u8]>.
Stabilised APIs
Bound::clonedDrain::as_strIntoInnerError::into_errorIntoInnerError::into_partsMaybeUninit::assume_init_mutMaybeUninit::assume_init_refMaybeUninit::writearray::mapops::ControlFlowx86::_bittestx86::_bittestandcomplementx86::_bittestandresetx86::_bittestandsetx86_64::_bittest64x86_64::_bittestandcomplement64x86_64::_bittestandreset64x86_64::_bittestandset64
The following previously stable functions are now const.
Cargo
- Cargo will now deduplicate compiler diagnostics to the terminal when invoking
rustc in parallel such as when using
cargo test. - The package definition in
cargo metadatanow includes the"default_run"field from the manifest. - Added
cargo das an alias forcargo doc. - Added
{lib}as formatting option forcargo treeto print the"lib_name"of packages.
Rustdoc
- Added "Go to item on exact match" search option.
- The "Implementors" section on traits no longer shows redundant method definitions.
- Trait implementations are toggled open by default. This should make the
implementations more searchable by tools like
CTRL+Fin your browser. - Intra-doc links should now correctly resolve associated items (e.g. methods) through type aliases.
- Traits which are marked with
#[doc(hidden)]will no longer appear in the "Trait Implementations" section.
Compatibility Notes
- std functions that return an
io::Errorwill no longer use theErrorKind::Othervariant. This is to better reflect that these kinds of errors could be categorised into newer more specificErrorKindvariants, and that they do not represent a user error. - Using environment variable names with
process::Commandon Windows now behaves as expected. Previously using environment variables withCommandwould cause them to be ASCII-uppercased. - Rustdoc will now warn on using rustdoc lints that aren't prefixed
with
rustdoc:: RUSTFLAGSis no longer set for build scripts. Build scripts should useCARGO_ENCODED_RUSTFLAGSinstead. See the documentation for more details.
Version 1.54.0 (2021-07-29)
Language
-
You can now use macros for values in some built-in attributes. This primarily allows you to call macros within the
#[doc]attribute. For example, to include external documentation in your crate, you can now write the following:#![doc = include_str!("README.md")] -
You can now cast between unsized slice types (and types which contain unsized slices) in
const fn. -
You can now use multiple generic lifetimes with
impl Traitwhere the lifetimes don't explicitly outlive another. In code this means that you can now haveimpl Trait<'a, 'b>where as before you could only haveimpl Trait<'a, 'b> where 'b: 'a.
Compiler
- Rustc will now search for custom JSON targets in
/lib/rustlib/<target-triple>/target.jsonwhere/is the "sysroot" directory. You can find your sysroot directory by runningrustc --print sysroot. - Added
wasmas atarget_familyfor WebAssembly platforms. - You can now use
#[target_feature]on safe functions when targeting WebAssembly platforms. - Improved debugger output for enums on Windows MSVC platforms.
- Added tier 3* support for
bpfel-unknown-noneandbpfeb-unknown-none. -Zmutable-noalias=yesis enabled by default when using LLVM 12 or above.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
panic::panic_anywill now#[track_caller].- Added
OutOfMemoryas a variant ofio::ErrorKind. -
proc_macro::Literalnow implementsFromStr. - The implementations of vendor intrinsics in core::arch have been significantly refactored. The main user-visible changes are a 50% reduction in the size of libcore.rlib and stricter validation of constant operands passed to intrinsics. The latter is technically a breaking change, but allows Rust to more closely match the C vendor intrinsics API.
Stabilized APIs
BTreeMap::into_keysBTreeMap::into_valuesHashMap::into_keysHashMap::into_valuesarch::wasm32VecDeque::binary_searchVecDeque::binary_search_byVecDeque::binary_search_by_keyVecDeque::partition_point
Cargo
- Added the
--prune <spec>option tocargo-treeto remove a package from the dependency graph. - Added the
--depthoption tocargo-treeto print only to a certain depth in the tree - Added the
no-proc-macrovalue tocargo-tree --edgesto hide procedural macro dependencies. - A new environment variable named
CARGO_TARGET_TMPDIRis available. This variable points to a directory that integration tests and benches can use as a "scratchpad" for testing filesystem operations.
Compatibility Notes
- Mixing Option and Result via
?is no longer permitted in closures for inferred types. - Previously unsound code is no longer permitted where different constructors in branches could require different lifetimes.
- As previously mentioned the
std::archintrinsics now uses stricter const checking than before and may reject some previously accepted code. i128multiplication on Cortex M0+ platforms currently unconditionally causes overflow when compiled withcodegen-units = 1.
Version 1.53.0 (2021-06-17)
Language
- You can now use unicode for identifiers. This allows multilingual
identifiers but still doesn't allow glyphs that are not considered characters
such as
◆or🦀. More specifically you can now use any identifier that matches the UAX #31 "Unicode Identifier and Pattern Syntax" standard. This is the same standard as languages like Python, however Rust uses NFC normalization which may be different from other languages. - You can now specify "or patterns" inside pattern matches.
Previously you could only use
|(OR) on complete patterns. E.g.let x = Some(2u8); // Before matches!(x, Some(1) | Some(2)); // Now matches!(x, Some(1 | 2)); - Added the
:pat_parammacro_rules!matcher. This matcher has the same semantics as the:patmatcher. This is to allow:patto change semantics to being a pattern fragment in a future edition.
Compiler
- Updated the minimum external LLVM version to LLVM 10.
- Added Tier 3* support for the
wasm64-unknown-unknowntarget. - Improved debuginfo for closures and async functions on Windows MSVC.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Abort messages will now forward to
android_set_abort_messageon Android platforms when available. slice::IterMut<'_, T>now implementsAsRef<[T]>- Arrays of any length now implement
IntoIterator. Currently calling.into_iter()as a method on an array will returnimpl Iterator<Item=&T>, but this may change in a future edition to changeItemtoT. CallingIntoIterator::into_iterdirectly on arrays will provideimpl Iterator<Item=T>as expected. leading_zeros, andtrailing_zerosare now available on allNonZerointeger types.{f32, f64}::from_strnow parse and print special values (NaN,-0) according to IEEE 754.- You can now index into slices using
(Bound<usize>, Bound<usize>). - Add the
BITSassociated constant to all numeric types.
Stabilised APIs
AtomicBool::fetch_updateAtomicPtr::fetch_updateBTreeMap::retainBTreeSet::retainBufReader::seek_relativeDebugStruct::non_exhaustiveDuration::MAXDuration::ZERODuration::is_zeroDuration::saturating_addDuration::saturating_mulDuration::saturating_subErrorKind::UnsupportedOption::insertOrdering::is_eqOrdering::is_geOrdering::is_gtOrdering::is_leOrdering::is_ltOrdering::is_neOsStr::is_asciiOsStr::make_ascii_lowercaseOsStr::make_ascii_uppercaseOsStr::to_ascii_lowercaseOsStr::to_ascii_uppercasePeekable::peek_mutRc::decrement_strong_countRc::increment_strong_countVec::extend_from_withinarray::from_mutarray::from_refcmp::max_by_keycmp::max_bycmp::min_by_keycmp::min_byf32::is_subnormalf64::is_subnormal
Cargo
- Cargo now supports git repositories where the default
HEADbranch is not "master". This also includes a switch to the version 3Cargo.lockformat which can handle default branches correctly. - macOS targets now default to
unpackedsplit-debuginfo. - The
authorsfield is no longer included inCargo.tomlfor new projects.
Rustdoc
Compatibility Notes
- Implement token-based handling of attributes during expansion
Ipv4::from_strwill now reject octal format IP addresses in addition to rejecting hexadecimal IP addresses. The octal format can lead to confusion and potential security vulnerabilities and is no longer recommended.- The added
BITSconstant may conflict with external definitions. In particular, this was known to be a problem in thelexical-corecrate, but they have published fixes for semantic versions 0.4 through 0.7. To update this dependency alone, usecargo update -p lexical-core. - Incremental compilation remains off by default, unless one uses the
RUSTC_FORCE_INCREMENTAL=1environment variable added in 1.52.1.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- Rework the
std::sys::windows::allocimplementation. - rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls.
- rustdoc: Only look at blanket impls in
get_blanket_impls - Rework rustdoc const type
Version 1.52.1 (2021-05-10)
This release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to the widespread, and frequently occurring, breakage encountered by Rust users due to newly enabled incremental verification in 1.52.0. Notably, Rust users should upgrade to 1.52.0 or 1.52.1: the bugs that are detected by newly added incremental verification are still present in past stable versions, and are not yet fixed on any channel. These bugs can lead to miscompilation of Rust binaries.
These problems only affect incremental builds, so release builds with Cargo should not be affected unless the user has explicitly opted into incremental. Debug and check builds are affected.
See 84970 for more details.
Version 1.52.0 (2021-05-06)
Language
- Added the
unsafe_op_in_unsafe_fnlint, which checks whether the unsafe code in anunsafe fnis wrapped in aunsafeblock. This lint is allowed by default, and may become a warning or hard error in a future edition. - You can now cast mutable references to arrays to a pointer of the same type as the element.
Compiler
Added tier 3* support for the following targets.
s390x-unknown-linux-muslriscv32gc-unknown-linux-musl&riscv64gc-unknown-linux-muslpowerpc-unknown-openbsd
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
OsStringnow implementsExtendandFromIterator.cmp::Reversenow has#[repr(transparent)]representation.Arc<impl Error>now implementserror::Error.- All integer division and remainder operations are now
const.
Stabilised APIs
Arguments::as_strchar::MAXchar::REPLACEMENT_CHARACTERchar::UNICODE_VERSIONchar::decode_utf16char::from_digitchar::from_u32_uncheckedchar::from_u32slice::partition_pointstr::rsplit_oncestr::split_once
The following previously stable APIs are now const.
char::len_utf8char::len_utf16char::to_ascii_uppercasechar::to_ascii_lowercasechar::eq_ignore_ascii_caseu8::to_ascii_uppercaseu8::to_ascii_lowercaseu8::eq_ignore_ascii_case
Rustdoc
- Rustdoc lints are now treated as a tool lint, meaning that
lints are now prefixed with
rustdoc::(e.g.#[warn(rustdoc::broken_intra_doc_links)]). Using the old style is still allowed, and will become a warning in a future release. - Rustdoc now supports argument files.
- Rustdoc now generates smart punctuation for documentation.
- You can now use "task lists" in Rustdoc Markdown. E.g.
- [x] Complete - [ ] Todo
Misc
- You can now pass multiple filters to tests. E.g.
cargo test -- foo barwill run all tests that matchfooandbar. - Rustup now distributes PDB symbols for the
stdlibrary on Windows, allowing you to seestdsymbols when debugging.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- Check the result cache before the DepGraph when ensuring queries
- Try fast_reject::simplify_type in coherence before doing full check
- Only store a LocalDefId in some HIR nodes
- Store HIR attributes in a side table
Compatibility Notes
- Cargo build scripts are now forbidden from setting
RUSTC_BOOTSTRAP. - Removed support for the
x86_64-rumprun-netbsdtarget. - Deprecated the
x86_64-sun-solaristarget in favor ofx86_64-pc-solaris. - Rustdoc now only accepts
,,, and\tas delimiters for specifying languages in code blocks. - Rustc now catches more cases of
pub_use_of_private_extern_crate - Changes in how proc macros handle whitespace may lead to panics when used
with older
proc-macro-hackversions. Acargo updateshould be sufficient to fix this in all cases. - Turn
#[derive]into a regular macro attribute
Version 1.51.0 (2021-03-25)
Language
- You can now parameterize items such as functions, traits, and
structs by constant values in addition to by types and lifetimes. Also known as "const generics" E.g. you can now write the following. Note: Only values of primitive integers,bool, orchartypes are currently permitted.struct GenericArray<T, const LENGTH: usize> { inner: [T; LENGTH] } impl<T, const LENGTH: usize> GenericArray<T, LENGTH> { const fn last(&self) -> Option<&T> { if LENGTH == 0 { None } else { Some(&self.inner[LENGTH - 1]) } } }
Compiler
- Added the
-Csplit-debuginfocodegen option for macOS platforms. This option controls whether debug information is split across multiple files or packed into a single file. Note This option is unstable on other platforms. - Added tier 3* support for
aarch64_be-unknown-linux-gnu,aarch64-unknown-linux-gnu_ilp32, andaarch64_be-unknown-linux-gnu_ilp32targets. - Added tier 3 support for
i386-unknown-linux-gnuandi486-unknown-linux-gnutargets. - The
target-cpu=nativeoption will now detect individual features of CPUs.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Box::downcastis now also implemented for anydyn Any + Send + Syncobject.strnow implementsAsMut<str>.u64andu128now implementFrom<char>.Erroris now implemented for&TwhereTimplementsError.Poll::{map_ok, map_err}are now implemented forPoll<Option<Result<T, E>>>.unsigned_absis now implemented for all signed integer types.io::Emptynow implementsio::Seek.rc::Weak<T>andsync::Weak<T>'s methods such asas_ptrare now implemented forT: ?Sizedtypes.DivandRemby theirNonZerovariant is now implemented for all unsigned integers.
Stabilized APIs
Arc::decrement_strong_countArc::increment_strong_countOnce::call_once_forcePeekable::next_if_eqPeekable::next_ifSeek::stream_positionarray::IntoIterpanic::panic_anyptr::addr_of!ptr::addr_of_mut!slice::fill_withslice::split_inclusive_mutslice::split_inclusiveslice::strip_prefixslice::strip_suffixstr::split_inclusivesync::OnceStatetask::WakeVecDeque::rangeVecDeque::range_mut
Cargo
- Added the
split-debuginfoprofile option to control the -Csplit-debuginfo codegen option. - Added the
resolverfield toCargo.tomlto enable the new feature resolver and CLI option behavior. Version 2 of the feature resolver will try to avoid unifying features of dependencies where that unification could be unwanted. Such as using the same dependency with astdfeature in a build scripts and proc-macros, while using theno-stdfeature in the final binary. See the Cargo book documentation for more information on the feature.
Rustdoc
- Rustdoc will now include documentation for methods available from nested
Dereftraits. - You can now provide a
--default-themeflag which sets the default theme to use for documentation.
Various improvements to intra-doc links:
- You can link to non-path primitives such as
slice. - You can link to associated items.
- You can now include generic parameters when linking to items, like
Vec<T>.
Misc
Compatibility Notes
- WASI platforms no longer use the
wasm-bindgenABI, and instead use the wasm32 ABI. rustcno longer promotes division, modulo and indexing operations toconstthat could fail.- The minimum version of glibc for the following platforms has been bumped to version 2.31
for the distributed artifacts.
armv5te-unknown-linux-gnueabisparc64-unknown-linux-gnuthumbv7neon-unknown-linux-gnueabihfarmv7-unknown-linux-gnueabix86_64-unknown-linux-gnux32
atomic::spin_loop_hinthas been deprecated. It's recommended to usehint::spin_loopinstead.
Internal Only
Version 1.50.0 (2021-02-11)
Language
- You can now use
constvalues forxin[x; N]array expressions. This has been technically possible since 1.38.0, as it was unintentionally stabilized. - Assignments to
ManuallyDrop<T>union fields are now considered safe.
Compiler
- Added tier 3* support for the
armv5te-unknown-linux-uclibceabitarget. - Added tier 3 support for the
aarch64-apple-ios-macabitarget. - The
x86_64-unknown-freebsdis now built with the full toolset. - Dropped support for all cloudabi targets.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
proc_macro::Punctnow implementsPartialEq<char>.ops::{Index, IndexMut}are now implemented for fixed sized arrays of any length.- On Unix platforms, the
std::fs::Filetype now has a "niche" of-1. This value cannot be a valid file descriptor, and now meansOption<File>takes up the same amount of space asFile.
Stabilized APIs
bool::thenbtree_map::Entry::or_insert_with_keyf32::clampf64::clamphash_map::Entry::or_insert_with_keyOrd::clampRefCell::takeslice::fillUnsafeCell::get_mut
The following previously stable methods are now const.
IpAddr::is_ipv4IpAddr::is_ipv6IpAddr::is_unspecifiedIpAddr::is_loopbackIpAddr::is_multicastIpv4Addr::octetsIpv4Addr::is_loopbackIpv4Addr::is_privateIpv4Addr::is_link_localIpv4Addr::is_multicastIpv4Addr::is_broadcastIpv4Addr::is_documentationIpv4Addr::to_ipv6_compatibleIpv4Addr::to_ipv6_mappedIpv6Addr::segmentsIpv6Addr::is_unspecifiedIpv6Addr::is_loopbackIpv6Addr::is_multicastIpv6Addr::to_ipv4Layout::sizeLayout::alignLayout::from_size_alignpowfor all integer types.checked_powfor all integer types.saturating_powfor all integer types.wrapping_powfor all integer types.next_power_of_twofor all unsigned integer types.checked_next_power_of_twofor all unsigned integer types.
Cargo
- Added the
[build.rustc-workspace-wrapper]option. This option sets a wrapper to execute instead ofrustc, for workspace members only. cargo:rerun-if-changedwill now, if provided a directory, scan the entire contents of that directory for changes.- Added the
--workspaceflag to thecargo updatecommand.
Misc
- The search results tab and the help button are focusable with keyboard in rustdoc.
- Running tests will now print the total time taken to execute.
Compatibility Notes
- The
compare_and_swapmethod on atomics has been deprecated. It's recommended to use thecompare_exchangeandcompare_exchange_weakmethods instead. - Changes in how
TokenStreams are checked have fixed some cases where you could write unhygenicmacro_rules!macros. #![test]as an inner attribute is now considered unstable like other inner macro attributes, and reports an error by default through thesoft_unstablelint.- Overriding a
forbidlint at the same level that it was set is now a hard error. - You can no longer intercept
panic!calls by supplying your own macro. It's recommended to use the#[panic_handler]attribute to provide your own implementation. - Semi-colons after item statements (e.g.
struct Foo {};) now produce a warning.
Version 1.49.0 (2020-12-31)
Language
- Unions can now implement
Drop, and you can now have a field in a union withManuallyDrop<T>. - You can now cast uninhabited enums to integers.
- You can now bind by reference and by move in patterns. This
allows you to selectively borrow individual components of a type. E.g.
#[derive(Debug)] struct Person { name: String, age: u8, } let person = Person { name: String::from("Alice"), age: 20, }; // `name` is moved out of person, but `age` is referenced. let Person { name, ref age } = person; println!("{} {}", name, age);
Compiler
- Added tier 1* support for
aarch64-unknown-linux-gnu. - Added tier 2 support for
aarch64-apple-darwin. - Added tier 2 support for
aarch64-pc-windows-msvc. - Added tier 3 support for
mipsel-unknown-none. - Raised the minimum supported LLVM version to LLVM 9.
- Output from threads spawned in tests is now captured.
- Change os and vendor values to "none" and "unknown" for some targets
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
RangeInclusivenow checks for exhaustion when callingcontainsand indexing.ToString::to_stringnow no longer shrinks the internal buffer in the default implementation.
Stabilized APIs
The following previously stable methods are now const.
Cargo
- Building a crate with
cargo-packageshould now be independently reproducible. cargo-treenow marks proc-macro crates.- Added
CARGO_PRIMARY_PACKAGEbuild-time environment variable. This variable will be set if the crate being built is one the user selected to build, either with-por through defaults. - You can now use glob patterns when specifying packages & targets.
Compatibility Notes
- Demoted
i686-unknown-freebsdfrom host tier 2 to target tier 2 support. - Macros that end with a semi-colon are now treated as statements even if they expand to nothing.
- Rustc will now check for the validity of some built-in attributes on enum variants. Previously such invalid or unused attributes could be ignored.
- Leading whitespace is stripped more uniformly in documentation comments, which may change behavior. You read this post about the changes for more details.
- Trait bounds are no longer inferred for associated types.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- rustc's internal crates are now compiled using the
initial-execThread Local Storage model. - Calculate visibilities once in resolve.
- Added
systemto thellvm-libunwindbootstrap config option. - Added
--colorfor configuring terminal color support to bootstrap.
Version 1.48.0 (2020-11-19)
Language
- The
unsafekeyword is now syntactically permitted on modules. This is still rejected semantically, but can now be parsed by procedural macros.
Compiler
- Stabilised the
-C link-self-contained=<yes|no>compiler flag. This tellsrustcwhether to link its own C runtime and libraries or to rely on a external linker to find them. (Supported only onwindows-gnu,linux-musl, andwasiplatforms.) - You can now use
-C target-feature=+crt-staticonlinux-gnutargets. Note: If you're using cargo you must explicitly pass the--targetflag. - Added tier 2* support for
aarch64-unknown-linux-musl.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
io::Writeis now implemented for&ChildStdin&Sink,&Stdout, and&Stderr.- All arrays of any length now implement
TryFrom<Vec<T>>. - The
matches!macro now supports having a trailing comma. Vec<A>now implementsPartialEq<[B]>whereA: PartialEq<B>.- The
RefCell::{replace, replace_with, clone}methods now all use#[track_caller].
Stabilized APIs
The following previously stable methods are now const fn's:
Option::is_someOption::is_noneOption::as_refResult::is_okResult::is_errResult::as_refOrdering::reverseOrdering::then
Cargo
Rustdoc
- You can now link to items in
rustdocusing the intra-doc link syntax. E.g./// Uses [`std::future`]will automatically generate a link tostd::future's documentation. See "Linking to items by name" for more information. - You can now specify
#[doc(alias = "<alias>")]on items to add search aliases when searching throughrustdoc's UI.
Compatibility Notes
- Promotion of references to
'staticlifetime insideconst fnnow follows the same rules as inside afnbody. In particular,&foo()will not be promoted to'staticlifetime any more insideconst fns. - Associated type bindings on trait objects are now verified to meet the bounds declared on the trait when checking that they implement the trait.
- When trait bounds on associated types or opaque types are ambiguous, the compiler no longer makes an arbitrary choice on which bound to use.
- Fixed recursive nonterminals not being expanded in macros during pretty-print/reparse check. This may cause errors if your macro wasn't correctly handling recursive nonterminal tokens.
&mutreferences to non zero-sized types are no longer promoted.rustcwill now warn if you use attributes like#[link_name]or#[cold]in places where they have no effect.- Updated
_mm256_extract_epi8and_mm256_extract_epi16signatures inarch::{x86, x86_64}to returni32to match the vendor signatures. mem::uninitializedwill now panic if any inner types inside a struct or enum disallow zero-initialization.#[target_feature]will now error if used in a place where it has no effect.- Foreign exceptions are now caught by
catch_unwindand will cause an abort. Note: This behaviour is not guaranteed and is still considered undefined behaviour, see thecatch_unwinddocumentation for further information.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- Building
rustcfrom source now usesninjaby default overmake. You can continue building withmakeby settingninja=falsein yourconfig.toml. - cg_llvm:
fewer_namesinuncached_llvm_type - Made
ensure_sufficient_stack()non-generic
Version 1.47.0 (2020-10-08)
Language
Compiler
- Stabilized the
-C control-flow-guardcodegen option, which enables Control Flow Guard for Windows platforms, and is ignored on other platforms. - Upgraded to LLVM 11.
- Added tier 3* support for the
thumbv4t-none-eabitarget. - Upgrade the FreeBSD toolchain to version 11.4
RUST_BACKTRACE's output is now more compact.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
CStrnow implementsIndex<RangeFrom<usize>>.- Traits in
std/coreare now implemented for arrays of any length, not just those of length less than 33. ops::RangeFullandops::Rangenow implement Default.panic::Locationnow implementsCopy,Clone,Eq,Hash,Ord,PartialEq, andPartialOrd.
Stabilized APIs
Ident::new_rawRange::is_emptyRangeInclusive::is_emptyResult::as_derefResult::as_deref_mutVec::leakpointer::offset_fromf32::TAUf64::TAU
The following previously stable APIs have now been made const.
- The
newmethod for allNonZerointegers. - The
checked_add,checked_sub,checked_mul,checked_neg,checked_shl,checked_shr,saturating_add,saturating_sub, andsaturating_mulmethods for all integers. - The
checked_abs,saturating_abs,saturating_neg, andsignumfor all signed integers. - The
is_ascii_alphabetic,is_ascii_uppercase,is_ascii_lowercase,is_ascii_alphanumeric,is_ascii_digit,is_ascii_hexdigit,is_ascii_punctuation,is_ascii_graphic,is_ascii_whitespace, andis_ascii_controlmethods forcharandu8.
Cargo
build-dependenciesare now built with opt-level 0 by default. You can override this by setting the following in yourCargo.toml.[profile.release.build-override] opt-level = 3cargo-helpwill now display man pages for commands rather just the--helptext.cargo-metadatanow emits atestfield indicating if a target has tests enabled.workspace.default-membersnow respectsworkspace.exclude.cargo-publishwill now use an alternative registry by default if it's the only registry specified inpackage.publish.
Misc
- Added a help button beside Rustdoc's searchbar that explains rustdoc's type based search.
- Added the Ayu theme to rustdoc.
Compatibility Notes
- Bumped the minimum supported Emscripten version to 1.39.20.
- Fixed a regression parsing
{} && falsein tail expressions. - Added changes to how proc-macros are expanded in
macro_rules!that should help to preserve more span information. These changes may cause compilation errors if your macro was unhygenic or didn't correctly handleDelimiter::None. - Moved support for the CloudABI target to tier 3.
linux-gnutargets now require minimum kernel 2.6.32 and glibc 2.11.- Added the
rustc-docscomponent. This allows you to install and read the documentation for the compiler internal APIs. (Currently only available forx86_64-unknown-linux-gnu.)
Internal Only
- Improved default settings for bootstrapping in
x.py. You can read details about this change in the "Changes tox.pydefaults" post on the Inside Rust blog.
Version 1.46.0 (2020-08-27)
Language
if,match, andloopexpressions can now be used in const functions.- Additionally you are now also able to coerce and cast to slices (
&[T]) in const functions. - The
#[track_caller]attribute can now be added to functions to use the function's caller's location information for panic messages. - Recursively indexing into tuples no longer needs parentheses. E.g.
x.0.0over(x.0).0. mem::transmutecan now be used in statics and constants. Note You currently can't usemem::transmutein constant functions.
Compiler
- You can now use the
cdylibtarget on Apple iOS and tvOS platforms. - Enabled static "Position Independent Executables" by default
for
x86_64-unknown-linux-musl.
Libraries
mem::forgetis now aconst fn.Stringnow implementsFrom<char>.- The
leading_ones, andtrailing_onesmethods have been stabilised for all integer types. vec::IntoIter<T>now implementsAsRef<[T]>.- All non-zero integer types (
NonZeroU8) now implementTryFromfor their zero-able equivalent (e.g.TryFrom<u8>). &[T]and&mut [T]now implementPartialEq<Vec<T>>.(String, u16)now implementsToSocketAddrs.vec::Drain<'_, T>now implementsAsRef<[T]>.
Stabilized APIs
Cargo
Added a number of new environment variables that are now available when compiling your crate.
CARGO_BIN_NAMEandCARGO_CRATE_NAMEProviding the name of the specific binary being compiled and the name of the crate.CARGO_PKG_LICENSEThe license from the manifest of the package.CARGO_PKG_LICENSE_FILEThe path to the license file.
Compatibility Notes
- The target configuration option
abi_blacklisthas been renamed tounsupported_abis. The old name will still continue to work. - Rustc will now warn if you cast a C-like enum that implements
Drop. This was previously accepted but will become a hard error in a future release. - Rustc will fail to compile if you have a struct with
#[repr(i128)]or#[repr(u128)]. This representation is currently only allowed onenums. - Tokens passed to
macro_rules!are now always captured. This helps ensure that spans have the correct information, and may cause breakage if you were relying on receiving spans with dummy information. - The InnoSetup installer for Windows is no longer available. This was a legacy installer that was replaced by a MSI installer a few years ago but was still being built.
{f32, f64}::asinhnow returns the correct values for negative numbers.- Rustc will no longer accept overlapping trait implementations that only differ in how the lifetime was bound.
- Rustc now correctly relates the lifetime of an existential associated
type. This fixes some edge cases where
rustcwould erroneously allow you to pass a shorter lifetime than expected. - Rustc now dynamically links to
libz(also calledzlib) on Linux. The library will need to be installed forrustcto work, even though we expect it to be already available on most systems. - Tests annotated with
#[should_panic]are broken on ARMv7 while running under QEMU. - Pretty printing of some tokens in procedural macros changed. The exact output returned by rustc's pretty printing is an unstable implementation detail: we recommend any macro relying on it to switch to a more robust parsing system.
Version 1.45.2 (2020-08-03)
Version 1.45.1 (2020-07-30)
- Fix const propagation with references.
- rustfmt accepts rustfmt_skip in cfg_attr again.
- Avoid spurious implicit region bound.
- Install clippy on x.py install
Version 1.45.0 (2020-07-16)
Language
- Out of range float to int conversions using
ashas been defined as a saturating conversion. This was previously undefined behaviour, but you can use the{f64, f32}::to_int_uncheckedmethods to continue using the current behaviour, which may be desirable in rare performance sensitive situations. mem::Discriminant<T>now usesT's discriminant type instead of always usingu64.- Function like procedural macros can now be used in expression, pattern, and statement
positions. This means you can now use a function-like procedural macro
anywhere you can use a declarative (
macro_rules!) macro.
Compiler
- You can now override individual target features through the
target-featureflag. E.g.-C target-feature=+avx2 -C target-feature=+fmais now equivalent to-C target-feature=+avx2,+fma. - Added the
force-unwind-tablesflag. This option allows rustc to always generate unwind tables regardless of panic strategy. - Added the
embed-bitcodeflag. This codegen flag allows rustc to include LLVM bitcode into generatedrlibs (this is on by default). - Added the
tinyvalue to thecode-modelcodegen flag. - Added tier 3 support* for the
mipsel-sony-psptarget. - Added tier 3 support for the
thumbv7a-uwp-windows-msvctarget. - Upgraded to LLVM 10.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
net::{SocketAddr, SocketAddrV4, SocketAddrV6}now implementsPartialOrdandOrd.proc_macro::TokenStreamnow implementsDefault.- You can now use
charwithops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo}to iterate over a range of codepoints. E.g. you can now write the following;for ch in 'a'..='z' { print!("{}", ch); } println!(); // Prints "abcdefghijklmnopqrstuvwxyz" OsStringnow implementsFromStr.- The
saturating_negmethod has been added to all signed integer primitive types, and thesaturating_absmethod has been added for all integer primitive types. Arc<T>,Rc<T>now implementFrom<Cow<'_, T>>, andBoxnow implementsFrom<Cow>whenTis[T: Copy],str,CStr,OsStr, orPath.Box<[T]>now implementsFrom<[T; N]>.BitOrandBitOrAssignare implemented for allNonZerointeger types.- The
fetch_min, andfetch_maxmethods have been added to all atomic integer types. - The
fetch_updatemethod has been added to all atomic integer types.
Stabilized APIs
Arc::as_ptrBTreeMap::remove_entryRc::as_ptrrc::Weak::as_ptrrc::Weak::from_rawrc::Weak::into_rawstr::strip_prefixstr::strip_suffixsync::Weak::as_ptrsync::Weak::from_rawsync::Weak::into_rawchar::UNICODE_VERSIONSpan::resolved_atSpan::located_atSpan::mixed_siteunix::process::CommandExt::arg0
Cargo
Misc
- Rustdoc now supports strikethrough text in Markdown. E.g.
~~outdated information~~becomes "outdated information". - Added an emoji to Rustdoc's deprecated API message.
Compatibility Notes
- Trying to self initialize a static value (that is creating a value using itself) is unsound and now causes a compile error.
{f32, f64}::powinow returns a slightly different value on Windows. This is due to changes in LLVM's intrinsics which{f32, f64}::powiuses.- Rustdoc's CLI's extra error exit codes have been removed. These were previously undocumented and not intended for public use. Rustdoc still provides a non-zero exit code on errors.
- Rustc's
ltoflag is incompatible with the newembed-bitcode=no. This may cause issues if LTO is enabled throughRUSTFLAGSorcargo rustcflags while cargo is addingembed-bitcodeitself. The recommended way to control LTO is with Cargo profiles, either inCargo.tomlor.cargo/config, or by settingCARGO_PROFILE_<name>_LTOin the environment.
Internals Only
Version 1.44.1 (2020-06-18)
- rustfmt accepts rustfmt_skip in cfg_attr again.
- Don't hash executable filenames on apple platforms, fixing backtraces.
- Fix crashes when finding backtrace on macOS.
- Clippy applies lint levels into different files.
Version 1.44.0 (2020-06-04)
Language
Syntax-only changes
#[cfg(FALSE)]
mod foo {
mod bar {
mod baz; // `foo/bar/baz.rs` doesn't exist, but no error!
}
}
These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
Compiler
- Rustc now respects the
-C codegen-unitsflag in incremental mode. Additionally when in incremental mode rustc defaults to 256 codegen units. - Refactored
catch_unwindto have zero-cost, unless unwinding is enabled and a panic is thrown. - Added tier 3* support for the
aarch64-unknown-noneandaarch64-unknown-none-softfloattargets. - Added tier 3 support for
arm64-apple-tvosandx86_64-apple-tvostargets.
Libraries
- Special cased
vec![]to map directly toVec::new(). This allowsvec![]to be able to be used inconstcontexts. convert::Infalliblenow implementsHash.OsStringnow implementsDerefMutandIndexMutreturning a&mut OsStr.- Unicode 13 is now supported.
Stringnow implementsFrom<&mut str>.IoSlicenow implementsCopy.Vec<T>now implementsFrom<[T; N]>. WhereNis at most 32.proc_macro::LexErrornow implementsfmt::DisplayandError.from_le_bytes,to_le_bytes,from_be_bytes,to_be_bytes,from_ne_bytes, andto_ne_bytesmethods are nowconstfor all integer types.
Stabilized APIs
PathBuf::with_capacityPathBuf::capacityPathBuf::clearPathBuf::reservePathBuf::reserve_exactPathBuf::shrink_to_fitf32::to_int_uncheckedf64::to_int_uncheckedLayout::align_toLayout::pad_to_alignLayout::arrayLayout::extend
Cargo
- Added the
cargo treecommand which will print a tree graph of your dependencies. E.g.
You can also display dependencies on multiple versions of the same crate withmdbook v0.3.2 (/Users/src/rust/mdbook) ├── ammonia v3.0.0 │ ├── html5ever v0.24.0 │ │ ├── log v0.4.8 │ │ │ └── cfg-if v0.1.9 │ │ ├── mac v0.1.1 │ │ └── markup5ever v0.9.0 │ │ ├── log v0.4.8 (*) │ │ ├── phf v0.7.24 │ │ │ └── phf_shared v0.7.24 │ │ │ ├── siphasher v0.2.3 │ │ │ └── unicase v1.4.2 │ │ │ [build-dependencies] │ │ │ └── version_check v0.1.5 ...cargo tree -d(short forcargo tree --duplicates).
Misc
Compatibility Notes
- Rustc now correctly generates static libraries on Windows GNU targets with
the
.aextension, rather than the previous.lib. - Removed the
-C no_integrated_asflag from rustc. - The
file_nameproperty in JSON output of macro errors now points the actual source file rather than the previous format of<NAME macros>. Note: this may not point to a file that actually exists on the user's system. - The minimum required external LLVM version has been bumped to LLVM 8.
mem::{zeroed, uninitialised}will now panic when used with types that do not allow zero initialization such asNonZeroU8. This was previously a warning.- In 1.45.0 (the next release) converting a
f64tou32using theasoperator has been defined as a saturating operation. This was previously undefined behaviour, but you can use the{f64, f32}::to_int_uncheckedmethods to continue using the current behaviour, which may be desirable in rare performance sensitive situations.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- dep_graph Avoid allocating a set on when the number reads are small.
- Replace big JS dict with JSON parsing.
Version 1.43.1 (2020-05-07)
- Updated openssl-src to 1.1.1g for CVE-2020-1967.
- Fixed the stabilization of AVX-512 features.
- Fixed
cargo package --listnot working with unpublished dependencies.
Version 1.43.0 (2020-04-23)
Language
- Fixed using binary operations with
&{number}(e.g.&1.0) not having the type inferred correctly. - Attributes such as
#[cfg()]can now be used onifexpressions.
Syntax only changes
- Allow
type Foo: Ordsyntactically. - Fuse associated and extern items up to defaultness.
- Syntactically allow
selfin allfncontexts. - Merge
fnsyntax + cleanup item parsing. itemmacro fragments can be interpolated intotraits,impls, andexternblocks. For example, you may now write:macro_rules! mac_trait { ($i:item) => { trait T { $i } } } mac_trait! { fn foo() {} }
These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
Compiler
- You can now pass multiple lint flags to rustc to override the previous
flags. For example;
rustc -D unused -A unused-variablesdenies everything in theunusedlint group exceptunused-variableswhich is explicitly allowed. However, passingrustc -A unused-variables -D unuseddenies everything in theunusedlint group includingunused-variablessince the allow flag is specified before the deny flag (and therefore overridden). - rustc will now prefer your system MinGW libraries over its bundled libraries
if they are available on
windows-gnu. - rustc now buffers errors/warnings printed in JSON.
Libraries
Arc<[T; N]>,Box<[T; N]>, andRc<[T; N]>, now implementTryFrom<Arc<[T]>>,TryFrom<Box<[T]>>, andTryFrom<Rc<[T]>>respectively. Note These conversions are only available whenNis0..=32.- You can now use associated constants on floats and integers directly, rather
than having to import the module. e.g. You can now write
u32::MAXorf32::NANwith no imports. u8::is_asciiis nowconst.Stringnow implementsAsMut<str>.- Added the
primitivemodule tostdandcore. This module reexports Rust's primitive types. This is mainly useful in macros where you want avoid these types being shadowed. - Relaxed some of the trait bounds on
HashMapandHashSet. string::FromUtf8Errornow implementsClone + Eq.
Stabilized APIs
Cargo
- You can now set config
[profile]s in your.cargo/config, or through your environment. - Cargo will now set
CARGO_BIN_EXE_<name>pointing to a binary's executable path when running integration tests or benchmarks.<name>is the name of your binary as-is e.g. If you wanted the executable path for a binary namedmy-programyou would useenv!("CARGO_BIN_EXE_my-program").
Misc
- Certain checks in the
const_errlint were deemed unrelated to const evaluation, and have been moved to theunconditional_panicandarithmetic_overflowlints.
Compatibility Notes
- Having trailing syntax in the
assert!macro is now a hard error. This has been a warning since 1.36.0. - Fixed
Selfnot having the correctly inferred type. This incorrectly led to some instances being accepted, and now correctly emits a hard error.
Internal Only
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.
- All components are now built with
opt-level=3instead of2. - Improved how rustc generates drop code.
- Improved performance from
#[inline]-ing certain hot functions. - traits: preallocate 2 Vecs of known initial size
- Avoid exponential behaviour when relating types
- Skip
Dropterminators for enum variants without drop glue - Improve performance of coherence checks
- Deduplicate types in the generator witness
- Invert control in struct_lint_level.
Version 1.42.0 (2020-03-12)
Language
-
You can now use the slice pattern syntax with subslices. e.g.
fn foo(words: &[&str]) { match words { ["Hello", "World", "!", ..] => println!("Hello World!"), ["Foo", "Bar", ..] => println!("Baz"), rest => println!("{:?}", rest), } } -
You can now use
#[repr(transparent)]on univariantenums. Meaning that you can create an enum that has the exact layout and ABI of the type it contains. -
You can now use outer attribute procedural macros on inline modules.
-
There are some syntax-only changes:
defaultis syntactically allowed before items intraitdefinitions.- Items in
impls (i.e.consts,types, andfns) may syntactically leave out their bodies in favor of;. - Bounds on associated types in
impls are now syntactically allowed (e.g.type Foo: Ord;). ...(the C-variadic type) may occur syntactically directly as the type of any function parameter.
These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by procedural macros and conditional compilation.
Compiler
- Added tier 2* support for
armv7a-none-eabi. - Added tier 2 support for
riscv64gc-unknown-linux-gnu. Option::{expect,unwrap}andResult::{expect, expect_err, unwrap, unwrap_err}now produce panic messages pointing to the location where they were called, rather thancore's internals.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
iter::Empty<T>now implementsSendandSyncfor anyT.Pin::{map_unchecked, map_unchecked_mut}no longer require the return type to implementSized.io::Cursornow derivesPartialEqandEq.Layout::newis nowconst.- Added Standard Library support for
riscv64gc-unknown-linux-gnu.
Stabilized APIs
CondVar::wait_whileCondVar::wait_timeout_whileDebugMap::keyDebugMap::valueManuallyDrop::takematches!ptr::slice_from_raw_parts_mutptr::slice_from_raw_parts
Cargo
Compatibility Notes
Error::descriptionhas been deprecated, and its use will now produce a warning. It's recommended to useDisplay/to_stringinstead.
Version 1.41.1 (2020-02-27)
- Always check types of static items
- Always check lifetime bounds of
Copyimpls - Fix miscompilation in callers of
Layout::repeat - Rust 1.41.0 was announced as the last Rust release with tier 1 or tier 2 support for 32-bit Apple targets. That announcement did not expect a patch release. 1.41.1 also includes release binaries for these targets.
Version 1.41.0 (2020-01-30)
Language
- You can now pass type parameters to foreign items when implementing
traits. E.g. You can now write
impl<T> From<Foo> for Vec<T> {}. - You can now arbitrarily nest receiver types in the
selfposition. E.g. you can now writefn foo(self: Box<Box<Self>>) {}. Previously onlySelf,&Self,&mut Self,Arc<Self>,Rc<Self>, andBox<Self>were allowed. - You can now use any valid identifier in a
format_argsmacro. Previously identifiers starting with an underscore were not allowed. - Visibility modifiers (e.g.
pub) are now syntactically allowed on trait items and enum variants. These are still rejected semantically, but can be seen and parsed by procedural macros and conditional compilation. - You can now define a Rust
extern "C"function withBox<T>and useT*as the corresponding type on the C side. Please see the documentation for more information, including the important caveat about preferring to avoidBox<T>in Rust signatures for functions defined in C.
Compiler
- Rustc will now warn if you have unused loop
'labels. - Removed support for the
i686-unknown-dragonflytarget. - Added tier 3 support* for the
riscv64gc-unknown-linux-gnutarget. - You can now pass an arguments file passing the
@pathsyntax to rustc. Note that the format differs somewhat from what is found in other tooling; please see the documentation for more information. - You can now provide
--externflag without a path, indicating that it is available from the search path or specified with an-Lflag.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- The
core::panicmodule is now stable. It was already stable throughstd. NonZero*numerics now implementFrom<NonZero*>if it's a smaller integer width. E.g.NonZeroU16now implementsFrom<NonZeroU8>.MaybeUninit<T>now implementsfmt::Debug.
Stabilized APIs
Result::map_orResult::map_or_elsestd::rc::Weak::weak_countstd::rc::Weak::strong_countstd::sync::Weak::weak_countstd::sync::Weak::strong_count
Cargo
- Cargo will now document all the private items for binary crates by default.
cargo-installwill now reinstall the package if it detects that it is out of date.- Cargo.lock now uses a more git friendly format that should help to reduce merge conflicts.
- You can now override specific dependencies's build settings E.g.
[profile.dev.package.image] opt-level = 2sets theimagecrate's optimisation level to2for debug builds. You can also use[profile.<profile>.build-override]to override build scripts and their dependencies.
Misc
- You can now specify
editionin documentation code blocks to compile the block for that edition. E.g.edition2018tells rustdoc that the code sample should be compiled the 2018 edition of Rust. - You can now provide custom themes to rustdoc with
--theme, and check the current theme with--check-theme. - You can use
#[cfg(doc)]to compile an item when building documentation.
Compatibility Notes
- As previously announced 1.41 will be the last tier 1 release for 32-bit Apple targets. This means that the source code is still available to build, but the targets are no longer being tested and release binaries for those platforms will no longer be distributed by the Rust project. Please refer to the linked blog post for more information.
Version 1.40.0 (2019-12-19)
Language
-
You can now use tuple
structs and tupleenumvariant's constructors inconstcontexts. e.g.pub struct Point(i32, i32); const ORIGIN: Point = { let constructor = Point; constructor(0, 0) }; -
You can now mark
structs,enums, andenumvariants with the#[non_exhaustive]attribute to indicate that there may be variants or fields added in the future. For example this requires adding a wild-card branch (_ => {}) to any match statements on a non-exhaustiveenum. (RFC 2008) -
You can now use function-like procedural macros in
externblocks and in type positions. e.g.type Generated = macro!(); -
The
metapattern matcher inmacro_rules!now correctly matches the modern attribute syntax. For example(#[$m:meta])now matches#[attr],#[attr{tokens}],#[attr[tokens]], and#[attr(tokens)].
Compiler
- Added tier 3 support* for the
thumbv7neon-unknown-linux-musleabihftarget. - Added tier 3 support for the
aarch64-unknown-none-softfloattarget. - Added tier 3 support for the
mips64-unknown-linux-muslabi64, andmips64el-unknown-linux-muslabi64targets.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Stabilized APIs
BTreeMap::get_key_valueHashMap::get_key_valueOption::as_deref_mutOption::as_derefOption::flattenUdpSocket::peer_addrf32::to_be_bytesf32::to_le_bytesf32::to_ne_bytesf64::to_be_bytesf64::to_le_bytesf64::to_ne_bytesf32::from_be_bytesf32::from_le_bytesf32::from_ne_bytesf64::from_be_bytesf64::from_le_bytesf64::from_ne_bytesmem::takeslice::repeattodo!
Cargo
- Cargo will now always display warnings, rather than only on fresh builds.
- Feature flags (except
--all-features) passed to a virtual workspace will now produce an error. Previously these flags were ignored. - You can now publish
dev-dependencieswithout including aversion.
Misc
Compatibility Notes
- As previously announced, any previous NLL warnings in the 2015 edition are now hard errors.
- The
include!macro will now warn if it failed to include the entire file. Theinclude!macro unintentionally only includes the first expression in a file, and this can be unintuitive. This will become either a hard error in a future release, or the behavior may be fixed to include all expressions as expected. - Using
#[inline]on function prototypes and consts now emits a warning underunused_attributelint. Using#[inline]anywhere else inside traits orexternblocks now correctly emits a hard error.
Version 1.39.0 (2019-11-07)
Language
- You can now create
asyncfunctions and blocks withasync fn,async move {}, andasync {}respectively, and you can now call.awaiton async expressions. - You can now use certain attributes on function, closure, and function pointer
parameters. These attributes include
cfg,cfg_attr,allow,warn,deny,forbidas well as inert helper attributes used by procedural macro attributes applied to items. e.g.fn len( #[cfg(windows)] slice: &[u16], #[cfg(not(windows))] slice: &[u8], ) -> usize { slice.len() } - You can now take shared references to bind-by-move patterns in the
ifguards ofmatcharms. e.g.fn main() { let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]); match array { nums // ---- `nums` is bound by move. if nums.iter().sum::<u8>() == 10 // ^------ `.iter()` implicitly takes a reference to `nums`. => { drop(nums); // ----------- Legal as `nums` was bound by move and so we have ownership. } _ => unreachable!(), } }
Compiler
- Added tier 3* support for the
i686-unknown-uefitarget. - Added tier 3 support for the
sparc64-unknown-openbsdtarget. - rustc will now trim code snippets in diagnostics to fit in your terminal. Note Cargo currently doesn't use this feature. Refer to cargo#7315 to track this feature's progress.
- You can now pass
--show-outputargument to test binaries to print the output of successful tests.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Vec::newandString::neware nowconstfunctions.LinkedList::newis now aconstfunction.str::len,[T]::lenandstr::as_bytesare nowconstfunctions.- The
abs,wrapping_abs, andoverflowing_absnumeric functions are nowconst.
Stabilized APIs
Cargo
- You can now publish git dependencies if supplied with a
version. - The
--allflag has been renamed to--workspace. Using--allis now deprecated.
Misc
Compatibility Notes
- Code that was previously accepted by the old borrow checker, but rejected by the NLL borrow checker is now a hard error in Rust 2018. This was previously a warning, and will also become a hard error in the Rust 2015 edition in the 1.40.0 release.
rustdocnow requiresrustcto be installed and in the same directory to run tests. This should improve performance when running a large amount of doctests.- The
try!macro will now issue a deprecation warning. It is recommended to use the?operator instead. asinh(-0.0)now correctly returns-0.0. Previously this returned0.0.
Version 1.38.0 (2019-09-26)
Language
- The
#[global_allocator]attribute can now be used in submodules. - The
#[deprecated]attribute can now be used on macros.
Compiler
- Added pipelined compilation support to
rustc. This will improve compilation times in some cases. For further information please refer to the "Evaluating pipelined rustc compilation" thread. - Added tier 3* support for the
aarch64-uwp-windows-msvc,i686-uwp-windows-gnu,i686-uwp-windows-msvc,x86_64-uwp-windows-gnu, andx86_64-uwp-windows-msvctargets. - Added tier 3 support for the
armv7-unknown-linux-gnueabiandarmv7-unknown-linux-musleabitargets. - Added tier 3 support for the
hexagon-unknown-linux-musltarget. - Added tier 3 support for the
riscv32i-unknown-none-elftarget. - Upgraded to LLVM 9.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
ascii::EscapeDefaultnow implementsCloneandDisplay.- Derive macros for prelude traits (e.g.
Clone,Debug,Hash) are now available at the same path as the trait. (e.g. TheClonederive macro is available atstd::clone::Clone). This also makes all built-in macros available instd/coreroot. e.g.std::include_bytes!. str::Charsnow implementsDebug.slice::{concat, connect, join}now accepts&[T]in addition to&T.*const Tand*mut Tnow implementmarker::Unpin.Arc<[T]>andRc<[T]>now implementFromIterator<T>.- Added euclidean remainder and division operations (
div_euclid,rem_euclid) to all numeric primitives. Additionallychecked,overflowing, andwrappingversions are available for all integer primitives. thread::AccessErrornow implementsClone,Copy,Eq,Error, andPartialEq.iter::{StepBy, Peekable, Take}now implementDoubleEndedIterator.
Stabilized APIs
<*const T>::cast<*mut T>::castDuration::as_secs_f32Duration::as_secs_f64Duration::div_f32Duration::div_f64Duration::from_secs_f32Duration::from_secs_f64Duration::mul_f32Duration::mul_f64any::type_name
Cargo
- Added pipelined compilation support to
cargo. - You can now pass the
--featuresoption multiple times to enable multiple features.
Rustdoc
Misc
Compatibility Notes
- The
x86_64-unknown-uefiplatform can not be built with rustc 1.38.0. - The
armv7-unknown-linux-gnueabihfplatform is known to have issues with certain crates such as libc.
Version 1.37.0 (2019-08-15)
Language
#[must_use]will now warn if the type is contained in a tuple,Box, or an array and unused.- You can now use the
cfgandcfg_attrattributes on generic parameters. - You can now use enum variants through type alias. e.g. You can
write the following:
type MyOption = Option<u8>; fn increment_or_zero(x: MyOption) -> u8 { match x { MyOption::Some(y) => y + 1, MyOption::None => 0, } } - You can now use
_as an identifier for consts. e.g. You can writeconst _: u32 = 5;. - You can now use
#[repr(align(X)]on enums. - The
?Kleene macro operator is now available in the 2015 edition.
Compiler
- You can now enable Profile-Guided Optimization with the
-C profile-generateand-C profile-useflags. For more information on how to use profile guided optimization, please refer to the rustc book. - The
rust-lldbwrapper script should now work again.
Libraries
Stabilized APIs
BufReader::bufferBufWriter::bufferCell::from_mutCell<[T]>::as_slice_of_cellsDoubleEndedIterator::nth_backOption::xorWrapping::reverse_bitsi128::reverse_bitsi16::reverse_bitsi32::reverse_bitsi64::reverse_bitsi8::reverse_bitsisize::reverse_bitsslice::copy_withinu128::reverse_bitsu16::reverse_bitsu32::reverse_bitsu64::reverse_bitsu8::reverse_bitsusize::reverse_bits
Cargo
Cargo.lockfiles are now included by default when publishing executable crates with executables.- You can now specify
default-run="foo"in[package]to specify the default executable to use forcargo run.
Misc
Compatibility Notes
- Using
...for inclusive range patterns will now warn by default. Please transition your code to using the..=syntax for inclusive ranges instead. - Using a trait object without the
dynwill now warn by default. Please transition your code to usedyn Traitfor trait objects instead.
Version 1.36.0 (2019-07-04)
Language
- Non-Lexical Lifetimes are now enabled on the 2015 edition.
- The order of traits in trait objects no longer affects the semantics of that
object. e.g.
dyn Send + fmt::Debugis now equivalent todyn fmt::Debug + Send, where this was previously not the case.
Libraries
HashMap's implementation has been replaced withhashbrown::HashMapimplementation.TryFromSliceErrornow implementsFrom<Infallible>.mem::needs_dropis now available as a const fn.alloc::Layout::from_size_align_uncheckedis now available as a const fn.Stringnow implementsBorrowMut<str>.io::Cursornow implementsDefault.- Both
NonNull::{dangling, cast}are now const fns. - The
alloccrate is now stable.allocallows you to use a subset ofstd(e.g.Vec,Box,Arc) in#![no_std]environments if the environment has access to heap memory allocation. Stringnow implementsFrom<&String>.- You can now pass multiple arguments to the
dbg!macro.dbg!will return a tuple of each argument when there is multiple arguments. Result::{is_err, is_ok}are now#[must_use]and will produce a warning if not used.
Stabilized APIs
VecDeque::rotate_leftVecDeque::rotate_rightIterator::copiedio::IoSliceio::IoSliceMutRead::read_vectoredWrite::write_vectoredstr::as_mut_ptrmem::MaybeUninitpointer::align_offsetfuture::Futuretask::Contexttask::RawWakertask::RawWakerVTabletask::Wakertask::Poll
Cargo
- Cargo will now produce an error if you attempt to use the name of a required dependency as a feature.
- You can now pass the
--offlineflag to run cargo without accessing the network.
You can find further change's in Cargo's 1.36.0 release notes.
Clippy
There have been numerous additions and fixes to clippy, see Clippy's 1.36.0 release notes for more details.
Misc
Compatibility Notes
- With the stabilisation of
mem::MaybeUninit,mem::uninitializeduse is no longer recommended, and will be deprecated in 1.39.0.
Version 1.35.0 (2019-05-23)
Language
FnOnce,FnMut, and theFntraits are now implemented forBox<FnOnce>,Box<FnMut>, andBox<Fn>respectively.- You can now coerce closures into unsafe function pointers. e.g.
unsafe fn call_unsafe(func: unsafe fn()) { func() } pub fn main() { unsafe { call_unsafe(|| {}); } }
Compiler
- Added the
armv6-unknown-freebsd-gnueabihfandarmv7-unknown-freebsd-gnueabihftargets. - Added the
wasm32-unknown-wasitarget.
Libraries
Threadwill now show its ID inDebugoutput.StdinLock,StdoutLock, andStderrLocknow implementAsRawFd.alloc::Systemnow implementsDefault.- Expanded
Debugoutput ({:#?}) for structs now has a trailing comma on the last field. char::{ToLowercase, ToUppercase}now implementExactSizeIterator.- All
NonZeronumeric types now implementFromStr. - Removed the
Readtrait bounds on theBufReader::{get_ref, get_mut, into_inner}methods. - You can now call the
dbg!macro without any parameters to print the file and line where it is called. - In place ASCII case conversions are now up to 4× faster.
e.g.
str::make_ascii_lowercase hash_map::{OccupiedEntry, VacantEntry}now implementSyncandSend.
Stabilized APIs
f32::copysignf64::copysignRefCell::replace_withRefCell::map_splitptr::hashRange::containsRangeFrom::containsRangeTo::containsRangeInclusive::containsRangeToInclusive::containsOption::copied
Cargo
- You can now set
cargo:rustc-cdylib-link-argat build time to pass custom linker arguments when building acdylib. Its usage is highly platform specific.
Misc
Version 1.34.2 (2019-05-14)
Version 1.34.1 (2019-04-25)
- Fix false positives for the
redundant_closureClippy lint - Fix false positives for the
missing_const_for_fnClippy lint - Fix Clippy panic when checking some macros
Version 1.34.0 (2019-04-11)
Language
- You can now use
#[deprecated = "reason"]as a shorthand for#[deprecated(note = "reason")]. This was previously allowed by mistake but had no effect. - You can now accept token streams in
#[attr()],#[attr[]], and#[attr{}]procedural macros. - You can now write
extern crate self as foo;to import your crate's root into the extern prelude.
Compiler
- You can now target
riscv64imac-unknown-none-elfandriscv64gc-unknown-none-elf. - You can now enable linker plugin LTO optimisations with
-C linker-plugin-lto. This allows rustc to compile your Rust code into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI boundaries. - You can now target
powerpc64-unknown-freebsd.
Libraries
- The trait bounds have been removed on some of
HashMap<K, V, S>'s andHashSet<T, S>'s basic methods. Most notably you no longer require theHashtrait to create an iterator. - The
Ordtrait bounds have been removed on some ofBinaryHeap<T>'s basic methods. Most notably you no longer require theOrdtrait to create an iterator. - The methods
overflowing_negandwrapping_negare nowconstfunctions for all numeric types. - Indexing a
stris now generic over all types that implementSliceIndex<str>. str::trim,str::trim_matches,str::trim_{start, end}, andstr::trim_{start, end}_matchesare now#[must_use]and will produce a warning if their returning type is unused.- The methods
checked_pow,saturating_pow,wrapping_pow, andoverflowing_poware now available for all numeric types. These are equivalent to methods such aswrapping_addfor thepowoperation.
Stabilized APIs
std & core
Any::type_idError::type_idatomic::AtomicI16atomic::AtomicI32atomic::AtomicI64atomic::AtomicI8atomic::AtomicU16atomic::AtomicU32atomic::AtomicU64atomic::AtomicU8convert::Infallibleconvert::TryFromconvert::TryIntoiter::from_fniter::successorsnum::NonZeroI128num::NonZeroI16num::NonZeroI32num::NonZeroI64num::NonZeroI8num::NonZeroIsizeslice::sort_by_cached_keystr::escape_debugstr::escape_defaultstr::escape_unicodestr::split_ascii_whitespace
std
Cargo
Misc
Compatibility Notes
Command::before_execis being replaced by the unsafe methodCommand::pre_execand will be deprecated with Rust 1.37.0.- Use of
ATOMIC_{BOOL, ISIZE, USIZE}_INITis now deprecated as you can now useconstfunctions instaticvariables.
Version 1.33.0 (2019-02-28)
Language
- You can now use the
cfg(target_vendor)attribute. E.g.#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); } - Integer patterns such as in a match expression can now be exhaustive.
E.g. You can have match statement on a
u8that covers0..=255and you would no longer be required to have a_ => unreachable!()case. - You can now have multiple patterns in
if letandwhile letexpressions. You can do this with the same syntax as amatchexpression. E.g.enum Creature { Crab(String), Lobster(String), Person(String), } fn main() { let state = Creature::Crab("Ferris"); if let Creature::Crab(name) | Creature::Person(name) = state { println!("This creature's name is: {}", name); } } - You can now have irrefutable
if letandwhile letpatterns. Using this feature will by default produce a warning as this behaviour can be unintuitive. E.g.if let _ = 5 {} - You can now use
letbindings, assignments, expression statements, and irrefutable pattern destructuring in const functions. - You can now call unsafe const functions. E.g.
const unsafe fn foo() -> i32 { 5 } const fn bar() -> i32 { unsafe { foo() } } - You can now specify multiple attributes in a
cfg_attrattribute. E.g.#[cfg_attr(all(), must_use, optimize)] - You can now specify a specific alignment with the
#[repr(packed)]attribute. E.g.#[repr(packed(2))] struct Foo(i16, i32);is a struct with an alignment of 2 bytes and a size of 6 bytes. - You can now import an item from a module as an
_. This allows you to import a trait's impls, and not have the name in the namespace. E.g.use std::io::Read as _; // Allowed as there is only one `Read` in the module. pub trait Read {} - You may now use
Rc,Arc, andPinas method receivers.
Compiler
- You can now set a linker flavor for
rustcwith the-Clinker-flavorcommand line argument. - The minimum required LLVM version has been bumped to 6.0.
- Added support for the PowerPC64 architecture on FreeBSD.
- The
x86_64-fortanix-unknown-sgxtarget support has been upgraded to tier 2 support. Visit the platform support page for information on Rust's platform support. - Added support for the
thumbv7neon-linux-androideabiandthumbv7neon-unknown-linux-gnueabihftargets. - Added support for the
x86_64-unknown-uefitarget.
Libraries
- The methods
overflowing_{add, sub, mul, shl, shr}are nowconstfunctions for all numeric types. - The methods
rotate_left,rotate_right, andwrapping_{add, sub, mul, shl, shr}are nowconstfunctions for all numeric types. - The methods
is_positiveandis_negativeare nowconstfunctions for all signed numeric types. - The
getmethod for allNonZerotypes is nowconst. - The methods
count_ones,count_zeros,leading_zeros,trailing_zeros,swap_bytes,from_be,from_le,to_be,to_leare nowconstfor all numeric types. Ipv4Addr::newis now aconstfunction
Stabilized APIs
unix::FileExt::read_exact_atunix::FileExt::write_all_atOption::transposeResult::transposeconvert::identitypin::Pinmarker::Unpinmarker::PhantomPinnedVec::resize_withVecDeque::resize_withDuration::as_millisDuration::as_microsDuration::as_nanos
Cargo
- You can now publish crates that require a feature flag to compile with
cargo publish --featuresorcargo publish --all-features. - Cargo should now rebuild a crate if a file was modified during the initial build.
Compatibility Notes
- The methods
str::{trim_left, trim_right, trim_left_matches, trim_right_matches}are now deprecated in the standard library, and their usage will now produce a warning. Please use thestr::{trim_start, trim_end, trim_start_matches, trim_end_matches}methods instead. - The
Error::causemethod has been deprecated in favor ofError::sourcewhich supports downcasting. - Libtest no longer creates a new thread for each test when
--test-threads=1. It also runs the tests in deterministic order
Version 1.32.0 (2019-01-17)
Language
2018 edition
- You can now use the
?operator in macro definitions. The?operator allows you to specify zero or one repetitions similar to the*and+operators. - Module paths with no leading keyword like
super,self, orcrate, will now always resolve to the item (enum,struct, etc.) available in the module if present, before resolving to a external crate or an item the prelude. E.g.enum Color { Red, Green, Blue } use Color::*;
All editions
- You can now match against
PhantomData<T>types. - You can now match against literals in macros with the
literalspecifier. This will match against a literal of any type. E.g.1,'A',"Hello World" - Self can now be used as a constructor and pattern for unit and tuple structs. E.g.
struct Point(i32, i32); impl Point { pub fn new(x: i32, y: i32) -> Self { Self(x, y) } pub fn is_origin(&self) -> bool { match self { Self(0, 0) => true, _ => false, } } } - Self can also now be used in type definitions. E.g.
enum List<T> where Self: PartialOrd<Self> // can write `Self` instead of `List<T>` { Nil, Cons(T, Box<Self>) // likewise here } - You can now mark traits with
#[must_use]. This provides a warning if aimpl Traitordyn Traitis returned and unused in the program.
Compiler
- The default allocator has changed from jemalloc to the default allocator on your system. The compiler itself on Linux & macOS will still use jemalloc, but programs compiled with it will use the system allocator.
- Added the
aarch64-pc-windows-msvctarget.
Libraries
PathBufnow implementsFromStr.Box<[T]>now implementsFromIterator<T>.- The
dbg!macro has been stabilized. This macro enables you to easily debug expressions in your rust program. E.g.let a = 2; let b = dbg!(a * 2) + 1; // ^-- prints: [src/main.rs:4] a * 2 = 4 assert_eq!(b, 5);
The following APIs are now const functions and can be used in a
const context.
Cell::as_ptrUnsafeCell::getchar::is_asciiiter::emptyManuallyDrop::newManuallyDrop::into_innerRangeInclusive::startRangeInclusive::endNonNull::as_ptrslice::as_ptrstr::as_ptrDuration::as_secsDuration::subsec_millisDuration::subsec_microsDuration::subsec_nanosCStr::as_ptrIpv4Addr::is_unspecifiedIpv6Addr::newIpv6Addr::octets
Stabilized APIs
i8::to_be_bytesi8::to_le_bytesi8::to_ne_bytesi8::from_be_bytesi8::from_le_bytesi8::from_ne_bytesi16::to_be_bytesi16::to_le_bytesi16::to_ne_bytesi16::from_be_bytesi16::from_le_bytesi16::from_ne_bytesi32::to_be_bytesi32::to_le_bytesi32::to_ne_bytesi32::from_be_bytesi32::from_le_bytesi32::from_ne_bytesi64::to_be_bytesi64::to_le_bytesi64::to_ne_bytesi64::from_be_bytesi64::from_le_bytesi64::from_ne_bytesi128::to_be_bytesi128::to_le_bytesi128::to_ne_bytesi128::from_be_bytesi128::from_le_bytesi128::from_ne_bytesisize::to_be_bytesisize::to_le_bytesisize::to_ne_bytesisize::from_be_bytesisize::from_le_bytesisize::from_ne_bytesu8::to_be_bytesu8::to_le_bytesu8::to_ne_bytesu8::from_be_bytesu8::from_le_bytesu8::from_ne_bytesu16::to_be_bytesu16::to_le_bytesu16::to_ne_bytesu16::from_be_bytesu16::from_le_bytesu16::from_ne_bytesu32::to_be_bytesu32::to_le_bytesu32::to_ne_bytesu32::from_be_bytesu32::from_le_bytesu32::from_ne_bytesu64::to_be_bytesu64::to_le_bytesu64::to_ne_bytesu64::from_be_bytesu64::from_le_bytesu64::from_ne_bytesu128::to_be_bytesu128::to_le_bytesu128::to_ne_bytesu128::from_be_bytesu128::from_le_bytesu128::from_ne_bytesusize::to_be_bytesusize::to_le_bytesusize::to_ne_bytesusize::from_be_bytesusize::from_le_bytesusize::from_ne_bytes
Cargo
- You can now run
cargo cas an alias forcargo check. - Usernames are now allowed in alt registry URLs.
Misc
Compatibility Notes
- The argument types for AVX's
_mm256_stream_si256,_mm256_stream_pd,_mm256_stream_pshave been changed from*constto*mutas the previous implementation was unsound.
Version 1.31.1 (2018-12-20)
- Fix Rust failing to build on
powerpc-unknown-netbsd - Fix broken go-to-definition in RLS
- Fix infinite loop on hover in RLS
Version 1.31.0 (2018-12-06)
Language
- 🎉 This version marks the release of the 2018 edition of Rust. 🎉
- New lifetime elision rules now allow for eliding lifetimes in functions and
impl headers. E.g.
impl<'a> Reader for BufReader<'a> {}can now beimpl Reader for BufReader<'_> {}. Lifetimes are still required to be defined in structs. - You can now define and use
constfunctions. These are currently a strict minimal subset of the const fn RFC. Refer to the language reference for what exactly is available. - You can now use tool lints, which allow you to scope lints from external
tools using attributes. E.g.
#[allow(clippy::filter_map)]. #[no_mangle]and#[export_name]attributes can now be located anywhere in a crate, not just in exported functions.- You can now use parentheses in pattern matches.
Compiler
Libraries
- You can now convert
num::NonZero*types to their raw equivalents using theFromtrait. E.g.u8now implementsFrom<NonZeroU8>. - You can now convert a
&Option<T>intoOption<&T>and&mut Option<T>intoOption<&mut T>using theFromtrait. - You can now multiply (
*) atime::Durationby au32.
Stabilized APIs
slice::align_toslice::align_to_mutslice::chunks_exactslice::chunks_exact_mutslice::rchunksslice::rchunks_mutslice::rchunks_exactslice::rchunks_exact_mutOption::replace
Cargo
- Cargo will now download crates in parallel using HTTP/2.
- You can now rename packages in your Cargo.toml We have a guide
on how to use the
packagekey in your dependencies.
Version 1.30.1 (2018-11-08)
Version 1.30.0 (2018-10-25)
Language
- Procedural macros are now available. These kinds of macros allow for more powerful code generation. There is a new chapter available in the Rust Programming Language book that goes further in depth.
- You can now use keywords as identifiers using the raw identifiers
syntax (
r#), e.g.let r#for = true; - Using anonymous parameters in traits is now deprecated with a warning and will be a hard error in the 2018 edition.
- You can now use
cratein paths. This allows you to refer to the crate root in the path, e.g.use crate::foo;refers tofooinsrc/lib.rs. - Using a external crate no longer requires being prefixed with
::. Previously, using a external crate in a module without a use statement requiredlet json = ::serde_json::from_str(foo);but can now be written aslet json = serde_json::from_str(foo);. - You can now apply the
#[used]attribute to static items to prevent the compiler from optimising them away, even if they appear to be unused, e.g.#[used] static FOO: u32 = 1; - You can now import and reexport macros from other crates with the
usesyntax. Macros exported with#[macro_export]are now placed into the root module of the crate. If your macro relies on calling other local macros, it is recommended to export with the#[macro_export(local_inner_macros)]attribute so users won't have to import those macros. - You can now catch visibility keywords (e.g.
pub,pub(crate)) in macros using thevisspecifier. - Non-macro attributes now allow all forms of literals, not just
strings. Previously, you would write
#[attr("true")], and you can now write#[attr(true)]. - You can now specify a function to handle a panic in the Rust runtime with the
#[panic_handler]attribute.
Compiler
- Added the
riscv32imc-unknown-none-elftarget. - Added the
aarch64-unknown-netbsdtarget - Upgraded to LLVM 8.
Libraries
Stabilized APIs
-
The following methods are replacement methods for
trim_left,trim_right,trim_left_matches, andtrim_right_matches, which will be deprecated in 1.33.0:
Cargo
cargo rundoesn't require specifying a package in workspaces.cargo docnow supports--message-format=json. This is equivalent to callingrustdoc --error-format=json.- Cargo will now provide a progress bar for builds.
Misc
rustdocallows you to specify what edition to treat your code as with the--editionoption.rustdocnow has the--color(specify whether to output color) and--error-format(specify error format, e.g.json) options.- We now distribute a
rust-gdbguiscript that invokesgdbguiwith Rust debug symbols. - Attributes from Rust tools such as
rustfmtorclippyare now available, e.g.#[rustfmt::skip]will skip formatting the next item.
Version 1.29.2 (2018-10-11)
- Workaround for an aliasing-related LLVM bug, which caused miscompilation.
- The
rls-previewcomponent on the windows-gnu targets has been restored.
Version 1.29.1 (2018-09-25)
Security Notes
-
The standard library's
str::repeatfunction contained an out of bounds write caused by an integer overflow. This has been fixed by deterministically panicking when an overflow happens.Thank you to Scott McMurray for responsibly disclosing this vulnerability to us.
Version 1.29.0 (2018-09-13)
Compiler
- Bumped minimum LLVM version to 5.0.
- Added
powerpc64le-unknown-linux-musltarget. - Added
aarch64-unknown-hermitandx86_64-unknown-hermittargets. - Upgraded to LLVM 7.
Libraries
Once::call_onceno longer requiresOnceto be'static.BuildHasherDefaultnow implementsPartialEqandEq.Box<CStr>,Box<OsStr>, andBox<Path>now implementClone.- Implemented
PartialEq<&str>forOsStringandPartialEq<OsString>for&str. Cell<T>now allowsTto be unsized.SocketAddris now stable on Redox.
Stabilized APIs
Cargo
- Cargo can silently fix some bad lockfiles. You can use
--lockedto disable this behavior. cargo-installwill now allow you to cross compile an install using--target.- Added the
cargo-fixsubcommand to automatically move project code from 2015 edition to 2018. cargo doccan now optionally document private types using the--document-private-itemsflag.
Misc
rustdocnow has the--cap-lintsoption which demotes all lints above the specified level to that level. For example--cap-lints warnwill demotedenyandforbidlints towarn.rustcandrustdocwill now have the exit code of1if compilation fails and101if there is a panic.- A preview of clippy has been made available through rustup.
You can install the preview with
rustup component add clippy-preview.
Compatibility Notes
str::{slice_unchecked, slice_unchecked_mut}are now deprecated. Usestr::get_unchecked(begin..end)instead.std::env::home_diris now deprecated for its unintuitive behavior. Consider using thehome_dirfunction from https://crates.io/crates/dirs instead.rustcwill no longer silently ignore invalid data in target spec.cfgattributes and--cfgcommand line flags are now more strictly validated.
Version 1.28.0 (2018-08-02)
Language
- The
#[repr(transparent)]attribute is now stable. This attribute allows a Rust newtype wrapper (struct NewType<T>(T);) to be represented as the inner type across Foreign Function Interface (FFI) boundaries. - The keywords
pure,sizeof,alignof, andoffsetofhave been unreserved and can now be used as identifiers. - The
GlobalAlloctrait and#[global_allocator]attribute are now stable. This will allow users to specify a global allocator for their program. - Unit test functions marked with the
#[test]attribute can now returnResult<(), E: Debug>in addition to(). - The
lifetimespecifier formacro_rules!is now stable. This allows macros to easily target lifetimes.
Compiler
- The
sandzoptimisation levels are now stable. These optimisations prioritise making smaller binary sizes.zis the same asswith the exception that it does not vectorise loops, which typically results in an even smaller binary. - The short error format is now stable. Specified with
--error-format=shortthis option will provide a more compressed output of rust error messages. - Added a lint warning when you have duplicated
macro_exports. - Reduced the number of allocations in the macro parser. This can improve compile times of macro heavy crates on average by 5%.
Libraries
- Implemented
Defaultfor&mut str. - Implemented
From<bool>for all integer and unsigned number types. - Implemented
Extendfor(). - The
Debugimplementation oftime::Durationshould now be more easily human readable. Previously aDurationof one second would printed asDuration { secs: 1, nanos: 0 }and will now be printed as1s. - Implemented
From<&String>forCow<str>,From<&Vec<T>>forCow<[T]>,From<Cow<CStr>>forCString,From<CString>, From<CStr>, From<&CString>forCow<CStr>,From<OsString>, From<OsStr>, From<&OsString>forCow<OsStr>,From<&PathBuf>forCow<Path>, andFrom<Cow<Path>>forPathBuf. - Implemented
ShlandShrforWrapping<u128>andWrapping<i128>. DirEntry::metadatanow usesfstatatinstead oflstatwhen possible. This can provide up to a 40% speed increase.- Improved error messages when using
format!.
Stabilized APIs
Iterator::step_byPath::ancestorsSystemTime::UNIX_EPOCHalloc::GlobalAllocalloc::Layoutalloc::LayoutErralloc::Systemalloc::allocalloc::alloc_zeroedalloc::deallocalloc::reallocalloc::handle_alloc_errorbtree_map::Entry::or_defaultfmt::Alignmenthash_map::Entry::or_defaultiter::repeat_withnum::NonZeroUsizenum::NonZeroU128num::NonZeroU16num::NonZeroU32num::NonZeroU64num::NonZeroU8ops::RangeBoundsslice::SliceIndexslice::from_mutslice::from_ref{Any + Send + Sync}::downcast_mut{Any + Send + Sync}::downcast_ref{Any + Send + Sync}::is
Cargo
- Cargo will now no longer allow you to publish crates with build scripts that
modify the
srcdirectory. Thesrcdirectory in a crate should be considered to be immutable.
Misc
- The
suggestion_applicabilityfield inrustc's json output is now stable. This will allow dev tools to check whether a code suggestion would apply to them.
Compatibility Notes
- Rust will consider trait objects with duplicated constraints to be the same
type as without the duplicated constraint. For example the below code will
now fail to compile.
trait Trait {} impl Trait + Send { fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` } impl Trait + Send + Send { fn test(&self) { println!("two"); } }
Version 1.27.2 (2018-07-20)
Compatibility Notes
- The borrow checker was fixed to avoid potential unsoundness when using match ergonomics: #52213.
Version 1.27.1 (2018-07-10)
Security Notes
-
rustdoc would execute plugins in the /tmp/rustdoc/plugins directory when running, which enabled executing code as some other user on a given machine. This release fixes that vulnerability; you can read more about this on the blog. The associated CVE is CVE-2018-1000622.
Thank you to Red Hat for responsibly disclosing this vulnerability to us.
Compatibility Notes
- The borrow checker was fixed to avoid an additional potential unsoundness when using match ergonomics: #51415, #49534.
Version 1.27.0 (2018-06-21)
Language
- Removed 'proc' from the reserved keywords list. This allows
procto be used as an identifier. - The dyn syntax is now available. This syntax is equivalent to the
bare
Traitsyntax, and should make it clearer when being used in tandem withimpl Traitbecause it is equivalent to the following syntax:&Trait == &dyn Trait,&mut Trait == &mut dyn Trait, andBox<Trait> == Box<dyn Trait>. - Attributes on generic parameters such as types and lifetimes are
now stable. e.g.
fn foo<#[lifetime_attr] 'a, #[type_attr] T: 'a>() {} - The
#[must_use]attribute can now also be used on functions as well as types. It provides a lint that by default warns users when the value returned by a function has not been used.
Compiler
Libraries
- SIMD (Single Instruction Multiple Data) on x86/x86_64 is now stable.
This includes
arch::x86&arch::x86_64modules which contain SIMD intrinsics, a new macro calledis_x86_feature_detected!, the#[target_feature(enable="")]attribute, and addingtarget_feature = ""to thecfgattribute. - A lot of methods for
[u8],f32, andf64previously only available in std are now available in core. - The generic
Rhstype parameter onops::{Shl, ShlAssign, Shr}now defaults toSelf. std::str::replacenow has the#[must_use]attribute to clarify that the operation isn't done in place.Clone::clone,Iterator::collect, andToOwned::to_ownednow have the#[must_use]attribute to warn about unused potentially expensive allocations.
Stabilized APIs
DoubleEndedIterator::rfindDoubleEndedIterator::rfoldDoubleEndedIterator::try_rfoldDuration::from_microsDuration::from_nanosDuration::subsec_microsDuration::subsec_millisHashMap::remove_entryIterator::try_foldIterator::try_for_eachNonNull::castOption::filterString::replace_rangeTake::set_limithint::unreachable_uncheckedos::unix::process::parent_idptr::swap_nonoverlappingslice::rsplit_mutslice::rsplitslice::swap_with_slice
Cargo
cargo-metadatanow includesauthors,categories,keywords,readme, andrepositoryfields.cargo-metadatanow includes a package'smetadatatable.- Added the
--target-diroptional argument. This allows you to specify a different directory thantargetfor placing compilation artifacts. - Cargo will be adding automatic target inference for binaries, benchmarks,
examples, and tests in the Rust 2018 edition. If your project specifies
specific targets, e.g. using
[[bin]], and have other binaries in locations where cargo would infer a binary, Cargo will produce a warning. You can disable this feature ahead of time by setting any of the following to false:autobins,autobenches,autoexamples,autotests. - Cargo will now cache compiler information. This can be disabled by
setting
CARGO_CACHE_RUSTC_INFO=0in your environment.
Misc
- Added “The Rustc book” into the official documentation. “The Rustc book” documents and teaches how to use the rustc compiler.
- All books available on
doc.rust-lang.orgare now searchable.
Compatibility Notes
- Calling a
CharExtorStrExtmethod directly on core will no longer work. e.g.::core::prelude::v1::StrExt::is_empty("")will not compile,"".is_empty()will still compile. Debugoutput onatomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize}will only print the inner type. E.g.print!("{:?}", AtomicBool::new(true))will printtrue, notAtomicBool(true).- The maximum number for
repr(align(N))is now 2²⁹. Previously you could enter higher numbers but they were not supported by LLVM. Up to 512MB alignment should cover all use cases. - The
.description()method on thestd::error::Errortrait has been soft-deprecated. It is no longer required to implement it.
Version 1.26.2 (2018-06-05)
Compatibility Notes
Version 1.26.1 (2018-05-29)
Tools
Compatibility Notes
fn main() -> impl Traitno longer works for non-Termination trait. This reverts an accidental stabilization.NaN > NaNno longer returns true in const-fn contexts.- Prohibit using turbofish for
impl Traitin method arguments.
Version 1.26.0 (2018-05-10)
Language
- Closures now implement
Copyand/orCloneif all captured variables implement either or both traits. - The inclusive range syntax e.g.
for x in 0..=10is now stable. - The
'_lifetime is now stable. The underscore lifetime can be used anywhere a lifetime can be elided. impl Traitis now stable allowing you to have abstract types in returns or in function parameters. E.g.fn foo() -> impl Iterator<Item=u8>orfn open(path: impl AsRef<Path>).- Pattern matching will now automatically apply dereferences.
- 128-bit integers in the form of
u128andi128are now stable. maincan now returnResult<(), E: Debug>in addition to().- A lot of operations are now available in a const context. E.g. You can now index into constant arrays, reference and dereference into constants, and use tuple struct constructors.
- Fixed entry slice patterns are now stable. E.g.
let points = [1, 2, 3, 4]; match points { [1, 2, 3, 4] => println!("All points were sequential."), _ => println!("Not all points were sequential."), }
Compiler
- LLD is now used as the default linker for
wasm32-unknown-unknown. - Fixed exponential projection complexity on nested types. This can provide up to a ~12% reduction in compile times for certain crates.
- Added the
--remap-path-prefixoption to rustc. Allowing you to remap path prefixes outputted by the compiler. - Added
powerpc-unknown-netbsdtarget.
Libraries
- Implemented
From<u16> for usize&From<{u8, i16}> for isize. - Added hexadecimal formatting for integers with fmt::Debug
e.g.
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]") - Implemented
Default, Hashforcmp::Reverse. - Optimized
str::repeatbeing 8x faster in large cases. ascii::escape_defaultis now available in libcore.- Trailing commas are now supported in std and core macros.
- Implemented
Copy, Cloneforcmp::Reverse - Implemented
Cloneforchar::{ToLowercase, ToUppercase}.
Stabilized APIs
*const T::add*const T::copy_to_nonoverlapping*const T::copy_to*const T::read_unaligned*const T::read_volatile*const T::read*const T::sub*const T::wrapping_add*const T::wrapping_sub*mut T::add*mut T::copy_to_nonoverlapping*mut T::copy_to*mut T::read_unaligned*mut T::read_volatile*mut T::read*mut T::replace*mut T::sub*mut T::swap*mut T::wrapping_add*mut T::wrapping_sub*mut T::write_bytes*mut T::write_unaligned*mut T::write_volatile*mut T::writeBox::leakFromUtf8Error::as_bytesLocalKey::try_withOption::clonedbtree_map::Entry::and_modifyfs::read_to_stringfs::readfs::writehash_map::Entry::and_modifyiter::FusedIteratorops::RangeInclusiveops::RangeToInclusiveprocess::idslice::rotate_leftslice::rotate_rightString::retain
Cargo
- Cargo will now output path to custom commands when
-vis passed with--list - The Cargo binary version is now the same as the Rust version
Misc
Compatibility Notes
- aliasing a
Fntrait asdynno longer works. E.g. the following syntax is now invalid.use std::ops::Fn as dyn; fn g(_: Box<dyn(std::fmt::Debug)>) {} - The result of dereferences are no longer promoted to
'static. e.g.fn main() { const PAIR: &(i32, i32) = &(0, 1); let _reversed_pair: &'static _ = &(PAIR.1, PAIR.0); // Doesn't work } - Deprecate
AsciiExttrait in favor of inherent methods. ".e0"will now no longer parse as0.0and will instead cause an error.- Removed hoedown from rustdoc.
- Bounds on higher-kinded lifetimes a hard error.
Version 1.25.0 (2018-03-29)
Language
- The
#[repr(align(x))]attribute is now stable. RFC 1358 - You can now use nested groups of imports.
e.g.
use std::{fs::File, io::Read, path::{Path, PathBuf}}; - You can now have
|at the start of a match arm. e.g.
enum Foo { A, B, C }
fn main() {
let x = Foo::A;
match x {
| Foo::A
| Foo::B => println!("AB"),
| Foo::C => println!("C"),
}
}
Compiler
Libraries
- Impl Send for
process::Commandon Unix. - Impl PartialEq and Eq for
ParseCharError. UnsafeCell::into_inneris now safe.- Implement libstd for CloudABI.
Float::{from_bits, to_bits}is now available in libcore.- Implement
AsRef<Path>for Component - Implemented
WriteforCursor<&mut Vec<u8>> - Moved
Durationto libcore.
Stabilized APIs
The following functions can now be used in a constant expression.
eg. static MINUTE: Duration = Duration::from_secs(60);
Cargo
cargo newno longer removesrustorrsprefixes/suffixes.cargo newnow defaults to creating a binary crate, instead of a library crate.
Misc
Compatibility Notes
- Deprecated
net::lookup_host. rustdochas switched to pulldown as the default markdown renderer.- The borrow checker was sometimes incorrectly permitting overlapping borrows around indexing operations (see #47349). This has been fixed (which also enabled some correct code that used to cause errors (e.g. #33903 and #46095).
- Removed deprecated unstable attribute
#[simd].
Version 1.24.1 (2018-03-01)
- Do not abort when unwinding through FFI
- Emit UTF-16 files for linker arguments on Windows
- Make the error index generator work again
- Cargo will warn on Windows 7 if an update is needed.
Version 1.24.0 (2018-02-15)
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
Version 1.23.0 (2018-01-04)
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
Version 1.22.1 (2017-11-22)
Version 1.22.0 (2017-11-22)
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
- The minimum Android version that rustc can build for has been bumped
to
4.0from2.3 - Allowing
T op= &Tfor numeric types has broken some type inference cases
Version 1.21.0 (2017-10-12)
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
Version 1.20.0 (2017-08-31)
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
- Functions with
'staticin their return types will now not be as usable as if they were using lifetime parameters instead. - The reimplementation of
{f32, f64}::is_sign_{negative, positive}now takes the sign of NaN into account where previously didn't.
Version 1.19.0 (2017-07-20)
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
Version 1.18.0 (2017-06-08)
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)
Version 1.17.0 (2017-04-27)
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 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_typefuture-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
Version 1.16.0 (2017-03-16)
Language
- The compiler's
dead_codelint now accounts for type aliases. - Uninhabitable enums (those without any variants) no longer permit wildcard match patterns
- Clean up semantics of
selfin an import list Selfmay appear inimplheadersSelfmay appear in struct expressions
Compiler
rustcnow supports--emit=metadata, which causes rustc to emit a.rmetafile containing only crate metadata. This can be used by tools like the Rust Language Service to perform metadata-only builds.- Levenshtein based typo suggestions now work in most places, while previously they worked only for fields and sometimes for local variables. Together with the overhaul of "no resolution"/"unexpected resolution" errors (#38154) they result in large and systematic improvement in resolution diagnostics.
- Fix
transmute::<T, U>whereTrequires a bigger alignment thanU - rustc: use -Xlinker when specifying an rpath with ',' in it
rustcno longer attempts to provide "consider using an explicit lifetime" suggestions. They were inaccurate.
Stabilized APIs
VecDeque::truncateVecDeque::resizeString::insert_strDuration::checked_addDuration::checked_subDuration::checked_divDuration::checked_mulstr::replacenstr::repeatSocketAddr::is_ipv4SocketAddr::is_ipv6IpAddr::is_ipv4IpAddr::is_ipv6Vec::dedup_byVec::dedup_by_keyResult::unwrap_or_default<*const T>::wrapping_offset<*mut T>::wrapping_offsetCommandExt::creation_flagsFile::set_permissionsString::split_off
Libraries
[T]::binary_searchand[T]::binary_search_by_keynow take their argument byBorrowparameter- All public types in std implement
Debug IpAddrimplementsFrom<Ipv4Addr>andFrom<Ipv6Addr>Ipv6AddrimplementsFrom<[u16; 8]>- Ctrl-Z returns from
Stdin.read()when reading from the console on Windows - std: Fix partial writes in
LineWriter - std: Clamp max read/write sizes on Unix
- Use more specific panic message for
&strslicing errors TcpListener::set_only_v6is deprecated. This functionality cannot be achieved in std currently.writeln!, likeprintln!, now accepts a form with no string or formatting arguments, to just print a newline- Implement
iter::Sumanditer::ProductforResult - Reduce the size of static data in
std_unicode::tables char::EscapeDebug,EscapeDefault,EscapeUnicode,CaseMappingIter,ToLowercase,ToUppercase, implementDisplayDurationimplementsSumStringimplementsToSocketAddrs
Cargo
- The
cargo checkcommand does a type check of a project without building it - crates.io will display CI badges from Travis and AppVeyor, if specified in Cargo.toml
- crates.io will display categories listed in Cargo.toml
- Compilation profiles accept integer values for
debug, in addition totrueandfalse. These are passed torustcas the value to-C debuginfo - Implement
cargo --version --verbose - All builds now output 'dep-info' build dependencies compatible with make and ninja
- Build all workspace members with
build --all - Document all workspace members with
doc --all - Path deps outside workspace are not members
Misc
rustdochas a--sysrootargument that, likerustc, specifies the path to the Rust implementation- The
armv7-linux-androideabitarget no longer enables NEON extensions, per Google's ABI guide - The stock standard library can be compiled for Redox OS
- Rust has initial SPARC support. Tier 3. No builds available.
- Rust has experimental support for Nvidia PTX. Tier 3. No builds available.
- Fix backtraces on i686-pc-windows-gnu by disabling FPO
Compatibility Notes
- Uninhabitable enums (those without any variants) no longer permit wildcard match patterns
- In this release, references to uninhabited types can not be pattern-matched. This was accidentally allowed in 1.15.
- The compiler's
dead_codelint now accounts for type aliases. - Ctrl-Z returns from
Stdin.read()when reading from the console on Windows - Clean up semantics of
selfin an import list - Reimplemented lifetime elision. This change was almost entirely compatible with existing code, but it did close a number of small bugs and loopholes, as well as being more accepting in some other cases.
Version 1.15.1 (2017-02-09)
Version 1.15.0 (2017-02-02)
Language
- Basic procedural macros allowing custom
#[derive], aka "macros 1.1", are stable. This allows popular code-generating crates like Serde and Diesel to work ergonomically. RFC 1681. - Tuple structs may be empty. Unary and empty tuple structs may be instantiated with curly braces. Part of RFC 1506.
- A number of minor changes to name resolution have been activated.
They add up to more consistent semantics, allowing for future evolution of
Rust macros. Specified in RFC 1560, see its section on "changes" for
details of what is different. The breaking changes here have been transitioned
through the
legacy_importslint since 1.14, with no known regressions. - In
macro_rules,pathfragments can now be parsed as type parameter bounds ?Sizedcan be used inwhereclauses- There is now a limit on the size of monomorphized types and it can be
modified with the
#![type_size_limit]crate attribute, similarly to the#![recursion_limit]attribute
Compiler
- On Windows, the compiler will apply dllimport attributes when linking to extern functions. Additional attributes and flags can control which library kind is linked and its name. RFC 1717.
- Rust-ABI symbols are no longer exported from cdylibs
- The
--testflag works with procedural macro crates - Fix
extern "aapcs" fnABI - The
-C no-stack-checkflag is deprecated. It does nothing. - The
format!expander recognizes incorrectprintfand shell-style formatting directives and suggests the correct format. - Only report one error for all unused imports in an import list
Compiler Performance
- Avoid unnecessary
mk_tycalls inTy::super_fold_with - Avoid more unnecessary
mk_tycalls inTy::super_fold_with - Don't clone in
UnificationTable::probe - Remove
scope_auxiliaryto cut RSS by 10% - Use small vectors in type walker
- Macro expansion performance was improved
- Change
HirVec<P<T>>toHirVec<T>inhir::Expr - Replace FNV with a faster hash function
Stabilized APIs
std::iter::Iterator::min_bystd::iter::Iterator::max_bystd::os::*::fs::FileExtstd::sync::atomic::Atomic*::get_mutstd::sync::atomic::Atomic*::into_innerstd::vec::IntoIter::as_slicestd::vec::IntoIter::as_mut_slicestd::sync::mpsc::Receiver::try_iterstd::os::unix::process::CommandExt::before_execstd::rc::Rc::strong_countstd::rc::Rc::weak_countstd::sync::Arc::strong_countstd::sync::Arc::weak_countstd::char::encode_utf8std::char::encode_utf16std::cell::Ref::clonestd::io::Take::into_inner
Libraries
- The standard sorting algorithm has been rewritten for dramatic performance improvements. It is a hybrid merge sort, drawing influences from Timsort. Previously it was a naive merge sort.
Iterator::nthno longer has aSizedboundExtend<&T>is specialized forVecwhereT: Copyto improve performance.chars().count()is much faster and so arechars().last()andchar_indices().last()- Fix ARM Objective-C ABI in
std::env::args - Chinese characters display correctly in
fmt::Debug - Derive
DefaultforDuration - Support creation of anonymous pipes on WinXP/2k
mpsc::RecvTimeoutErrorimplementsError- Don't pass overlapped handles to processes
Cargo
- In this release, Cargo build scripts no longer have access to the
OUT_DIRenvironment variable at build time viaenv!("OUT_DIR"). They should instead check the variable at runtime withstd::env. That the value was set at build time was a bug, and incorrect when cross-compiling. This change is known to cause breakage. - Add
--allflag tocargo test - Compile statically against the MSVC CRT
- Mix feature flags into fingerprint/metadata shorthash
- Link OpenSSL statically on OSX
- Apply new fingerprinting to build dir outputs
- Test for bad path overrides with summaries
- Require
cargo install --versto take a semver version - Fix retrying crate downloads for network errors
- Implement string lookup for
build.rustflagsconfig key - Emit more info on --message-format=json
- Assume
build.rsin the same directory asCargo.tomlis a build script - Don't ignore errors in workspace manifest
- Fix
--message-format JSONwhen rustc emits non-JSON warnings
Tooling
- Test runners (binaries built with
--test) now support a--listargument that lists the tests it contains - Test runners now support a
--exactargument that makes the test filter match exactly, instead of matching only a substring of the test name - rustdoc supports a
--playground-urlflag - rustdoc provides more details about
#[should_panic]errors
Misc
- The Rust build system is now written in Rust. The Makefiles may
continue to be used in this release by passing
--disable-rustbuildto the configure script, but they will be deleted soon. Note that the new build system uses a different on-disk layout that will likely affect any scripts building Rust. - Rust supports i686-unknown-openbsd. Tier 3 support. No testing or releases.
- Rust supports the MSP430. Tier 3 support. No testing or releases.
- Rust supports the ARMv5TE architecture. Tier 3 support. No testing or releases.
Compatibility Notes
- A number of minor changes to name resolution have been activated.
They add up to more consistent semantics, allowing for future evolution of
Rust macros. Specified in RFC 1560, see its section on "changes" for
details of what is different. The breaking changes here have been transitioned
through the
legacy_importslint since 1.14, with no known regressions. - In this release, Cargo build scripts no longer have access to the
OUT_DIRenvironment variable at build time viaenv!("OUT_DIR"). They should instead check the variable at runtime withstd::env. That the value was set at build time was a bug, and incorrect when cross-compiling. This change is known to cause breakage. - Higher-ranked lifetimes are no longer allowed to appear only in associated
types. The
hr_lifetime_in_assoc_typelint has been a warning since 1.10 and is now an error by default. It will become a hard error in the near future. - The semantics relating modules to file system directories are changing in
minor ways. This is captured in the new
legacy_directory_ownershiplint, which is a warning in this release, and will become a hard error in the future. - Rust-ABI symbols are no longer exported from cdylibs
- Once
Peekablepeeks aNoneit will return thatNonewithout re-querying the underlying iterator
Version 1.14.0 (2016-12-22)
Language
..matches multiple tuple fields in enum variants, structs and tuples. RFC 1492.- Safe
fnitems can be coerced tounsafe fnpointers use *anduse ::*both glob-import from the crate root- It's now possible to call a
Vec<Box<Fn()>>without explicit dereferencing
Compiler
- Mark enums with non-zero discriminant as non-zero
- Lower-case
static mutnames are linted like other statics and consts - Fix ICE on some macros in const integer positions
(e.g.
[u8; m!()]) - Improve error message and snippet for "did you mean
x" - Add a panic-strategy field to the target specification
- Include LLVM version in
--version --verbose
Compile-time Optimizations
- Improve macro expansion performance
- Shrink
Expr_::ExprInlineAsm - Replace all uses of SHA-256 with BLAKE2b
- Reduce the number of bytes hashed by
IchHasher - Avoid more allocations when compiling html5ever
- Use
SmallVectorinCombineFields::instantiate - Avoid some allocations in the macro parser
- Use a faster deflate setting
- Add
ArrayVecandAccumulateVecto reduce heap allocations during interning of slices - Optimize
write_metadata - Don't process obligation forest cycles when stalled
- Avoid many
CrateConfigclones - Optimize
Substs::super_fold_with - Optimize
ObligationForest'sNodeStatehandling - Speed up
plug_leaks
Libraries
println!(), with no arguments, prints newline. Previously, an empty string was required to achieve the same.Wrappingimpls standard binary and unary operators, as well as theSumandProductiterators- Implement
From<Cow<str>> for StringandFrom<Cow<[T]>> for Vec<T> - Improve
foldperformance forchain,cloned,map, andVecDequeiterators - Improve
SipHasherperformance on small values - Add Iterator trait TrustedLen to enable better FromIterator / Extend
- Expand
.zip()specialization to.map()and.cloned() ReadDirimplementsDebug- Implement
RefUnwindSafefor atomic types - Specialize
Vec::extendtoVec::extend_from_slice - Avoid allocations in
Decoder::read_str io::ErrorimplementsFrom<io::ErrorKind>- Impl
Debugfor raw pointers to unsized data - Don't reuse
HashMaprandom seeds - The internal memory layout of
HashMapis more cache-friendly, for significant improvements in some operations HashMapuses less memory on 32-bit architectures- Impl
Add<{str, Cow<str>}>forCow<str>
Cargo
- Expose rustc cfg values to build scripts
- Allow cargo to work with read-only
CARGO_HOME - Fix passing --features when testing multiple packages
- Use a single profile set per workspace
- Load
replacesections from lock files - Ignore
panicconfiguration for test/bench profiles
Tooling
- rustup is the recommended Rust installation method
- This release includes host (rustc) builds for Linux on MIPS, PowerPC, and
S390x. These are tier 2 platforms and may have major defects. Follow the
instructions on the website to install, or add the targets to an existing
installation with
rustup target add. The new target triples are:mips-unknown-linux-gnumipsel-unknown-linux-gnumips64-unknown-linux-gnuabi64mips64el-unknown-linux-gnuabi64powerpc-unknown-linux-gnupowerpc64-unknown-linux-gnupowerpc64le-unknown-linux-gnus390x-unknown-linux-gnu
- This release includes target (std) builds for ARM Linux running MUSL
libc. These are tier 2 platforms and may have major defects. Add the
following triples to an existing rustup installation with
rustup target add:arm-unknown-linux-musleabiarm-unknown-linux-musleabihfarmv7-unknown-linux-musleabihf
- This release includes experimental support for WebAssembly, via
the
wasm32-unknown-emscriptentarget. This target is known to have major defects. Please test, report, and fix. - rustup no longer installs documentation by default. Run
rustup component add rust-docsto install. - Fix line stepping in debugger
- Enable line number debuginfo in releases
Misc
- Disable jemalloc on aarch64/powerpc/mips
- Add support for Fuchsia OS
- Detect local-rebuild by only MAJOR.MINOR version
Compatibility Notes
- A number of forward-compatibility lints used by the compiler
to gradually introduce language changes have been converted
to deny by default:
- "use of inaccessible extern crate erroneously allowed"
- "type parameter default erroneously allowed in invalid location"
- "detects super or self keywords at the beginning of global path"
- "two overlapping inherent impls define an item with the same name were erroneously allowed"
- "floating-point constants cannot be used in patterns"
- "constants of struct or enum type can only be used in a pattern if
the struct or enum has
#[derive(PartialEq, Eq)]" - "lifetimes or labels named
'_were erroneously allowed"
- Prohibit patterns in trait methods without bodies
- The atomic
Orderingenum may not be matched exhaustively - Future-proofing
#[no_link]breaks some obscure cases - The
$cratemacro variable is accepted in fewer locations - Impls specifying extra region requirements beyond the trait they implement are rejected
- Enums may not be unsized. Unsized enums are intended to work but never have. For now they are forbidden.
- Enforce the shadowing restrictions from RFC 1560 for today's macros
Version 1.13.0 (2016-11-10)
Language
- Stabilize the
?operator.?is a simple way to propagate errors, like thetry!macro, described in RFC 0243. - Stabilize macros in type position. Described in RFC 873.
- Stabilize attributes on statements. Described in RFC 0016.
- Fix
#[derive]for empty tuple structs/variants - Fix lifetime rules for 'if' conditions
- Avoid loading and parsing unconfigured non-inline modules
Compiler
- Add the
-C link-argargument - Remove the old AST-based backend from rustc_trans
- Don't enable NEON by default on armv7 Linux
- Fix debug line number info for macro expansions
- Do not emit "class method" debuginfo for types that are not DICompositeType
- Warn about multiple conflicting #[repr] hints
- When sizing DST, don't double-count nested struct prefixes
- Default RUST_MIN_STACK to 16MiB for now
- Improve rlib metadata format. Reduces rlib size significantly.
- Reject macros with empty repetitions to avoid infinite loop
- Expand macros without recursing to avoid stack overflows
Diagnostics
- Replace macro backtraces with labeled local uses
- Improve error message for misplaced doc comments
- Buffer unix and lock windows to prevent message interleaving
- Update lifetime errors to specifically note temporaries
- Special case a few colors for Windows
- Suggest
use selfwhen such an import resolves - Be more specific when type parameter shadows primitive type
- Many minor improvements
Compile-time Optimizations
- Compute and cache HIR hashes at beginning
- Don't hash types in loan paths
- Cache projections in trans
- Optimize the parser's last token handling
- Only instantiate #[inline] functions in codegen units referencing them. This leads to big improvements in cases where crates export define many inline functions without using them directly.
- Lazily allocate TypedArena's first chunk
- Don't allocate during default HashSet creation
Stabilized APIs
Libraries
- Add
assert_ne!anddebug_assert_ne! - Make
vec_deque::Drain,hash_map::Drain, andhash_set::Draincovariant - Implement
AsRef<[T]>forstd::slice::Iter - Implement
Debugforstd::vec::IntoIter CString: avoid excessive growth just to 0-terminate- Implement
CoerceUnsizedfor{Cell, RefCell, UnsafeCell} - Use arc4rand on FreeBSD
- memrchr: Correct aligned offset computation
- Improve Demangling of Rust Symbols
- Use monotonic time in condition variables
- Implement
Debugforstd::path::{Components,Iter} - Implement conversion traits for
char - Fix illegal instruction caused by overflow in channel cloning
- Zero first byte of CString on drop
- Inherit overflow checks for sum and product
- Add missing Eq implementations
- Implement
DebugforDirEntry - When
getaddrinforeturnsEAI_SYSTEMretrieve actual error fromerrno SipHasheris deprecated. UseDefaultHasher.- Implement more traits for
std::io::ErrorKind - Optimize BinaryHeap bounds checking
- Work around pointer aliasing issue in
Vec::extend_from_slice,extend_with_element - Fix overflow checking in unsigned pow()
Cargo
- This release includes security fixes to both curl and OpenSSL.
- Fix transitive doctests when panic=abort
- Add --all-features flag to cargo
- Reject path-based dependencies in
cargo package - Don't parse the home directory more than once
- Don't try to generate Cargo.lock on empty workspaces
- Update OpenSSL to 1.0.2j
- Add license and license_file to cargo metadata output
- Make crates-io registry URL optional in config; ignore all changes to source.crates-io
- Don't download dependencies from other platforms
- Build transitive dev-dependencies when needed
- Add support for per-target rustflags in .cargo/config
- Avoid updating registry when adding existing deps
- Warn about path overrides that won't work
- Use workspaces during
cargo install - Leak mspdbsrv.exe processes on Windows
- Add --message-format flag
- Pass target environment for rustdoc
- Use
CommandExt::execforcargo runon Unix - Update curl and curl-sys
- Call rustdoc test with the correct cfg flags of a package
Tooling
- rustdoc: Add the
--sysrootargument - rustdoc: Fix a couple of issues with the search results
- rustdoc: remove the
!from macro URLs and titles - gdb: Fix pretty-printing special-cased Rust types
- rustdoc: Filter more incorrect methods inherited through Deref
Misc
- Remove unmaintained style guide
- Add s390x support
- Initial work at Haiku OS support
- Add mips-uclibc targets
- Crate-ify compiler-rt into compiler-builtins
- Add rustc version info (git hash + date) to dist tarball
- Many documentation improvements
Compatibility Notes
SipHasheris deprecated. UseDefaultHasher.- Deny (by default) transmuting from fn item types to pointer-sized types. Continuing the long transition to zero-sized fn items, per RFC 401.
- Fix
#[derive]for empty tuple structs/variants. Part of RFC 1506. - Issue deprecation warnings for safe accesses to extern statics
- Fix lifetime rules for 'if' conditions.
- Inherit overflow checks for sum and product.
- Forbid user-defined macros named "macro_rules".
Version 1.12.1 (2016-10-20)
Regression Fixes
- ICE: 'rustc' panicked at 'assertion failed: concrete_substs.is_normalized_for_trans()' #36381
- Confusion with double negation and booleans
- rustc 1.12.0 fails with SIGSEGV in release mode (syn crate 0.8.0)
- Rustc 1.12.0 Windows build of
ethcorecrate fails with LLVM error - 1.12.0: High memory usage when linking in release mode with debug info
- Corrupted memory after updated to 1.12
- "Let NullaryConstructor = something;" causes internal compiler error: "tried to overwrite interned AdtDef"
- Fix ICE: inject bitcast if types mismatch for invokes/calls/stores
- debuginfo: Handle spread_arg case in MIR-trans in a more stable way.
Version 1.12.0 (2016-09-29)
Highlights
rustctranslates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.rustcpresents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.
Compiler
rustctranslates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.- Print the Rust target name, not the LLVM target name, with
--print target-list - The computation of
TypeIdis correct in some cases where it was previously producing inconsistent results - The
mips-unknown-linux-gnutarget uses hardware floating point by default - The
rustcarguments,--print target-cpus,--print target-features,--print relocation-models, and--print code-modelsprint the available options to the-C target-cpu,-C target-feature,-C relocation-modeland-C code-modelcode generation arguments rustcsupports three new MUSL targets on ARM:arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf, andarmv7-unknown-linux-musleabihf. These targets produce statically-linked binaries. There are no binary release builds yet though.
Diagnostics
rustcpresents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.- In error descriptions, references are now described in plain English, instead of as "&-ptr"
- In error type descriptions, unknown numeric types are named
{integer}or{float}instead of_ rustcemits a clearer error when inner attributes follow a doc comment
Language
macro_rules!invocations can be made withinmacro_rules!invocationsmacro_rules!meta-variables are hygienicmacro_rules!ttmatchers can be reparsed correctly, making them much more usefulmacro_rules!stmtmatchers correctly consume the entire contents when inside non-braces invocations- Semicolons are properly required as statement delimiters inside
macro_rules!invocations cfg_attrworks onpathattributes
Stabilized APIs
Cell::as_ptrRefCell::as_ptrIpAddr::is_unspecifiedIpAddr::is_loopbackIpAddr::is_multicastIpv4Addr::is_unspecifiedIpv6Addr::octetsLinkedList::containsVecDeque::containsExitStatusExt::from_raw. Both on Unix and Windows.Receiver::recv_timeoutRecvTimeoutErrorBinaryHeap::peek_mutPeekMutiter::Productiter::SumOccupiedEntry::remove_entryVacantEntry::into_key
Libraries
- The
format!macro and friends now allow a single argument to be formatted in multiple styles - The lifetime bounds on
[T]::binary_search_byand[T]::binary_search_by_keyhave been adjusted to be more flexible OptionimplementsFromfor its contained typeCell,RefCellandUnsafeCellimplementFromfor their contained typeRwLockpanics if the reader count overflowsvec_deque::Drain,hash_map::Drainandhash_set::Drainare covariantvec::Drainandbinary_heap::Drainare covariantCow<str>implementsFromIteratorforchar,&strandString- Sockets on Linux are correctly closed in subprocesses via
SOCK_CLOEXEC hash_map::Entry,hash_map::VacantEntryandhash_map::OccupiedEntryimplementDebugbtree_map::Entry,btree_map::VacantEntryandbtree_map::OccupiedEntryimplementDebugStringimplementsAddAssign- Variadic
extern fnpointers implement theClone,PartialEq,Eq,PartialOrd,Ord,Hash,fmt::Pointer, andfmt::Debugtraits FileTypeimplementsDebug- References to
MutexandRwLockare unwind-safe mpsc::sync_channelReceivers return any available message before reporting a disconnect- Unicode definitions have been updated to 9.0
enviterators implementDoubleEndedIterator
Cargo
- Support local mirrors of registries
- Add support for command aliases
- Allow
opt-level="s"/opt-level="z"in profile overrides - Make
cargo doc --open --targetwork as expected - Speed up noop registry updates
- Update OpenSSL
- Fix
--panic=abortwith plugins - Always pass
-C metadatato the compiler - Fix depending on git repos with workspaces
- Add a
--libflag tocargo new - Add
http.cainfofor custom certs - Indicate the compilation profile after compiling
- Allow enabling features for dependencies with
--features - Add
--jobsflag tocargo package - Add
--dry-runtocargo publish - Add support for
RUSTDOCFLAGS
Performance
panic::catch_unwindis more optimizedpanic::catch_unwindno longer accesses thread-local storage on entry
Tooling
- Test binaries now support a
--test-threadsargument to specify the number of threads used to run tests, and which acts the same as theRUST_TEST_THREADSenvironment variable - The test runner now emits a warning when tests run over 60 seconds
- rustdoc: Fix methods in search results
rust-lldbwarns about unsupported versions of LLDB- Rust releases now come with source packages that can be installed by rustup
via
rustup component add rust-src. The resulting source code can be used by tools and IDES, located in the sysroot underlib/rustlib/src.
Misc
- The compiler can now be built against LLVM 3.9
- Many minor improvements to the documentation.
- The Rust exception handling "personality" routine is now written in Rust
Compatibility Notes
- When printing Windows
OsStrs, unpaired surrogate codepoints are escaped with the lowercase format instead of the uppercase - When formatting strings, if "precision" is specified, the "fill", "align" and "width" specifiers are no longer ignored
- The
Debugimpl for strings no longer escapes all non-ASCII characters
Version 1.11.0 (2016-08-18)
Language
- Support nested
cfg_attrattributes - Allow statement-generating braced macro invocations at the end of blocks
- Macros can be expanded inside of trait definitions
#[macro_use]works properly when it is itself expanded from a macro
Stabilized APIs
BinaryHeap::appendBTreeMap::appendBTreeMap::split_offBTreeSet::appendBTreeSet::split_offf32::to_degrees(in libcore - previously stabilized in libstd)f32::to_radians(in libcore - previously stabilized in libstd)f64::to_degrees(in libcore - previously stabilized in libstd)f64::to_radians(in libcore - previously stabilized in libstd)Iterator::sumIterator::productCell::get_mutRefCell::get_mut
Libraries
- The
thread_local!macro supports multiple definitions in a single invocation, and can apply attributes CowimplementsDefaultWrappingimplements binary, octal, lower-hex and upper-hexDisplayformatting- The range types implement
Hash lookup_hostignores unknown address typesassert_eq!accepts a custom error message, likeassert!does- The main thread is now called "main" instead of "<main>"
Cargo
- Disallow specifying features of transitive deps
- Add color support for Windows consoles
- Fix
harness = falseon[lib]sections - Don't panic when
linkscontains a '.' - Build scripts can emit warnings,
and
-vvprints warnings for all crates. - Ignore file locks on OS X NFS mounts
- Don't warn about
package.metadatakeys. This provides room for expansion by arbitrary tools. - Add support for cdylib crate types
- Prevent publishing crates when files are dirty
- Don't fetch all crates on clean
- Propagate --color option to rustc
- Fix
cargo doc --openon Windows - Improve autocompletion
- Configure colors of stderr as well as stdout
Performance
- Caching projections speeds up type check dramatically for some workloads
- The default
HashMaphasher is SipHash 1-3 instead of SipHash 2-4 This hasher is faster, but is believed to provide sufficient protection from collision attacks. - Comparison of
Ipv4Addris 10x faster
Rustdoc
- Fix empty implementation section on some module pages
- Fix inlined renamed re-exports in import lists
- Fix search result layout for enum variants and struct fields
- Fix issues with source links to external crates
- Fix redirect pages for renamed re-exports
Tooling
- rustc is better at finding the MSVC toolchain
- When emitting debug info, rustc emits frame pointers for closures, shims and glue, as it does for all other functions
- rust-lldb warns about unsupported versions of LLDB
- Many more errors have been given error codes and extended explanations
- API documentation continues to be improved, with many new examples
Misc
- rustc no longer hangs when dependencies recursively re-export submodules
- rustc requires LLVM 3.7+
- The 'How Safe and Unsafe Interact' chapter of The Rustonomicon was rewritten
- rustc support 16-bit pointer sizes. No targets use this yet, but it works toward AVR support.
Compatibility Notes
consts andstatics may not have unsized types- The new follow-set rules that place restrictions on
macro_rules!in order to ensure syntax forward-compatibility have been enabled This was an amendment to RFC 550, and has been a warning since 1.10. cfgattribute process has been refactored to fix various bugs. This causes breakage in some corner cases.
Version 1.10.0 (2016-07-07)
Language
Copytypes are required to have a trivial implementation ofClone. RFC 1521.- Single-variant enums support the
#[repr(..)]attribute. - Fix
#[derive(RustcEncodable)]in the presence of otherencodemethods. panic!can be converted to a runtime abort with the-C panic=abortflag. RFC 1513.- Add a new crate type, 'cdylib'. cdylibs are dynamic libraries suitable for loading by non-Rust hosts. RFC 1510. Note that Cargo does not yet directly support cdylibs.
Stabilized APIs
os::windows::fs::OpenOptionsExt::access_modeos::windows::fs::OpenOptionsExt::share_modeos::windows::fs::OpenOptionsExt::custom_flagsos::windows::fs::OpenOptionsExt::attributesos::windows::fs::OpenOptionsExt::security_qos_flagsos::unix::fs::OpenOptionsExt::custom_flagssync::Weak::newDefault for sync::Weakpanic::set_hookpanic::take_hookpanic::PanicInfopanic::PanicInfo::payloadpanic::PanicInfo::locationpanic::Locationpanic::Location::filepanic::Location::lineffi::CStr::from_bytes_with_nulffi::CStr::from_bytes_with_nul_uncheckedffi::FromBytesWithNulErrorfs::Metadata::modifiedfs::Metadata::accessedfs::Metadata::createdsync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchangesync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weakcollections::{btree,hash}_map::{Occupied,Vacant,}Entry::keyos::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}SocketAddr::is_unnamedSocketAddr::as_pathnameUnixStream::connectUnixStream::pairUnixStream::try_cloneUnixStream::local_addrUnixStream::peer_addrUnixStream::set_read_timeoutUnixStream::set_write_timeoutUnixStream::read_timeoutUnixStream::write_timeoutUnixStream::set_nonblockingUnixStream::take_errorUnixStream::shutdown- Read/Write/RawFd impls for
UnixStream UnixListener::bindUnixListener::acceptUnixListener::try_cloneUnixListener::local_addrUnixListener::set_nonblockingUnixListener::take_errorUnixListener::incoming- RawFd impls for
UnixListener UnixDatagram::bindUnixDatagram::unboundUnixDatagram::pairUnixDatagram::connectUnixDatagram::try_cloneUnixDatagram::local_addrUnixDatagram::peer_addrUnixDatagram::recv_fromUnixDatagram::recvUnixDatagram::send_toUnixDatagram::sendUnixDatagram::set_read_timeoutUnixDatagram::set_write_timeoutUnixDatagram::read_timeoutUnixDatagram::write_timeoutUnixDatagram::set_nonblockingUnixDatagram::take_errorUnixDatagram::shutdown- RawFd impls for
UnixDatagram {BTree,Hash}Map::values_mut<[_]>::binary_search_by_key
Libraries
- The
abs_submethod of floats is deprecated. The semantics of this minor method are subtle and probably not what most people want. - Add implementation of Ord for Cell and RefCell where T: Ord.
- On Linux, if
HashMaps can't be initialized withgetrandomthey will fall back to/dev/urandomtemporarily to avoid blocking during early boot. - Implemented negation for wrapping numerals.
- Implement
Cloneforbinary_heap::IntoIter. - Implement
DisplayandHashforstd::num::Wrapping. - Add
Defaultimplementation for&CStr,CString. - Implement
From<Vec<T>>andInto<Vec<T>>forVecDeque<T>. - Implement
DefaultforUnsafeCell,fmt::Error,Condvar,Mutex,RwLock.
Cargo
- Cargo.toml supports the
profile.*.panicoption. This controls the runtime behavior of thepanic!macro and can be either "unwind" (the default), or "abort". RFC 1513. - Don't throw away errors with
-parguments. - Report status to stderr instead of stdout.
- Build scripts are passed a
CARGO_MANIFEST_LINKSenvironment variable that corresponds to thelinksfield of the manifest. - Ban keywords from crate names.
- Canonicalize
CARGO_HOMEon Windows. - Retry network requests.
By default they are retried twice, which can be customized with the
net.retryvalue in.cargo/config. - Don't print extra error info for failing subcommands.
- Add
--forceflag tocargo install. - Don't use
flockon NFS mounts. - Prefer building
cargo installartifacts in temporary directories. Makes it possible to install multiple crates in parallel. - Add
cargo test --doc. - Add
cargo --explain. - Don't print warnings when
-qis passed. - Add
cargo doc --liband--bin. - Don't require build script output to be UTF-8.
- Correctly attempt multiple git usernames.
Performance
- rustc memory usage was reduced by refactoring the context used for type checking.
- Speed up creation of
HashMaps by caching the random keys used to initialize the hash state. - The
findimplementation forChainiterators is 2x faster. - Trait selection optimizations speed up type checking by 15%.
- Efficient trie lookup for boolean Unicode properties. 10x faster than the previous lookup tables.
- Special case
#[derive(Copy, Clone)]to avoid bloat.
Usability
- Many incremental improvements to documentation and rustdoc.
- rustdoc: List blanket trait impls.
- rustdoc: Clean up ABI rendering.
- Indexing with the wrong type produces a more informative error.
- Improve diagnostics for constants being used in irrefutable patterns.
- When many method candidates are in scope limit the suggestions to 10.
- Remove confusing suggestion when calling a
fntype. - Do not suggest changing
&mut selfto&mut mut self.
Misc
- Update i686-linux-android features to match Android ABI.
- Update aarch64-linux-android features to match Android ABI.
stdno longer prints backtraces on platforms where the running module must be loaded withenv::current_exe, which can't be relied on.- This release includes std binaries for the i586-unknown-linux-gnu, i686-unknown-linux-musl, and armv7-linux-androideabi targets. The i586 target is for old x86 hardware without SSE2, and the armv7 target is for Android running on modern ARM architectures.
- The
rust-gdbandrust-lldbscripts are distributed on all Unix platforms. - On Unix the runtime aborts by calling
libc::abortinstead of generating an illegal instruction. - Rust is now bootstrapped from the previous release of Rust, instead of a snapshot from an arbitrary commit.
Compatibility Notes
AtomicBoolis now bool-sized, not word-sized.target_envfor Linux ARM targets is justgnu, notgnueabihf,gnueabi, etc.- Consistently panic on overflow in
Duration::new. - Change
String::truncateto panic less. - Add
:blockto the follow set for:tyand:path. Affects how macros are parsed. - Fix macro hygiene bug.
- Feature-gated attributes on macro-generated macro invocations are now rejected.
- Suppress fallback and ambiguity errors during type inference. This caused some minor changes to type inference.
Version 1.9.0 (2016-05-26)
Language
- The
#[deprecated]attribute when applied to an API will generate warnings when used. The warnings may be suppressed with#[allow(deprecated)]. RFC 1270. fnitem types are zero sized, and eachfnnames a unique type. This will break code that transmutesfns, so callingtransmuteon afntype will generate a warning for a few cycles, then will be converted to an error.- Field and method resolution understand visibility, so private fields and methods cannot prevent the proper use of public fields and methods.
- The parser considers unicode codepoints in the
PATTERN_WHITE_SPACEcategory to be whitespace.
Stabilized APIs
std::panicstd::panic::catch_unwind(renamed fromrecover)std::panic::resume_unwind(renamed frompropagate)std::panic::AssertUnwindSafe(renamed fromAssertRecoverSafe)std::panic::UnwindSafe(renamed fromRecoverSafe)str::is_char_boundary<*const T>::as_ref<*mut T>::as_ref<*mut T>::as_mutAsciiExt::make_ascii_uppercaseAsciiExt::make_ascii_lowercasechar::decode_utf16char::DecodeUtf16char::DecodeUtf16Errorchar::DecodeUtf16Error::unpaired_surrogateBTreeSet::takeBTreeSet::replaceBTreeSet::getHashSet::takeHashSet::replaceHashSet::getOsString::with_capacityOsString::clearOsString::capacityOsString::reserveOsString::reserve_exactOsStr::is_emptyOsStr::lenstd::os::unix::threadRawPthreadJoinHandleExtJoinHandleExt::as_pthread_tJoinHandleExt::into_pthread_tHashSet::hasherHashMap::hasherCommandExt::execFile::try_cloneSocketAddr::set_ipSocketAddr::set_portSocketAddrV4::set_ipSocketAddrV4::set_portSocketAddrV6::set_ipSocketAddrV6::set_portSocketAddrV6::set_flowinfoSocketAddrV6::set_scope_idslice::copy_from_sliceptr::read_volatileptr::write_volatileOpenOptions::create_newTcpStream::set_nodelayTcpStream::nodelayTcpStream::set_ttlTcpStream::ttlTcpStream::set_only_v6TcpStream::only_v6TcpStream::take_errorTcpStream::set_nonblockingTcpListener::set_ttlTcpListener::ttlTcpListener::set_only_v6TcpListener::only_v6TcpListener::take_errorTcpListener::set_nonblockingUdpSocket::set_broadcastUdpSocket::broadcastUdpSocket::set_multicast_loop_v4UdpSocket::multicast_loop_v4UdpSocket::set_multicast_ttl_v4UdpSocket::multicast_ttl_v4UdpSocket::set_multicast_loop_v6UdpSocket::multicast_loop_v6UdpSocket::set_multicast_ttl_v6UdpSocket::multicast_ttl_v6UdpSocket::set_ttlUdpSocket::ttlUdpSocket::set_only_v6UdpSocket::only_v6UdpSocket::join_multicast_v4UdpSocket::join_multicast_v6UdpSocket::leave_multicast_v4UdpSocket::leave_multicast_v6UdpSocket::take_errorUdpSocket::connectUdpSocket::sendUdpSocket::recvUdpSocket::set_nonblocking
Libraries
std::sync::Onceis poisoned if its initialization function fails.cell::Refandcell::RefMutcan contain unsized types.- Most types implement
fmt::Debug. - The default buffer size used by
BufReaderandBufWriterwas reduced to 8K, from 64K. This is in line with the buffer size used by other languages. Instant,SystemTimeandDurationimplement+=and-=.Durationadditionally implements*=and/=.Skipis aDoubleEndedIterator.From<[u8; 4]>is implemented forIpv4Addr.ChainimplementsBufRead.HashMap,HashSetand iterators are covariant.
Cargo
- Cargo can now run concurrently.
- Top-level overrides allow specific revisions of crates to be overridden through the entire crate graph. This is intended to make upgrades easier for large projects, by allowing crates to be forked temporarily until they've been upgraded and republished.
- Cargo exports a
CARGO_PKG_AUTHORSenvironment variable. - Cargo will pass the contents of the
RUSTFLAGSvariable torustcon the commandline.rustcarguments can also be specified in thebuild.rustflagsconfiguration key.
Performance
- The time complexity of comparing variables for equivalence during type unification is reduced from O(n!) to O(n). This leads to major compilation time improvement in some scenarios.
ToStringis specialized forstr, giving it the same performance asto_owned.- Spawning processes with
Command::outputno longer creates extra threads. #[derive(PartialEq)]and#[derive(PartialOrd)]emit less code for C-like enums.
Misc
- Passing the
--quietflag to a test runner will produce much-abbreviated output. - The Rust Project now publishes std binaries for the
mips-unknown-linux-musl,mipsel-unknown-linux-musl, andi586-pc-windows-msvctargets.
Compatibility Notes
std::sync::Onceis poisoned if its initialization function fails.- It is illegal to define methods with the same name in overlapping
inherent
implblocks. fnitem types are zero sized, and eachfnnames a unique type. This will break code that transmutesfns, so callingtransmuteon afntype will generate a warning for a few cycles, then will be converted to an error.- Improvements to const evaluation may trigger new errors when integer literals are out of range.
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.
Version 1.7.0 (2016-03-03)
Libraries
- Stabilized APIs
PathPath::strip_prefix(renamed from relative_from)path::StripPrefixError(new error type returned from strip_prefix)
Ipv4AddrIpv6AddrVecString- Slices
<[T]>::clone_from_slice, which now requires the two slices to be the same length<[T]>::sort_by_key
- checked, saturated, and overflowing operations
i32::checked_rem,i32::checked_neg,i32::checked_shl,i32::checked_shri32::saturating_muli32::overflowing_add,i32::overflowing_sub,i32::overflowing_mul,i32::overflowing_divi32::overflowing_rem,i32::overflowing_neg,i32::overflowing_shl,i32::overflowing_shru32::checked_rem,u32::checked_neg,u32::checked_shl,u32::checked_shlu32::saturating_mulu32::overflowing_add,u32::overflowing_sub,u32::overflowing_mul,u32::overflowing_divu32::overflowing_rem,u32::overflowing_neg,u32::overflowing_shl,u32::overflowing_shr- and checked, saturated, and overflowing operations for other primitive types
- FFI
ffi::IntoStringErrorCString::into_stringCString::into_bytesCString::into_bytes_with_nulFrom<CString> for Vec<u8>
IntoStringErrorIntoStringError::into_cstringIntoStringError::utf8_errorError for IntoStringError
- Hashing
- Validating UTF-8 is faster by a factor of between 7 and 14x for
ASCII input. This means that creating
Strings andstrs from bytes is faster. - The performance of
LineWriter(and thusio::stdout) was improved by usingmemchrto search for newlines. f32::to_degreesandf32::to_radiansare stable. Thef64variants were stabilized previously.BTreeMapwas rewritten to use less memory and improve the performance of insertion and iteration, the latter by as much as 5x.BTreeSetand its iterators,Iter,IntoIter, andRangeare covariant over their contained type.LinkedListand its iterators,IterandIntoIterare covariant over their contained type.str::replacenow accepts aPattern, like other string searching methods.Anyis implemented for unsized types.Hashis implemented forDuration.
Misc
- When running tests with
--test, rustdoc will pass--cfgarguments to the compiler. - The compiler is built with RPATH information by default.
This means that it will be possible to run
rustcwhen installed in unusual configurations without configuring the dynamic linker search path explicitly. rustcpasses--enable-new-dtagsto GNU ld. This makes any RPATH entries (emitted with-C rpath) not take precedence overLD_LIBRARY_PATH.
Cargo
cargo rustcaccepts a--profileflag that runsrustcunder any of the compilation profiles, 'dev', 'bench', or 'test'.- The
rerun-if-changedbuild script directive no longer causes the build script to incorrectly run twice in certain scenarios.
Compatibility Notes
- Soundness fixes to the interactions between associated types and lifetimes, specified in RFC 1214, now generate errors for code that violates the new rules. This is a significant change that is known to break existing code, so it has emitted warnings for the new error cases since 1.4 to give crate authors time to adapt. The details of what is changing are subtle; read the RFC for more.
- Several bugs in the compiler's visibility calculations were
fixed. Since this was found to break significant amounts of
code, the new errors will be emitted as warnings for several release
cycles, under the
private_in_publiclint. - Defaulted type parameters were accidentally accepted in positions that were not intended. In this release, defaulted type parameters appearing outside of type definitions will generate a warning, which will become an error in future releases.
- Parsing "." as a float results in an error instead of 0.
That is,
".".parse::<f32>()returnsErr, notOk(0.0). - Borrows of closure parameters may not outlive the closure.
Version 1.6.0 (2016-01-21)
Language
- The
#![no_std]attribute causes a crate to not be linked to the standard library, but only the core library, 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 is stable, as are most of its APIs.
- The
assert_eq!macro supports arguments that don't implementSized, 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. 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 while still growing exponentially. Fromconversions are implemented from integers to floats 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 for modest performance improvements.- Sorting slices that are already sorted is 50% faster in some cases.
Cargo
- Cargo will look in
$CARGO_HOME/binfor subcommands by default. - Cargo build scripts can specify their dependencies by emitting the
rerun-if-changedkey. - 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 cleanaccepts a--releaseflag 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. - The parser indicates failures that may be caused by confusingly-similar Unicode characters
- Certain macro errors are reported at definition time, 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.
Version 1.5.0 (2015-12-10)
- ~700 changes, numerous bugfixes
Highlights
- Stabilized APIs:
BinaryHeap::from,BinaryHeap::into_sorted_vec,BinaryHeap::into_vec,Condvar::wait_timeout,FileTypeExt::is_block_device,FileTypeExt::is_char_device,FileTypeExt::is_fifo,FileTypeExt::is_socket,FileTypeExt,Formatter::alternate,Formatter::fill,Formatter::precision,Formatter::sign_aware_zero_pad,Formatter::sign_minus,Formatter::sign_plus,Formatter::width,Iterator::cmp,Iterator::eq,Iterator::ge,Iterator::gt,Iterator::le,Iterator::lt,Iterator::ne,Iterator::partial_cmp,Path::canonicalize,Path::exists,Path::is_dir,Path::is_file,Path::metadata,Path::read_dir,Path::read_link,Path::symlink_metadata,Utf8Error::valid_up_to,Vec::resize,VecDeque::as_mut_slices,VecDeque::as_slices,VecDeque::insert,VecDeque::shrink_to_fit,VecDeque::swap_remove_back,VecDeque::swap_remove_front,slice::split_first_mut,slice::split_first,slice::split_last_mut,slice::split_last,char::from_u32_unchecked,fs::canonicalize,str::MatchIndices,str::RMatchIndices,str::match_indices,str::rmatch_indices,str::slice_mut_unchecked,string::ParseError. - Rust applications hosted on crates.io can be installed locally to
~/.cargo/binwith thecargo installcommand. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g.cargo-foois found in$PATHit can be invoked ascargo foo. - Crates with wildcard (
*) dependencies will emit warnings when published. In 1.6 it will no longer be possible to publish crates with wildcard dependencies.
Breaking Changes
- The rules determining when a particular lifetime must outlive a particular value (known as 'dropck') have been modified to not rely on parametricity.
- Implementations of
AsRefandAsMutwere added toBox,Rc, andArc. Because these smart pointer types implementDeref, this causes breakage in cases where the interior type contains methods of the same name. - Correct a bug in Rc/Arc that caused dropck to be unaware that they could drop their content. Soundness fix.
- All method invocations are properly checked for well-formedness. Soundness fix.
- Traits whose supertraits contain
Selfare not object safe. Soundness fix. - Target specifications support a
no_default_librariessetting that controls whether-nodefaultlibsis passed to the linker, and in turn theis_like_windowssetting no longer affects the-nodefaultlibsflag. #[derive(Show)], long-deprecated, has been removed.- The
#[inline]and#[repr]attributes can only appear in valid locations. - Native libraries linked from the local crate are passed to the linker before native libraries from upstream crates.
- Two rarely-used attributes,
#[no_debug]and#[omit_gdb_pretty_printer_section]are feature gated. - Negation of unsigned integers, which has been a warning for several releases, is now behind a feature gate and will generate errors.
- The parser accidentally accepted visibility modifiers on enum variants, a bug which has been fixed.
- A bug was fixed that allowed
usestatements to import unstable features.
Language
- When evaluating expressions at compile-time that are not compile-time constants (const-evaluating expressions in non-const contexts), incorrect code such as overlong bitshifts and arithmetic overflow will generate a warning instead of an error, delaying the error until runtime. This will allow the const-evaluator to be expanded in the future backwards-compatibly.
- The
improper_ctypeslint no longer warns about usingisizeandusizein FFI.
Libraries
Arc<T>andRc<T>are covariant with respect toTinstead of invariant.Defaultis implemented for mutable slices.FromStris implemented forSockAddrV4andSockAddrV6.- There are now
Fromconversions between floating point types where the conversions are lossless. - There are now
Fromconversions between integer types where the conversions are lossless. fs::MetadataimplementsClone.- The
parsemethod accepts a leading "+" when parsing integers. AsMutis implemented forVec.- The
clone_fromimplementations forStringandBinaryHeaphave been optimized and no longer rely on the default impl. - The
extern "Rust",extern "C",unsafe extern "Rust"andunsafe extern "C"function types now implementClone,PartialEq,Eq,PartialOrd,Ord,Hash,fmt::Pointer, andfmt::Debugfor up to 12 arguments. - Dropping
Vecs is much faster in unoptimized builds when the element types don't implementDrop. - A bug that caused in incorrect behavior when combining
VecDequewith zero-sized types was resolved. PartialOrdfor slices is faster.
Miscellaneous
- Crate metadata size was reduced by 20%.
- Improvements to code generation reduced the size of libcore by 3.3 MB and rustc's memory usage by 18MB.
- Improvements to deref translation increased performance in unoptimized builds.
- Various errors in trait resolution are deduplicated to only be reported once.
- Rust has preliminary support for rumprun kernels.
- Rust has preliminary support for NetBSD on amd64.
Version 1.4.0 (2015-10-29)
- ~1200 changes, numerous bugfixes
Highlights
- Windows builds targeting the 64-bit MSVC ABI and linker (instead of GNU) are now supported and recommended for use.
Breaking Changes
- Several changes have been made to fix type soundness and improve the behavior of associated types. See RFC 1214. Although we have mostly introduced these changes as warnings this release, to become errors next release, there are still some scenarios that will see immediate breakage.
- The
str::linesandBufRead::linesiterators treat\r\nas line breaks in addition to\n. - Loans of
'staticlifetime extend to the end of a function. str::parseno longer introduces avoidable rounding error when parsing floating point numbers. Together with earlier changes to float formatting/output, "round trips" like f.to_string().parse() now preserve the value of f exactly. Additionally, leading plus signs are now accepted.
Language
usestatements that import multiple items can now rename them, as inuse foo::{bar as kitten, baz as puppy}.- Binops work correctly on fat pointers.
pub extern crate, which does not behave as expected, issues a warning until a better solution is found.
Libraries
- Many APIs were stabilized:
<Box<str>>::into_string,Arc::downgrade,Arc::get_mut,Arc::make_mut,Arc::try_unwrap,Box::from_raw,Box::into_raw,CStr::to_str,CStr::to_string_lossy,CString::from_raw,CString::into_raw,IntoRawFd::into_raw_fd,IntoRawFd,IntoRawHandle::into_raw_handle,IntoRawHandle,IntoRawSocket::into_raw_socket,IntoRawSocket,Rc::downgrade,Rc::get_mut,Rc::make_mut,Rc::try_unwrap,Result::expect,String::into_boxed_str,TcpStream::read_timeout,TcpStream::set_read_timeout,TcpStream::set_write_timeout,TcpStream::write_timeout,UdpSocket::read_timeout,UdpSocket::set_read_timeout,UdpSocket::set_write_timeout,UdpSocket::write_timeout,Vec::append,Vec::split_off,VecDeque::append,VecDeque::retain,VecDeque::split_off,rc::Weak::upgrade,rc::Weak,slice::Iter::as_slice,slice::IterMut::into_slice,str::CharIndices::as_str,str::Chars::as_str,str::split_at_mut,str::split_at,sync::Weak::upgrade,sync::Weak,thread::park_timeout,thread::sleep. - Some APIs were deprecated:
BTreeMap::with_b,BTreeSet::with_b,Option::as_mut_slice,Option::as_slice,Result::as_mut_slice,Result::as_slice,f32::from_str_radix,f64::from_str_radix. - Reverse-searching strings is faster with the 'two-way' algorithm.
std::io::copyallows?Sizedarguments.- The
Windows,Chunks, andChunksMutiterators over slices all overridecount,nthandlastwith an O(1) implementation. Defaultis implemented for arrays up to[T; 32].IntoRawFdhas been added to the Unix-specific prelude,IntoRawSocketandIntoRawHandleto the Windows-specific prelude.Extend<String>andFromIterator<Stringare both implemented forString.IntoIteratoris implemented for references toOptionandResult.HashMapandHashSetimplementExtend<&T>whereT: Copyas part of RFC 839. This will cause type inference breakage in rare situations.BinaryHeapimplementsDebug.BorrowandBorrowMutare implemented for fixed-size arrays.extern fns with the "Rust" and "C" ABIs implement common traits includingEq,Ord,Debug,Hash.- String comparison is faster.
&mut TwhereT: std::fmt::Writealso implementsstd::fmt::Write.- A stable regression in
VecDeque::push_backand other capacity-altering methods that caused panics for zero-sized types was fixed. - Function pointers implement traits for up to 12 parameters.
Miscellaneous
- The compiler no longer uses the 'morestack' feature to prevent stack overflow. Instead it uses guard pages and stack probes (though stack probes are not yet implemented on any platform but Windows).
- The compiler matches traits faster when projections are involved.
- The 'improper_ctypes' lint no longer warns about use of
isizeandusize. - Cargo now displays useful information about what its doing during
cargo update.
Version 1.3.0 (2015-09-17)
- ~900 changes, numerous bugfixes
Highlights
- The new object lifetime defaults have been turned
on after a cycle of warnings about the change. Now types
like
&'a Box<Trait>(or&'a Rc<Trait>, etc) will change from being interpreted as&'a Box<Trait+'a>to&'a Box<Trait+'static>. - The Rustonomicon is a new book in the official documentation that dives into writing unsafe Rust.
- The
DurationAPI, has been stabilized. This basic unit of timekeeping is employed by other std APIs, as well as out-of-tree time crates.
Breaking Changes
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- There is a known regression in how object lifetime elision is interpreted, the proper solution for which is undetermined.
- The
#[prelude_import]attribute, an internal implementation detail, was accidentally stabilized previously. It has been put behind theprelude_importfeature gate. This change is believed to break no existing code. - The behavior of
size_of_valandalign_of_valis more sane for dynamically sized types. Code that relied on the previous behavior is thought to be broken. - The
dropckrules, which checks that destructors can't access destroyed values, have been updated to match the RFC. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build.
Language
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- Semicolons may now follow types and paths in macros.
- The behavior of
size_of_valandalign_of_valis more sane for dynamically sized types. Code that relied on the previous behavior is not known to exist, and suspected to be broken. 'staticvariables may now be recursive.refbindings choose betweenDerefandDerefMutimplementations correctly.- The
dropckrules, which checks that destructors can't access destroyed values, have been updated to match the RFC.
Libraries
- The
DurationAPI, has been stabilized, as well as thestd::timemodule, which presently contains onlyDuration. Box<str>andBox<[T]>both implementClone.- The owned C string,
CString, implementsBorrowand the borrowed C string,CStr, implementsToOwned. The two of these allow C strings to be borrowed and cloned in generic code. CStrimplementsDebug.AtomicPtrimplementsDebug.Errortrait objects can be downcast to their concrete types in many common configurations, using theis,downcast,downcast_refanddowncast_mutmethods, similarly to theAnytrait.- Searching for substrings now employs the two-way algorithm
instead of doing a naive search. This gives major speedups to a
number of methods, including
contains,find,rfind,split.starts_withandends_withare also faster. - The performance of
PartialEqfor slices is much faster. - The
Hashtrait offers the default method,hash_slice, which is overridden and optimized by the implementations for scalars. - The
Hashertrait now has a number of specializedwrite_*methods for primitive types, for efficiency. - The I/O-specific error type,
std::io::Error, gained a set of methods for accessing the 'inner error', if any:get_ref,get_mut,into_inner. As well, the implementation ofstd::error::Error::causealso delegates to the inner error. process::Childgained theidmethod, which returns au32representing the platform-specific process identifier.- The
connectmethod on slices is deprecated, replaced by the newjoinmethod (note that both of these are on the unstableSliceConcatExttrait, but through the magic of the prelude are available to stable code anyway). - The
Divoperator is implemented forWrappingtypes. DerefMutis implemented forString.- Performance of SipHash (the default hasher for
HashMap) is better for long data. AtomicPtrimplementsSend.- The
read_to_endimplementations forStdinandFileare now specialized to use uninitialized buffers for increased performance. - Lifetime parameters of foreign functions are now resolved properly.
Misc
- Rust can now, with some coercion, produce programs that run on Windows XP, though XP is not considered a supported platform.
- Porting Rust on Windows from the GNU toolchain to MSVC continues (1, 2, 3, 4). It is still not recommended for use in 1.3, though should be fully-functional in the 64-bit 1.4 beta.
- On Fedora-based systems installation will properly configure the dynamic linker.
- The compiler gained many new extended error descriptions, which can
be accessed with the
--explainflag. - The
dropckpass, which checks that destructors can't access destroyed values, has been rewritten. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build. rustcnow uses LLVM to write archive files where possible. Eventually this will eliminate the compiler's dependency on the ar utility.- Rust has preliminary support for i686 FreeBSD (it has long supported FreeBSD on x86_64).
- The
unused_mut,unconditional_recursion,improper_ctypes, andnegate_unsignedlints are more strict. - If landing pads are disabled (with
-Z no-landing-pads),panic!will kill the process instead of leaking.
Version 1.2.0 (2015-08-07)
- ~1200 changes, numerous bugfixes
Highlights
- Dynamically-sized-type coercions allow smart pointer types
like
Rcto contain types without a fixed size, arrays and trait objects, finally enabling use ofRc<[T]>and completing the implementation of DST. - Parallel codegen is now working again, which can
substantially speed up large builds in debug mode; It also gets
another ~33% speedup when bootstrapping on a 4 core machine (using 8
jobs). It's not enabled by default, but will be "in the near
future". It can be activated with the
-C codegen-units=Nflag torustc. - This is the first release with experimental support for linking with the MSVC linker and lib C on Windows (instead of using the GNU variants via MinGW). It is yet recommended only for the most intrepid Rustaceans.
- Benchmark compilations are showing a 30% improvement in bootstrapping over 1.1.
Breaking Changes
- The
to_uppercaseandto_lowercasemethods oncharnow do unicode case mapping, which is a previously-planned change in behavior and considered a bugfix. mem::align_ofnow specifies the minimum alignment for T, which is usually the alignment programs are interested in, and the same value reported by clang'salignof.mem::min_align_ofis deprecated. This is not known to break real code.- The
#[packed]attribute is no longer silently accepted by the compiler. This attribute did nothing and code that mentioned it likely did not work as intended. - Associated type defaults are now behind the
associated_type_defaultsfeature gate. In 1.1 associated type defaults did not work, but could be mentioned syntactically. As such this breakage has minimal impact.
Language
- Patterns with
ref mutnow correctly invokeDerefMutwhen matching against dereferenceable values.
Libraries
- The
Extendtrait, which grows a collection from an iterator, is implemented over iterators of references, forString,Vec,LinkedList,VecDeque,EnumSet,BinaryHeap,VecMap,BTreeSetandBTreeMap. RFC. - The
iter::oncefunction returns an iterator that yields a single element, anditer::emptyreturns an iterator that yields no elements. - The
matchesandrmatchesmethods onstrreturn iterators over substring matches. CellandRefCellboth implementEq.- A number of methods for wrapping arithmetic are added to the
integral types,
wrapping_div,wrapping_rem,wrapping_neg,wrapping_shl,wrapping_shr. These are in addition to the existingwrapping_add,wrapping_sub, andwrapping_mulmethods, and alternatives to theWrappingtype.. It is illegal for the default arithmetic operations in Rust to overflow; the desire to wrap must be explicit. - The
{:#?}formatting specifier displays the alternate, pretty-printed form of theDebugformatter. This feature was actually introduced prior to 1.0 with little fanfare. fmt::Formatterimplementsfmt::Write, afmt-specific trait for writing data to formatted strings, similar toio::Write.fmt::Formatteradds 'debug builder' methods,debug_struct,debug_tuple,debug_list,debug_set,debug_map. These are used by code generators to emit implementations ofDebug.strhas newto_uppercaseandto_lowercasemethods that convert case, following Unicode case mapping.- It is now easier to handle poisoned locks. The
PoisonErrortype, returned by failing lock operations, exposesinto_inner,get_ref, andget_mut, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. Theis_poisonedmethod ofRwLockandMutexcan poll for a poisoned lock without attempting to take the lock. - On Unix the
FromRawFdtrait is implemented forStdio, andAsRawFdforChildStdin,ChildStdout,ChildStderr. On Windows theFromRawHandletrait is implemented forStdio, andAsRawHandleforChildStdin,ChildStdout,ChildStderr. io::ErrorKindhas a new variant,InvalidData, which indicates malformed input.
Misc
rustcemploys smarter heuristics for guessing at typos.rustcemits more efficient code for no-op conversions between unsafe pointers.- Fat pointers are now passed in pairs of immediate arguments, resulting in faster compile times and smaller code.
Version 1.1.0 (2015-06-25)
- ~850 changes, numerous bugfixes
Highlights
- The
std::fsmodule has been expanded to expand the set of functionality exposed:DirEntrynow supports optimizations likefile_typeandmetadatawhich don't incur a syscall on some platforms.- A
symlink_metadatafunction has been added. - The
fs::Metadatastructure now lowers to its OS counterpart, providing access to all underlying information.
- The compiler now contains extended explanations of many errors. When an error
with an explanation occurs the compiler suggests using the
--explainflag to read the explanation. Error explanations are also available online. - Thanks to multiple improvements to type checking, as well as other work, the time to bootstrap the compiler decreased by 32%.
Libraries
- The
str::split_whitespacemethod splits a string on unicode whitespace boundaries. - On both Windows and Unix, new extension traits provide conversion of
I/O types to and from the underlying system handles. On Unix, these
traits are
FromRawFdandAsRawFd, on WindowsFromRawHandleandAsRawHandle. These are implemented forFile,TcpStream,TcpListener, andUpdSocket. Further implementations forstd::processwill be stabilized later. - On Unix,
std::os::unix::symlinkcreates symlinks. On Windows, symlinks can be created withstd::os::windows::symlink_dirandstd::os::windows::symlink_file. - The
mpsc::Receivertype can now be converted into an iterator withinto_iteron theIntoIteratortrait. Ipv4Addrcan be created fromu32with theFrom<u32>implementation of theFromtrait.- The
Debugimplementation forRangeFullcreates output that is more consistent with other implementations. Debugis implemented forFile.- The
Defaultimplementation forArcno longer requiresSync + Send. - The
Iteratormethodscount,nth, andlasthave been overridden for slices to have O(1) performance instead of O(n). - Incorrect handling of paths on Windows has been improved in both the compiler and the standard library.
AtomicPtrgained aDefaultimplementation.- In accordance with Rust's policy on arithmetic overflow
absnow panics on overflow when debug assertions are enabled. - The
Clonediterator, which was accidentally left unstable for 1.0 has been stabilized. - The
Incomingiterator, which iterates over incoming TCP connections, and which was accidentally unnamable in 1.0, is now properly exported. BinaryHeapno longer corrupts itself when functions called bysift_uporsift_downpanic.- The
split_offmethod ofLinkedListno longer corrupts the list in certain scenarios.
Misc
- Type checking performance has improved notably with multiple improvements.
- The compiler suggests code changes for more errors.
- rustc and it's build system have experimental support for building toolchains against MUSL instead of glibc on Linux.
- The compiler defines the
target_envcfg value, which is used for distinguishing toolchains that are otherwise for the same platform. Presently this is set tognufor common GNU Linux targets and for MinGW targets, andmuslfor MUSL Linux targets. - The
cargo rustccommand invokes a build with custom flags to rustc. - Android executables are always position independent.
- The
drop_with_repr_externlint warns about mixingrepr(C)withDrop.
Version 1.0.0 (2015-05-15)
- ~1500 changes, numerous bugfixes
Highlights
- The vast majority of the standard library is now
#[stable]. It is no longer possible to use unstable features with a stable build of the compiler. - Many popular crates on crates.io now work on the stable release channel.
- Arithmetic on basic integer types now checks for overflow in debug builds.
Language
- Several restrictions have been added to trait coherence in order to make it easier for upstream authors to change traits without breaking downstream code.
- Digits of binary and octal literals are lexed more eagerly to
improve error messages and macro behavior. For example,
0b1234is now lexed as0b1234instead of two tokens,0b1and234. - Trait bounds are always invariant, eliminating the need for
the
PhantomFnandMarkerTraitlang items, which have been removed. - "-" is no longer a valid character in crate names, the
extern crate "foo" as barsyntax has been replaced withextern crate foo as bar, and Cargo now automatically translates "-" in package names to underscore for the crate name. - Lifetime shadowing is an error.
Sendno longer implies'static.- UFCS now supports trait-less associated paths like
MyType::default(). - Primitive types now have inherent methods,
obviating the need for extension traits like
SliceExt. - Methods with
Self: Sizedin theirwhereclause are considered object-safe, allowing many extension traits likeIteratorExtto be merged into the traits they extended. - You can now refer to associated types whose
corresponding trait bounds appear only in a
whereclause. - The final bits of OIBIT landed, meaning that traits
like
SendandSyncare now library-defined. - A Reflect trait was introduced, which means that
downcasting via the
Anytrait is effectively limited to concrete types. This helps retain the potentially-important "parametricity" property: generic code cannot behave differently for different type arguments except in minor ways. - The
unsafe_destructorfeature is now deprecated in favor of the newdropck. This change is a major reduction in unsafe code.
Libraries
- The
thread_localmodule has been renamed tostd::thread. - The methods of
IteratorExthave been moved to theIteratortrait itself. - Several traits that implement Rust's conventions for type
conversions,
AsMut,AsRef,From, andIntohave been centralized in thestd::convertmodule. - The
FromErrortrait was removed in favor ofFrom. - The basic sleep function has moved to
std::thread::sleep_ms. - The
splitnfunction now takes annparameter that represents the number of items yielded by the returned iterator instead of the number of 'splits'. - On Unix, all file descriptors are
CLOEXECby default. - Derived implementations of
PartialOrdnow order enums according to their explicitly-assigned discriminants. - Methods for searching strings are generic over
Patterns, implemented presently by&char,&str,FnMut(char) -> booland some others. - In method resolution, object methods are resolved before inherent methods.
String::from_strhas been deprecated in favor of theFromimpl,String::from.io::ErrorimplementsSync.- The
wordsmethod on&strhas been replaced withsplit_whitespace, to avoid answering the tricky question, 'what is a word?' - The new path and IO modules are complete and
#[stable]. This was the major library focus for this cycle. - The path API was revised to normalize
., adjusting the tradeoffs in favor of the most common usage. - A large number of remaining APIs in
stdwere also stabilized during this cycle; about 75% of the non-deprecated API surface is now stable. - The new string pattern API landed, which makes the string slice API much more internally consistent and flexible.
- A new set of generic conversion traits replaced many existing ad hoc traits.
- Generic numeric traits were completely removed. This was made possible thanks to inherent methods for primitive types, and the removal gives maximal flexibility for designing a numeric hierarchy in the future.
- The
Fntraits are now related via inheritance and provide ergonomic blanket implementations. - The
IndexandIndexMuttraits were changed to take the index by value, enabling code likehash_map["string"]to work. Copynow inherits fromClone, meaning that allCopydata is known to beCloneas well.
Misc
- Many errors now have extended explanations that can be accessed with
the
--explainflag torustc. - Many new examples have been added to the standard library documentation.
- rustdoc has received a number of improvements focused on completion and polish.
- Metadata was tuned, shrinking binaries by 27%.
- Much headway was made on ecosystem-wide CI, making it possible to compare builds for breakage.
Version 1.0.0-alpha.2 (2015-02-20)
-
~1300 changes, numerous bugfixes
-
Highlights
- The various I/O modules were overhauled to reduce
unnecessary abstractions and provide better interoperation with
the underlying platform. The old
iomodule remains temporarily atstd::old_io. - The standard library now participates in feature gating,
so use of unstable libraries now requires a
#![feature(...)]attribute. The impact of this change is described on the forum. RFC.
- The various I/O modules were overhauled to reduce
unnecessary abstractions and provide better interoperation with
the underlying platform. The old
-
Language
forloops now operate on theIntoIteratortrait, which eliminates the need to call.iter(), etc. to iterate over collections. There are some new subtleties to remember though regarding what sort of iterators various types yield, in particular thatfor foo in bar { }yields values from a move iterator, destroying the original collection. RFC.- Objects now have default lifetime bounds, so you don't
have to write
Box<Trait+'static>when you don't care about storing references. RFC. - In types that implement
Drop, lifetimes must outlive the value. This will soon make it possible to safely implementDropfor types where#[unsafe_destructor]is now required. Read the gorgeous RFC for details. - The fully qualified ::X syntax lets you set the Self type for a trait method or associated type. RFC.
- References to types that implement
Deref<U>now automatically coerce to references to the dereferenced typeU, e.g.&T where T: Deref<U>automatically coerces to&U. This should eliminate many unsightly uses of&*, as when converting from references to vectors into references to slices. RFC. - The explicit closure kind syntax (
|&:|,|&mut:|,|:|) is obsolete and closure kind is inferred from context. Selfis a keyword.
-
Libraries
- The
ShowandStringformatting traits have been renamed toDebugandDisplayto more clearly reflect their related purposes. Automatically getting a string conversion to use withformat!("{:?}", something_to_debug)is now written#[derive(Debug)]. - Abstract OS-specific string types,
std::ff::{OsString, OsStr}, provide strings in platform-specific encodings for easier interop with system APIs. RFC. - The
boxed::into_rawandBox::from_rawfunctions convert betweenBox<T>and*mut T, a common pattern for creating raw pointers.
- The
-
Tooling
- Certain long error messages of the form 'expected foo found bar' are now split neatly across multiple lines. Examples in the PR.
- On Unix Rust can be uninstalled by running
/usr/local/lib/rustlib/uninstall.sh. - The
#[rustc_on_unimplemented]attribute, requiring the 'on_unimplemented' feature, lets rustc display custom error messages when a trait is expected to be implemented for a type but is not.
-
Misc
- Rust is tested against a LALR grammar, which parses almost all the Rust files that rustc does.
Version 1.0.0-alpha (2015-01-09)
-
~2400 changes, numerous bugfixes
-
Highlights
- The language itself is considered feature complete for 1.0, though there will be many usability improvements and bugfixes before the final release.
- Nearly 50% of the public API surface of the standard library has been declared 'stable'. Those interfaces are unlikely to change before 1.0.
- The long-running debate over integer types has been
settled: Rust will ship with types named
isizeandusize, rather thanintanduint, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle. - Most crates that are not
stdhave been moved out of the Rust distribution into the Cargo ecosystem so they can evolve separately and don't need to be stabilized as quickly, including 'time', 'getopts', 'num', 'regex', and 'term'. - Documentation continues to be expanded with more API coverage, more examples, and more in-depth explanations. The guides have been consolidated into The Rust Programming Language.
- "Rust By Example" is now maintained by the Rust team.
- All official Rust binary installers now come with Cargo, the Rust package manager.
-
Language
- Closures have been completely redesigned to be implemented in terms of traits, can now be used as generic type bounds and thus monomorphized and inlined, or via an opaque pointer (boxed) as in the old system. The new system is often referred to as 'unboxed' closures.
- Traits now support associated types, allowing families of related types to be defined together and used generically in powerful ways.
- Enum variants are namespaced by their type names.
whereclauses provide a more versatile and attractive syntax for specifying generic bounds, though the previous syntax remains valid.- Rust again picks a fallback (either i32 or f64) for uninferred numeric types.
- Rust no longer has a runtime of any description, and only supports OS threads, not green threads.
- At long last, Rust has been overhauled for 'dynamically-sized
types' (DST), which integrates 'fat pointers' (object types,
arrays, and
str) more deeply into the type system, making it more consistent. - Rust now has a general range syntax,
i..j,i.., and..jthat produce range types and which, when combined with theIndexoperator and multidispatch, leads to a convenient slice notation,[i..j]. - The new range syntax revealed an ambiguity in the fixed-length
array syntax, so now fixed length arrays are written
[T; N]. - The
Copytrait is no longer implemented automatically. Unsafe pointers no longer implementSyncandSendso types containing them don't automatically either.SyncandSendare now 'unsafe traits' so one can "forcibly" implement them viaunsafe implif a type confirms to the requirements for them even though the internals do not (e.g. structs containing unsafe pointers likeArc). These changes are intended to prevent some footguns and are collectively known as opt-in built-in traits (thoughSyncandSendwill soon become pure library types unknown to the compiler). - Operator traits now take their operands by value, and
comparison traits can use multidispatch to compare one type
against multiple other types, allowing e.g.
Stringto be compared with&str. if letandwhile letare no longer feature-gated.- Rust has adopted a more uniform syntax for escaping unicode characters.
macro_rules!has been declared stable. Though it is a flawed system it is sufficiently popular that it must be usable for 1.0. Effort has gone into future-proofing it in ways that will allow other macro systems to be developed in parallel, and won't otherwise impact the evolution of the language.- The prelude has been pared back significantly such that it is the minimum necessary to support the most pervasive code patterns, and through generalized where clauses many of the prelude extension traits have been consolidated.
- Rust's rudimentary reflection has been removed, as it incurred too much code generation for little benefit.
- Struct variants are no longer feature-gated.
- Trait bounds can be polymorphic over lifetimes. Also known as 'higher-ranked trait bounds', this crucially allows unboxed closures to work.
- Macros invocations surrounded by parens or square brackets and
not terminated by a semicolon are parsed as
expressions, which makes expressions like
vec![1i32, 2, 3].len()work as expected. - Trait objects now implement their traits automatically, and traits that can be coerced to objects now must be object safe.
- Automatically deriving traits is now done with
#[derive(...)]not#[deriving(...)]for consistency with other naming conventions. - Importing the containing module or enum at the same time as
items or variants they contain is now done with
selfinstead ofmod, as in usefoo::{self, bar} - Glob imports are no longer feature-gated.
- The
boxoperator andboxpatterns have been feature-gated pending a redesign. For now unique boxes should be allocated like other containers, withBox::new.
-
Libraries
- A series of efforts to establish conventions for collections types has resulted in API improvements throughout the standard library.
- New APIs for error handling provide ergonomic interop between error types, and new conventions describe more clearly the recommended error handling strategies in Rust.
- The
fail!macro has been renamed topanic!so that it is easier to discuss failure in the context of error handling without making clarifications as to whether you are referring to the 'fail' macro or failure more generally. - On Linux,
OsRngprefers the new, more reliablegetrandomsyscall when available. - The 'serialize' crate has been renamed 'rustc-serialize' and moved out of the distribution to Cargo. Although it is widely used now, it is expected to be superseded in the near future.
- The
Showformatter, typically implemented with#[derive(Show)]is now requested with the{:?}specifier and is intended for use by all types, for uses such asprintln!debugging. The newStringformatter must be implemented by hand, uses the{}specifier, and is intended for full-fidelity conversions of things that can logically be represented as strings.
-
Tooling
- Flexible target specification allows rustc's code generation to be configured to support otherwise-unsupported platforms.
- Rust comes with rust-gdb and rust-lldb scripts that launch their respective debuggers with Rust-appropriate pretty-printing.
- The Windows installation of Rust is distributed with the MinGW components currently required to link binaries on that platform.
-
Misc
- Nullable enum optimizations have been extended to more types so
that e.g.
Option<Vec<T>>andOption<String>take up no more space than the inner types themselves. - Work has begun on supporting AArch64.
- Nullable enum optimizations have been extended to more types so
that e.g.
Version 0.12.0 (2014-10-09)
-
~1900 changes, numerous bugfixes
-
Highlights
- The introductory documentation (now called The Rust Guide) has been completely rewritten, as have a number of supplementary guides.
- Rust's package manager, Cargo, continues to improve and is sometimes considered to be quite awesome.
- Many API's in
stdhave been reviewed and updated for consistency with the in-development Rust coding guidelines. The standard library documentation tracks stabilization progress. - Minor libraries have been moved out-of-tree to the rust-lang org on GitHub: uuid, semver, glob, num, hexfloat, fourcc. They can be installed with Cargo.
- Lifetime elision allows lifetime annotations to be left off of function declarations in many common scenarios.
- Rust now works on 64-bit Windows.
-
Language
- Indexing can be overloaded with the
IndexandIndexMuttraits. - The
if letconstruct takes a branch only if theletpattern matches, currently behind the 'if_let' feature gate. - 'where clauses', a more flexible syntax for specifying trait bounds that is more aesthetic, have been added for traits and free functions. Where clauses will in the future make it possible to constrain associated types, which would be impossible with the existing syntax.
- A new slicing syntax (e.g.
[0..4]) has been introduced behind the 'slicing_syntax' feature gate, and can be overloaded with theSliceorSliceMuttraits. - The syntax for matching of sub-slices has been changed to use a
postfix
..instead of prefix (.e.g.[a, b, c..]), for consistency with other uses of..and to future-proof potential additional uses of the syntax. - The syntax for matching inclusive ranges in patterns has changed
from
0..3to0...4to be consistent with the exclusive range syntax for slicing. - Matching of sub-slices in non-tail positions (e.g.
[a.., b, c]) has been put behind the 'advanced_slice_patterns' feature gate and may be removed in the future. - Components of tuples and tuple structs can be extracted using
the
value.0syntax, currently behind thetuple_indexingfeature gate. - The
#[crate_id]attribute is no longer supported; versioning is handled by the package manager. - Renaming crate imports are now written
extern crate foo as barinstead ofextern crate bar = foo. - Renaming use statements are now written
use foo as barinstead ofuse bar = foo. letandmatchbindings and argument names in macros are now hygienic.- The new, more efficient, closure types ('unboxed closures') have been added under a feature gate, 'unboxed_closures'. These will soon replace the existing closure types, once higher-ranked trait lifetimes are added to the language.
movehas been added as a keyword, for indicating closures that capture by value.- Mutation and assignment is no longer allowed in pattern guards.
- Generic structs and enums can now have trait bounds.
- The
Sharetrait is now calledSyncto free up the term 'shared' to refer to 'shared reference' (the default reference type. - Dynamically-sized types have been mostly implemented, unifying the behavior of fat-pointer types with the rest of the type system.
- As part of dynamically-sized types, the
Sizedtrait has been introduced, which qualifying types implement by default, and which type parameters expect by default. To specify that a type parameter does not need to be sized, write<Sized? T>. Most types areSized, notable exceptions being unsized arrays ([T]) and trait types. - Closures can return
!, as in|| -> !orproc() -> !. - Lifetime bounds can now be applied to type parameters and object types.
- The old, reference counted GC type,
Gc<T>which was once denoted by the@sigil, has finally been removed. GC will be revisited in the future.
- Indexing can be overloaded with the
-
Libraries
- Library documentation has been improved for a number of modules.
- Bit-vectors, collections::bitv has been modernized.
- The url crate is deprecated in favor of http://github.com/servo/rust-url, which can be installed with Cargo.
- Most I/O stream types can be cloned and subsequently closed from a different thread.
- A
std::time::Durationtype has been added for use in I/O methods that rely on timers, as well as in the 'time' crate'sTimespecarithmetic. - The runtime I/O abstraction layer that enabled the green thread scheduler to do non-thread-blocking I/O has been removed, along with the libuv-based implementation employed by the green thread scheduler. This will greatly simplify the future I/O work.
collections::btreehas been rewritten to have a more idiomatic and efficient design.
-
Tooling
- rustdoc output now indicates the stability levels of API's.
- The
--crate-nameflag can specify the name of the crate being compiled, like#[crate_name]. - The
-C metadataspecifies additional metadata to hash into symbol names, and-C extra-filenamespecifies additional information to put into the output filename, for use by the package manager for versioning. - debug info generation has continued to improve and should be more reliable under both gdb and lldb.
- rustc has experimental support for compiling in parallel
using the
-C codegen-unitsflag. - rustc no longer encodes rpath information into binaries by default.
-
Misc
- Stack usage has been optimized with LLVM lifetime annotations.
- Official Rust binaries on Linux are more compatible with older kernels and distributions, built on CentOS 5.10.
Version 0.11.0 (2014-07-02)
-
~1700 changes, numerous bugfixes
-
Language
- ~[T] has been removed from the language. This type is superseded by the Vec type.
- ~str has been removed from the language. This type is superseded by the String type.
- ~T has been removed from the language. This type is superseded by the Box type.
- @T has been removed from the language. This type is superseded by the standard library's std::gc::Gc type.
- Struct fields are now all private by default.
- Vector indices and shift amounts are both required to be a
uintinstead of any integral type. - Byte character, byte string, and raw byte string literals are now all
supported by prefixing the normal literal with a
b. - Multiple ABIs are no longer allowed in an ABI string
- The syntax for lifetimes on closures/procedures has been tweaked
slightly:
<'a>|A, B|: 'b + K -> T - Floating point modulus has been removed from the language; however it is still provided by a library implementation.
- Private enum variants are now disallowed.
- The
privkeyword has been removed from the language. - A closure can no longer be invoked through a &-pointer.
- The
use foo, bar, baz;syntax has been removed from the language. - The transmute intrinsic no longer works on type parameters.
- Statics now allow blocks/items in their definition.
- Trait bounds are separated from objects with + instead of : now.
- Objects can no longer be read while they are mutably borrowed.
- The address of a static is now marked as insignificant unless the #[inline(never)] attribute is placed it.
- The #[unsafe_destructor] attribute is now behind a feature gate.
- Struct literals are no longer allowed in ambiguous positions such as if, while, match, and for..in.
- Declaration of lang items and intrinsics are now feature-gated by default.
- Integral literals no longer default to
int, and floating point literals no longer default tof64. Literals must be suffixed with an appropriate type if inference cannot determine the type of the literal. - The Box type is no longer implicitly borrowed to &mut T.
- Procedures are now required to not capture borrowed references.
-
Libraries
- The standard library is now a "facade" over a number of underlying libraries. This means that development on the standard library should be speedier due to smaller crates, as well as a clearer line between all dependencies.
- A new library, libcore, lives under the standard library's facade which is Rust's "0-assumption" library, suitable for embedded and kernel development for example.
- A regex crate has been added to the standard distribution. This crate includes statically compiled regular expressions.
- The unwrap/unwrap_err methods on Result require a Show bound for better error messages.
- The return types of the std::comm primitives have been centralized around the Result type.
- A number of I/O primitives have gained the ability to time out their operations.
- A number of I/O primitives have gained the ability to close their reading/writing halves to cancel pending operations.
- Reverse iterator methods have been removed in favor of
rev()on their forward-iteration counterparts. - A bitflags! macro has been added to enable easy interop with C and management of bit flags.
- A debug_assert! macro is now provided which is disabled when
--cfg ndebugis passed to the compiler. - A graphviz crate has been added for creating .dot files.
- The std::cast module has been migrated into std::mem.
- The std::local_data api has been migrated from freestanding functions to being based on methods.
- The Pod trait has been renamed to Copy.
- jemalloc has been added as the default allocator for types.
- The API for allocating memory has been changed to use proper alignment and sized deallocation
- Connecting a TcpStream or binding a TcpListener is now based on a string address and a u16 port. This allows connecting to a hostname as opposed to an IP.
- The Reader trait now contains a core method, read_at_least(), which correctly handles many repeated 0-length reads.
- The process-spawning API is now centered around a builder-style Command struct.
- The :? printing qualifier has been moved from the standard library to an external libdebug crate.
- Eq/Ord have been renamed to PartialEq/PartialOrd. TotalEq/TotalOrd have been renamed to Eq/Ord.
- The select/plural methods have been removed from format!. The escapes for { and } have also changed from { and } to {{ and }}, respectively.
- The TaskBuilder API has been re-worked to be a true builder, and extension traits for spawning native/green tasks have been added.
-
Tooling
- All breaking changes to the language or libraries now have their
commit message annotated with
[breaking-change]to allow for easy discovery of breaking changes. - The compiler will now try to suggest how to annotate lifetimes if a lifetime-related error occurs.
- Debug info continues to be improved greatly with general bug fixes and better support for situations like link time optimization (LTO).
- Usage of syntax extensions when cross-compiling has been fixed.
- Functionality equivalent to GCC & Clang's -ffunction-sections, -fdata-sections and --gc-sections has been enabled by default
- The compiler is now stricter about where it will load module files
from when a module is declared via
mod foo;. - The #[phase(syntax)] attribute has been renamed to #[phase(plugin)]. Syntax extensions are now discovered via a "plugin registrar" type which will be extended in the future to other various plugins.
- Lints have been restructured to allow for dynamically loadable lints.
- A number of rustdoc improvements:
- The HTML output has been visually redesigned.
- Markdown is now powered by hoedown instead of sundown.
- Searching heuristics have been greatly improved.
- The search index has been reduced in size by a great amount.
- Cross-crate documentation via
pub usehas been greatly improved. - Primitive types are now hyperlinked and documented.
- Documentation has been moved from static.rust-lang.org/doc to doc.rust-lang.org
- A new sandbox, play.rust-lang.org, is available for running and sharing rust code examples on-line.
- Unused attributes are now more robustly warned about.
- The dead_code lint now warns about unused struct fields.
- Cross-compiling to iOS is now supported.
- Cross-compiling to mipsel is now supported.
- Stability attributes are now inherited by default and no longer apply to intra-crate usage, only inter-crate usage.
- Error message related to non-exhaustive match expressions have been greatly improved.
- All breaking changes to the language or libraries now have their
commit message annotated with
Version 0.10 (2014-04-03)
-
~1500 changes, numerous bugfixes
-
Language
- A new RFC process is now in place for modifying the language.
- Patterns with
@-pointers have been removed from the language. - Patterns with unique vectors (
~[T]) have been removed from the language. - Patterns with unique strings (
~str) have been removed from the language. @strhas been removed from the language.@[T]has been removed from the language.@selfhas been removed from the language.@Traithas been removed from the language.- Headers on
~allocations which contain@boxes inside the type for reference counting have been removed. - The semantics around the lifetimes of temporary expressions have changed, see #3511 and #11585 for more information.
- Cross-crate syntax extensions are now possible, but feature gated. See
#11151 for more information. This includes both
macro_rules!macros as well as syntax extensions such asformat!. - New lint modes have been added, and older ones have been turned on to be
warn-by-default.
- Unnecessary parentheses
- Uppercase statics
- Camel Case types
- Uppercase variables
- Publicly visible private types
#[deriving]with raw pointers
- Unsafe functions can no longer be coerced to closures.
- Various obscure macros such as
log_syntax!are now behind feature gates. - The
#[simd]attribute is now behind a feature gate. - Visibility is no longer allowed on
extern cratestatements, and unnecessary visibility (priv) is no longer allowed onusestatements. - Trailing commas are now allowed in argument lists and tuple patterns.
- The
dokeyword has been removed, it is now a reserved keyword. - Default type parameters have been implemented, but are feature gated.
- Borrowed variables through captures in closures are now considered soundly.
extern modis nowextern crate- The
Freezetrait has been removed. - The
Sharetrait has been added for types that can be shared among threads. - Labels in macros are now hygienic.
- Expression/statement macro invocations can be delimited with
{}now. - Treatment of types allowed in
static mutlocations has been tweaked. - The
*and.operators are now overloadable through theDerefandDerefMuttraits. ~Traitandprocno longer haveSendbounds by default.- Partial type hints are now supported with the
_type marker. - An
Unsafetype was introduced for interior mutability. It is now considered undefined to transmute from&Tto&mut Twithout using theUnsafetype. - The #[linkage] attribute was implemented for extern statics/functions.
- The inner attribute syntax has changed from
#[foo];to#![foo]. Podwas renamed toCopy.
-
Libraries
- The
libextralibrary has been removed. It has now been decomposed into component libraries with smaller and more focused nuggets of functionality. The full list of libraries can be found on the documentation index page. - std:
std::conditionhas been removed. All I/O errors are now propagated through theResulttype. In order to assist with error handling, atry!macro for unwrapping errors with an early return and a lint for unused results has been added. See #12039 for more information. - std: The
vecmodule has been renamed toslice. - std: A new vector type,
Vec<T>, has been added in preparation for DST. This will become the only growable vector in the future. - std:
std::ionow has more public re-exports. Types such asBufferedReaderare now found atstd::io::BufferedReaderinstead ofstd::io::buffered::BufferedReader. - std:
printandprintlnare no longer in the prelude, theprint!andprintln!macros are intended to be used instead. - std:
Rcnow has aWeakpointer for breaking cycles, and it no longer attempts to statically prevent cycles. - std: The standard distribution is adopting the policy of pushing failure
to the user rather than failing in libraries. Many functions (such as
slice::last()) now returnOption<T>instead ofT+ failing. - std:
fmt::Defaulthas been renamed tofmt::Show, and it now has a new deriving mode:#[deriving(Show)]. - std:
ToStris now implemented for all types implementingShow. - std: The formatting trait methods now take
&selfinstead of&T - std: The
invert()method on iterators has been renamed torev() - std:
std::numhas seen a reduction in the genericity of its traits, consolidating functionality into a few core traits. - std: Backtraces are now printed on task failure if the environment
variable
RUST_BACKTRACEis present. - std: Naming conventions for iterators have been standardized. More details can be found on the wiki's style guide.
- std:
eof()has been removed from theReadertrait. Specific types may still implement the function. - std: Networking types are now cloneable to allow simultaneous reads/writes.
- std:
assert_approx_eq!has been removed - std: The
eandEformatting specifiers for floats have been added to print them in exponential notation. - std: The
Timestrait has been removed - std: Indications of variance and opting out of builtin bounds is done
through marker types in
std::kinds::markernow - std:
hashhas been rewritten,IterByteshas been removed, and#[deriving(Hash)]is now possible. - std:
SharedChanhas been removed,Senderis now cloneable. - std:
ChanandPortwere renamed toSenderandReceiver. - std:
Chan::newis nowchannel(). - std: A new synchronous channel type has been implemented.
- std: A
select!macro is now provided for selecting overReceivers. - std:
hashmapandtriehave been moved tolibcollections - std:
runhas been rolled intoio::process - std:
assert_eq!now uses{}instead of{:?} - std: The equality and comparison traits have seen some reorganization.
- std:
randhas moved tolibrand. - std:
to_{lower,upper}casehas been implemented forchar. - std: Logging has been moved to
liblog. - collections:
HashMaphas been rewritten for higher performance and less memory usage. - native: The default runtime is now
libnative. Iflibgreenis desired, it can be booted manually. The runtime guide has more information and examples. - native: All I/O functionality except signals has been implemented.
- green: Task spawning with
libgreenhas been optimized with stack caching and various trimming of code. - green: Tasks spawned by
libgreennow have an unmapped guard page. - sync: The
extra::syncmodule has been updated to modern rust (and moved to thesynclibrary), tweaking and improving various interfaces while dropping redundant functionality. - sync: A new
Barriertype has been added to thesynclibrary. - sync: An efficient mutex for native and green tasks has been implemented.
- serialize: The
base64module has seen some improvement. It treats newlines better, has non-string error values, and has seen general cleanup. - fourcc: A
fourcc!macro was introduced - hexfloat: A
hexfloat!macro was implemented for specifying floats via a hexadecimal literal.
- The
-
Tooling
rustpkghas been deprecated and removed from the main repository. Its replacement,cargo, is under development.- Nightly builds of rust are now available
- The memory usage of rustc has been improved many times throughout this release cycle.
- The build process supports disabling rpath support for the rustc binary itself.
- Code generation has improved in some cases, giving more information to the LLVM optimization passes to enable more extensive optimizations.
- Debuginfo compatibility with lldb on OSX has been restored.
- The master branch is now gated on an android bot, making building for android much more reliable.
- Output flags have been centralized into one
--emitflag. - Crate type flags have been centralized into one
--crate-typeflag. - Codegen flags have been consolidated behind a
-Cflag. - Linking against outdated crates now has improved error messages.
- Error messages with lifetimes will often suggest how to annotate the function to fix the error.
- Many more types are documented in the standard library, and new guides were written.
- Many
rustdocimprovements:- code blocks are syntax highlighted.
- render standalone markdown files.
- the --test flag tests all code blocks by default.
- exported macros are displayed.
- re-exported types have their documentation inlined at the location of the first re-export.
- search works across crates that have been rendered to the same output directory.
Version 0.9 (2014-01-09)
-
~1800 changes, numerous bugfixes
-
Language
- The
floattype has been removed. Usef32orf64instead. - A new facility for enabling experimental features (feature gating) has
been added, using the crate-level
#[feature(foo)]attribute. - Managed boxes (@) are now behind a feature gate
(
#[feature(managed_boxes)]) in preparation for future removal. Use the standard library'sGcorRctypes instead. @muthas been removed. Usestd::cell::{Cell, RefCell}instead.- Jumping back to the top of a loop is now done with
continueinstead ofloop. - Strings can no longer be mutated through index assignment.
- Raw strings can be created via the basic
r"foo"syntax or with matched hash delimiters, as inr###"foo"###. ~fnis now writtenproc (args) -> retval { ... }and may only be called once.- The
&fntype is now written|args| -> retto match the literal form. @fns have been removed.doonly works with procs in order to make it obvious what the cost ofdois.- Single-element tuple-like structs can no longer be dereferenced to obtain the inner value. A more comprehensive solution for overloading the dereference operator will be provided in the future.
- The
#[link(...)]attribute has been replaced with#[crate_id = "name#vers"]. - Empty
impls must be terminated with empty braces and may not be terminated with a semicolon. - Keywords are no longer allowed as lifetime names; the
selflifetime no longer has any special meaning. - The old
fmt!string formatting macro has been removed. printf!andprintfln!(old-style formatting) removed in favor ofprint!andprintln!.mutworks in patterns now, as inlet (mut x, y) = (1, 2);.- The
extern mod foo (name = "bar")syntax has been removed. Useextern mod foo = "bar"instead. - New reserved keywords:
alignof,offsetof,sizeof. - Macros can have attributes.
- Macros can expand to items with attributes.
- Macros can expand to multiple items.
- The
asm!macro is feature-gated (#[feature(asm)]). - Comments may be nested.
- Values automatically coerce to trait objects they implement, without
an explicit
as. - Enum discriminants are no longer an entire word but as small as needed to
contain all the variants. The
reprattribute can be used to override the discriminant size, as in#[repr(int)]for integer-sized, and#[repr(C)]to match C enums. - Non-string literals are not allowed in attributes (they never worked).
- The FFI now supports variadic functions.
- Octal numeric literals, as in
0o7777. - The
concat!syntax extension performs compile-time string concatenation. - The
#[fixed_stack_segment]and#[rust_stack]attributes have been removed as Rust no longer uses segmented stacks. - Non-ascii identifiers are feature-gated (
#[feature(non_ascii_idents)]). - Ignoring all fields of an enum variant or tuple-struct is done with
.., not*; ignoring remaining fields of a struct is also done with.., not_; ignoring a slice of a vector is done with.., not.._. rustcsupports the "win64" calling convention viaextern "win64".rustcsupports the "system" calling convention, which defaults to the preferred convention for the target platform, "stdcall" on 32-bit Windows, "C" elsewhere.- The
type_overflowlint (default: warn) checks literals for overflow. - The
unsafe_blocklint (default: allow) checks for usage ofunsafe. - The
attribute_usagelint (default: warn) warns about unknown attributes. - The
unknown_featureslint (default: warn) warns about unknown feature gates. - The
dead_codelint (default: warn) checks for dead code. - Rust libraries can be linked statically to one another
#[link_args]is behind thelink_argsfeature gate.- Native libraries are now linked with
#[link(name = "foo")] - Native libraries can be statically linked to a rust crate
(
#[link(name = "foo", kind = "static")]). - Native OS X frameworks are now officially supported
(
#[link(name = "foo", kind = "framework")]). - The
#[thread_local]attribute creates thread-local (not task-local) variables. Currently behind thethread_localfeature gate. - The
returnkeyword may be used in closures. - Types that can be copied via a memcpy implement the
Podkind. - The
cfgattribute can now be used on struct fields and enum variants.
- The
-
Libraries
- std: The
optionandresultAPI's have been overhauled to make them simpler, more consistent, and more composable. - std: The entire
std::iomodule has been replaced with one that is more comprehensive and that properly interfaces with the underlying scheduler. File, TCP, UDP, Unix sockets, pipes, and timers are all implemented. - std:
io::utilcontains a number of useful implementations ofReaderandWriter, includingNullReader,NullWriter,ZeroReader,TeeReader. - std: The reference counted pointer type
extra::rcmoved into std. - std: The
Gctype in thegcmodule will replace@(it is currently just a wrapper around it). - std: The
Eithertype has been removed. - std:
fmt::Defaultcan be implemented for any type to provide default formatting to theformat!macro, as informat!("{}", myfoo). - std: The
randAPI continues to be tweaked. - std: The
rust_begin_unwindfunction, useful for inserting breakpoints on failure in gdb, is now namedrust_fail. - std: The
each_keyandeach_valuemethods onHashMaphave been replaced by thekeysandvaluesiterators. - std: Functions dealing with type size and alignment have moved from the
sysmodule to thememmodule. - std: The
pathmodule was written and API changed. - std:
str::from_utf8has been changed to cast instead of allocate. - std:
starts_withandends_withmethods added to vectors via theImmutableEqVectortrait, which is in the prelude. - std: Vectors can be indexed with the
get_optmethod, which returnsNoneif the index is out of bounds. - std: Task failure no longer propagates between tasks, as the model was complex, expensive, and incompatible with thread-based tasks.
- std: The
Anytype can be used for dynamic typing. - std:
~Anycan be passed to thefail!macro and retrieved viatask::try. - std: Methods that produce iterators generally do not have an
_itersuffix now. - std:
cell::Cellandcell::RefCellcan be used to introduce mutability roots (mutable fields, etc.). Use instead of e.g.@mut. - std:
util::ignorerenamed toprelude::drop. - std: Slices have
sortandsort_bymethods via theMutableVectortrait. - std:
vec::rawhas seen a lot of cleanup and API changes. - std: The standard library no longer includes any C++ code, and very minimal C, eliminating the dependency on libstdc++.
- std: Runtime scheduling and I/O functionality has been factored out into extensible interfaces and is now implemented by two different crates: libnative, for native threading and I/O; and libgreen, for green threading and I/O. This paves the way for using the standard library in more limited embedded environments.
- std: The
commmodule has been rewritten to be much faster, have a simpler, more consistent API, and to work for both native and green threading. - std: All libuv dependencies have been moved into the rustuv crate.
- native: New implementations of runtime scheduling on top of OS threads.
- native: New native implementations of TCP, UDP, file I/O, process spawning, and other I/O.
- green: The green thread scheduler and message passing types are almost entirely lock-free.
- extra: The
flatpipesmodule had bitrotted and was removed. - extra: All crypto functions have been removed and Rust now has a policy of not reimplementing crypto in the standard library. In the future crypto will be provided by external crates with bindings to established libraries.
- extra:
c_vechas been modernized. - extra: The
sortmodule has been removed. Use thesortmethod on mutable slices.
- std: The
-
Tooling
- The
rustandrusticommands have been removed, due to lack of maintenance. rustdocwas completely rewritten.rustdoccan test code examples in documentation.rustpkgcan test packages with the argument, 'test'.rustpkgsupports arbitrary dependencies, including C libraries.rustc's support for generating debug info is improved again.rustchas better error reporting for unbalanced delimiters.rustc's JIT support was removed due to bitrot.- Executables and static libraries can be built with LTO (-Z lto)
rustcadds a--dep-infoflag for communicating dependencies to build tools.
- The
Version 0.8 (2013-09-26)
-
~2200 changes, numerous bugfixes
-
Language
- The
forloop syntax has changed to work with theIteratortrait. - At long last, unwinding works on Windows.
- Default methods are ready for use.
- Many trait inheritance bugs fixed.
- Owned and borrowed trait objects work more reliably.
copyis no longer a keyword. It has been replaced by theClonetrait.- rustc can omit emission of code for the
debug!macro if it is passed--cfg ndebug - mod.rs is now "blessed". When loading
mod foo;, rustc will now look for foo.rs, then foo/mod.rs, and will generate an error when both are present. - Strings no longer contain trailing nulls. The new
std::c_strmodule provides new mechanisms for converting to C strings. - The type of foreign functions is now
extern "C" fninstead of `*u8'. - The FFI has been overhauled such that foreign functions are called directly, instead of through a stack-switching wrapper.
- Calling a foreign function must be done through a Rust function with the
#[fixed_stack_segment]attribute. - The
externfn!macro can be used to declare both a foreign function and a#[fixed_stack_segment]wrapper at once. pubandprivmodifiers onexternblocks are no longer parsed.unsafeis no longer allowed on extern fns - they are all unsafe.privis disallowed everywhere except for struct fields and enum variants.&T(besides&'static T) is no longer allowed in@T.refbindings in irrefutable patterns work correctly now.charis now prevented from containing invalid code points.- Casting to
boolis no longer allowed. \0is now accepted as an escape in chars and strings.yieldis a reserved keyword.typeofis a reserved keyword.- Crates may be imported by URL with
extern mod foo = "url";. - Explicit enum discriminants may be given as uints as in
enum E { V = 0u } - Static vectors can be initialized with repeating elements,
e.g.
static foo: [u8, .. 100]: [0, .. 100];. - Static structs can be initialized with functional record update,
e.g.
static foo: Foo = Foo { a: 5, .. bar };. cfg!can be used to conditionally execute code based on the crate configuration, similarly to#[cfg(...)].- The
unnecessary_qualificationlint detects unneeded module prefixes (default: allow). - Arithmetic operations have been implemented on the SIMD types in
std::unstable::simd. - Exchange allocation headers were removed, reducing memory usage.
format!implements a completely new, extensible, and higher-performance string formatting system. It will replacefmt!.print!andprintln!write formatted strings (using theformat!extension) to stdout.write!andwriteln!write formatted strings (using theformat!extension) to the new Writers instd::rt::io.- The library section in which a function or static is placed may
be specified with
#[link_section = "..."]. - The
proto!syntax extension for defining bounded message protocols was removed. macro_rules!is hygienic forletdeclarations.- The
#[export_name]attribute specifies the name of a symbol. unreachable!can be used to indicate unreachable code, and fails if executed.
- The
-
Libraries
- std: Transitioned to the new runtime, written in Rust.
- std: Added an experimental I/O library,
rt::io, based on the new runtime. - std: A new generic
rangefunction was added to the prelude, replacinguint::rangeand friends. - std:
range_revno longer exists. Since range is an iterator it can be reversed withrange(lo, hi).invert(). - std: The
chainmethod on option renamed toand_then;unwrap_or_defaultrenamed tounwrap_or. - std: The
iteratormodule was renamed toiter. - std: Integral types now support the
checked_add,checked_sub, andchecked_muloperations for detecting overflow. - std: Many methods in
str,vec,option,result` were renamed for consistency. - std: Methods are standardizing on conventions for casting methods:
to_foofor copying,into_foofor moving,as_foofor temporary and cheap casts. - std: The
CStringtype inc_strprovides new ways to convert to and from C strings. - std:
DoubleEndedIteratorcan yield elements in two directions. - std: The
mut_splitmethod on vectors partitions an&mut [T]into two splices. - std:
str::from_bytesrenamed tostr::from_utf8. - std:
pop_optandshift_optmethods added to vectors. - std: The task-local data interface no longer uses @, and keys are no longer function pointers.
- std: The
swap_unwrapmethod ofOptionrenamed totake_unwrap. - std: Added
SharedPorttocomm. - std:
Eqhas a default method forne; onlyeqis required in implementations. - std:
Ordhas default methods forle,gtandge; onlyltis required in implementations. - std:
is_utf8performance is improved, impacting many string functions. - std:
os::MemoryMapprovides cross-platform mmap. - std:
ptr::offsetis now unsafe, but also more optimized. Offsets that are not 'in-bounds' are considered undefined. - std: Many freestanding functions in
vecremoved in favor of methods. - std: Many freestanding functions on scalar types removed in favor of methods.
- std: Many options to task builders were removed since they don't make sense in the new scheduler design.
- std: More containers implement
FromIteratorso can be created by thecollectmethod. - std: More complete atomic types in
unstable::atomics. - std:
comm::PortSetremoved. - std: Mutating methods in the
SetandMaptraits have been moved into theMutableSetandMutableMaptraits.Container::is_empty,Map::contains_key,MutableMap::insert, andMutableMap::removehave default implementations. - std: Various
from_strfunctions were removed in favor of a genericfrom_strwhich is available in the prelude. - std:
util::unreachableremoved in favor of theunreachable!macro. - extra:
dlist, the doubly-linked list was modernized. - extra: Added a
hexmodule withToHexandFromHextraits. - extra: Added
globmodule, replacingstd::os::glob. - extra:
ropewas removed. - extra:
dequewas renamed toringbuf.RingBufimplementsDeque. - extra:
net, andtimerwere removed. The experimental replacements arestd::rt::io::netandstd::rt::io::timer. - extra: Iterators implemented for
SmallIntMap. - extra: Iterators implemented for
BitvandBitvSet. - extra:
SmallIntSetremoved. UseBitvSet. - extra: Performance of JSON parsing greatly improved.
- extra:
semverupdated to SemVer 2.0.0. - extra:
termhandles more terminals correctly. - extra:
dbgmodule removed. - extra:
parmodule removed. - extra:
futurewas cleaned up, with some method renames. - extra: Most free functions in
getoptswere converted to methods.
-
Other
- rustc's debug info generation (
-Z debug-info) is greatly improved. - rustc accepts
--target-cputo compile to a specific CPU architecture, similarly to gcc's--marchflag. - rustc's performance compiling small crates is much better.
- rustpkg has received many improvements.
- rustpkg supports git tags as package IDs.
- rustpkg builds into target-specific directories so it can be used for cross-compiling.
- The number of concurrent test tasks is controlled by the environment variable RUST_TEST_TASKS.
- The test harness can now report metrics for benchmarks.
- All tools have man pages.
- Programs compiled with
--testnow support the-hand--helpflags. - The runtime uses jemalloc for allocations.
- Segmented stacks are temporarily disabled as part of the transition to the new runtime. Stack overflows are possible!
- A new documentation backend, rustdoc_ng, is available for use. It is
still invoked through the normal
rustdoccommand.
- rustc's debug info generation (
Version 0.7 (2013-07-03)
-
~2000 changes, numerous bugfixes
-
Language
impls no longer accept a visibility qualifier. Put them on methods instead.- The borrow checker has been rewritten with flow-sensitivity, fixing many bugs and inconveniences.
- The
selfparameter no longer implicitly means&'self self, and can be explicitly marked with a lifetime. - Overloadable compound operators (
+=, etc.) have been temporarily removed due to bugs. - The
forloop protocol now requiresfor-iterators to returnboolso they compose better. - The
Durabletrait is replaced with the'staticbounds. - Trait default methods work more often.
- Structs with the
#[packed]attribute have byte alignment and no padding between fields. - Type parameters bound by
Copymust now be copied explicitly with thecopykeyword. - It is now illegal to move out of a dereferenced unsafe pointer.
Option<~T>is now represented as a nullable pointer.@mutdoes dynamic borrow checks correctly.- The
mainfunction is only detected at the topmost level of the crate. The#[main]attribute is still valid anywhere. - Struct fields may no longer be mutable. Use inherited mutability.
- The
#[no_send]attribute makes a type that would otherwise beSend, not. - The
#[no_freeze]attribute makes a type that would otherwise beFreeze, not. - Unbounded recursion will abort the process after reaching the limit
specified by the
RUST_MAX_STACKenvironment variable (default: 1GB). - The
vecs_implicitly_copyablelint mode has been removed. Vectors are never implicitly copyable. #[static_assert]makes compile-time assertions about static bools.- At long last, 'argument modes' no longer exist.
- The rarely used
use modstatement no longer exists.
-
Syntax extensions
fail!andassert!accept~str,&'static strorfmt!-style argument list.Encodable,Decodable,Ord,TotalOrd,TotalEq,DeepClone,Rand,ZeroandToStrcan all be automatically derived with#[deriving(...)].- The
bytes!macro returns a vector of bytes for string, u8, char, and unsuffixed integer literals.
-
Libraries
- The
corecrate was renamed tostd. - The
stdcrate was renamed toextra. - More and improved documentation.
- std:
iteratormodule for external iterator objects. - Many old-style (internal, higher-order function) iterators replaced by
implementations of
Iterator. - std: Many old internal vector and string iterators,
incl.
any,all. removed. - std: The
finalizemethod ofDroprenamed todrop. - std: The
dropmethod now takes&mut selfinstead of&self. - std: The prelude no longer re-exports any modules, only types and traits.
- std: Prelude additions:
print,println,FromStr,ApproxEq,Equiv,Iterator,IteratorUtil, many numeric traits, many tuple traits. - std: New numeric traits:
Fractional,Real,RealExt,Integer,Ratio,Algebraic,Trigonometric,Exponential,Primitive. - std: Tuple traits and accessors defined for up to 12-tuples, e.g.
(0, 1, 2).n2()or(0, 1, 2).n2_ref(). - std: Many types implement
Clone. - std:
pathtype renamed toPath. - std:
mutmodule andMuttype removed. - std: Many standalone functions removed in favor of methods and iterators
in
vec,str. In the future methods will also work as functions. - std:
reinterpret_castremoved. Usetransmute. - std: ascii string handling in
std::ascii. - std:
Randis implemented for ~/@. - std:
runmodule for spawning processes overhauled. - std: Various atomic types added to
unstable::atomic. - std: Various types implement
Zero. - std:
LinearMapandLinearSetrenamed toHashMapandHashSet. - std: Borrowed pointer functions moved from
ptrtoborrow. - std: Added
os::mkdir_recursive. - std: Added
os::globfunction performs filesystems globs. - std:
FuzzyEqrenamed toApproxEq. - std:
Mapnow definespopandswapmethods. - std:
Cellconstructors converted to static methods. - extra:
rcmodule adds the reference counted pointers,RcandRcMut. - extra:
flatemodule moved fromstdtoextra. - extra:
fileinputmodule for iterating over a series of files. - extra:
Complexnumber type andcomplexmodule. - extra:
Rationalnumber type andrationalmodule. - extra:
BigInt,BigUintimplement numeric and comparison traits. - extra:
termuses terminfo now, is more correct. - extra:
arcfunctions converted to methods. - extra: Implementation of fixed output size variations of SHA-2.
- The
-
Tooling
unused_variableslint mode for unused variables (default: warn).unused_unsafelint mode for detecting unnecessaryunsafeblocks (default: warn).unused_mutlint mode for identifying unusedmutqualifiers (default: warn).dead_assignmentlint mode for unread variables (default: warn).unnecessary_allocationlint mode detects some heap allocations that are immediately borrowed so could be written without allocating (default: warn).missing_doclint mode (default: allow).unreachable_codelint mode (default: warn).- The
rusticommand has been rewritten and a number of bugs addressed. - rustc outputs in color on more terminals.
- rustc accepts a
--link-argsflag to pass arguments to the linker. - rustc accepts a
-Z print-link-argsflag for debugging linkage. - Compiling with
-gwill make the binary record information about dynamic borrowcheck failures for debugging. - rustdoc has a nicer stylesheet.
- Various improvements to rustdoc.
- Improvements to rustpkg (see the detailed release notes).
Version 0.6 (2013-04-03)
-
~2100 changes, numerous bugfixes
-
Syntax changes
- The self type parameter in traits is now spelled
Self - The
selfparameter in trait and impl methods must now be explicitly named (for example:fn f(&self) { }). Implicit self is deprecated. - Static methods no longer require the
statickeyword and instead are distinguished by the lack of aselfparameter - Replaced the
Durabletrait with the'staticlifetime - The old closure type syntax with the trailing sigil has been removed in favor of the more consistent leading sigil
superis a keyword, and may be prefixed to paths- Trait bounds are separated with
+instead of whitespace - Traits are implemented with
impl Trait for Typeinstead ofimpl Type: Trait - Lifetime syntax is now
&'l fooinstead of&l/foo - The
exportkeyword has finally been removed - The
movekeyword has been removed (see "Semantic changes") - The interior mutability qualifier on vectors,
[mut T], has been removed. Use&mut [T], etc. mutis no longer valid in~mut T. Use inherited mutabilityfailis no longer a keyword. Usefail!()assertis no longer a keyword. Useassert!()logis no longer a keyword. usedebug!, etc.- 1-tuples may be represented as
(T,) - Struct fields may no longer be
mut. Use inherited mutability,@mut T,core::mutorcore::cell extern mod { ... }is no longer valid syntax for foreign function modules. Use extern blocks:extern { ... }- Newtype enums removed. Use tuple-structs.
- Trait implementations no longer support visibility modifiers
- Pattern matching over vectors improved and expanded
constrenamed tostaticto correspond to lifetime name, and make room for futurestatic mutunsafe mutable globals.- Replaced
#[deriving_eq]with#[deriving(Eq)], etc. Cloneimplementations can be automatically generated with#[deriving(Clone)]- Casts to traits must use a pointer sigil, e.g.
@foo as @Barinstead offoo as Bar. - Fixed length vector types are now written as
[int, .. 3]instead of[int * 3]. - Fixed length vector types can express the length as a constant
expression. (ex:
[int, .. GL_BUFFER_SIZE - 2])
- The self type parameter in traits is now spelled
-
Semantic changes
- Types with owned pointers or custom destructors move by default,
eliminating the
movekeyword - All foreign functions are considered unsafe
- &mut is now unaliasable
- Writes to borrowed @mut pointers are prevented dynamically
- () has size 0
- The name of the main function can be customized using #[main]
- The default type of an inferred closure is &fn instead of @fn
usestatements may no longer be "chained" - they cannot import identifiers imported by previoususestatementsusestatements are crate relative, importing from the "top" of the crate by default. Paths may be prefixed withsuper::orself::to change the search behavior.- Method visibility is inherited from the implementation declaration
- Structural records have been removed
- Many more types can be used in static items, including enums 'static-lifetime pointers and vectors
- Pattern matching over vectors improved and expanded
- Typechecking of closure types has been overhauled to improve inference and eliminate unsoundness
- Macros leave scope at the end of modules, unless that module is tagged with #[macro_escape]
- Types with owned pointers or custom destructors move by default,
eliminating the
-
Libraries
- Added big integers to
std::bigint - Removed
core::oldcommmodule - Added pipe-based
core::commmodule - Numeric traits have been reorganized under
core::num vec::slicefinally returns a slicedebug!and friends don't require a format string, e.g.debug!(Foo)- Containers reorganized around traits in
core::container core::dvecremoved,~[T]is a drop-in replacementcore::send_maprenamed tocore::hashmapstd::mapremoved; replaced withcore::hashmapstd::treemapreimplemented as an owned balanced treestd::dequeandstd::smallintmapreimplemented as owned containerscore::trieadded as a fast ordered map for integer keys- Set types added to
core::hashmap,core::trieandstd::treemap Ordsplit intoOrdandTotalOrd.Ordis still used to overload the comparison operators, whereasTotalOrdis used by certain container types
- Added big integers to
-
Other
- Replaced the 'cargo' package manager with 'rustpkg'
- Added all-purpose 'rust' tool
rustc --testnow supports benchmarks with the#[bench]attribute- rustc now attempts to offer spelling suggestions
- Improved support for ARM and Android
- Preliminary MIPS backend
- Improved foreign function ABI implementation for x86, x86_64
- Various memory usage improvements
- Rust code may be embedded in foreign code under limited circumstances
- Inline assembler supported by new asm!() syntax extension.
Version 0.5 (2012-12-21)
-
~900 changes, numerous bugfixes
-
Syntax changes
- Removed
<-move operator - Completed the transition from the
#fmtextension syntax tofmt! - Removed old fixed length vector syntax -
[T]/N - New token-based quasi-quoters,
quote_tokens!,quote_expr!, etc. - Macros may now expand to items and statements
a.b()is always parsed as a method call, never as a field projectionEqandIterBytesimplementations can be automatically generated with#[deriving_eq]and#[deriving_iter_bytes]respectively- Removed the special crate language for
.rcfiles - Function arguments may consist of any irrefutable pattern
- Removed
-
Semantic changes
&and~pointers may point to objects- Tuple structs -
struct Foo(Bar, Baz). Will replace newtype enums. - Enum variants may be structs
- Destructors can be added to all nominal types with the Drop trait
- Structs and nullary enum variants may be constants
- Values that cannot be implicitly copied are now automatically moved
without writing
moveexplicitly &Tmay now be coerced to*T- Coercions happen in
letstatements as well as function calls usestatements now take crate-relative paths- The module and type namespaces have been merged so that static method names can be resolved under the trait in which they are declared
-
Improved support for language features
- Trait inheritance works in many scenarios
- More support for explicit self arguments in methods -
self,&self@self, and~selfall generally work as expected - Static methods work in more situations
- Experimental: Traits may declare default methods for the implementations to use
-
Libraries
- New condition handling system in
core::condition - Timsort added to
std::sort - New priority queue,
std::priority_queue - Pipes for serializable types, `std::flatpipes'
- Serialization overhauled to be trait-based
- Expanded
getoptsdefinitions - Moved futures to
std - More functions are pure now
core::commrenamed tooldcomm. Still deprecatedrustdocandcargoare libraries now
- New condition handling system in
-
Misc
- Added a preliminary REPL,
rusti - License changed from MIT to dual MIT/APL2
- Added a preliminary REPL,
Version 0.4 (2012-10-15)
-
~2000 changes, numerous bugfixes
-
Syntax
- All keywords are now strict and may not be used as identifiers anywhere
- Keyword removal: 'again', 'import', 'check', 'new', 'owned', 'send', 'of', 'with', 'to', 'class'.
- Classes are replaced with simpler structs
- Explicit method self types
retbecamereturnandaltbecamematchimportis nowuse;use is nowextern mod`extern mod { ... }is nowextern { ... }use modis the recommended way to import modulespubandprivreplace deprecated export lists- The syntax of
matchpattern arms now uses fat arrow (=>) mainno longer accepts an args vector; useos::argsinstead
-
Semantics
- Trait implementations are now coherent, ala Haskell typeclasses
- Trait methods may be static
- Argument modes are deprecated
- Borrowed pointers are much more mature and recommended for use
- Strings and vectors in the static region are stored in constant memory
- Typestate was removed
- Resolution rewritten to be more reliable
- Support for 'dual-mode' data structures (freezing and thawing)
-
Libraries
- Most binary operators can now be overloaded via the traits in `core::ops'
std::net::urlfor representing URLs- Sendable hash maps in
core::send_map - `core::task' gained a (currently unsafe) task-local storage API
-
Concurrency
- An efficient new intertask communication primitive called the pipe,
along with a number of higher-level channel types, in
core::pipes std::arc, an atomically reference counted, immutable, shared memory typestd::sync, various exotic synchronization tools based on arcs and pipes- Futures are now based on pipes and sendable
- More robust linked task failure
- Improved task builder API
- An efficient new intertask communication primitive called the pipe,
along with a number of higher-level channel types, in
-
Other
- Improved error reporting
- Preliminary JIT support
- Preliminary work on precise GC
- Extensive architectural improvements to rustc
- Begun a transition away from buggy C++-based reflection (shape) code to Rust-based (visitor) code
- All hash functions and tables converted to secure, randomized SipHash
Version 0.3 (2012-07-12)
-
~1900 changes, numerous bugfixes
-
New coding conveniences
- Integer-literal suffix inference
- Per-item control over warnings, errors
- #[cfg(windows)] and #[cfg(unix)] attributes
- Documentation comments
- More compact closure syntax
- 'do' expressions for treating higher-order functions as control structures
- *-patterns (wildcard extended to all constructor fields)
-
Semantic cleanup
- Name resolution pass and exhaustiveness checker rewritten
- Region pointers and borrow checking supersede alias analysis
- Init-ness checking is now provided by a region-based liveness pass instead of the typestate pass; same for last-use analysis
- Extensive work on region pointers
-
Experimental new language features
- Slices and fixed-size, interior-allocated vectors
- #!-comments for lang versioning, shell execution
- Destructors and iface implementation for classes; type-parameterized classes and class methods
- 'const' type kind for types that can be used to implement shared-memory concurrency patterns
-
Type reflection
-
Removal of various obsolete features
-
Keywords: 'be', 'prove', 'syntax', 'note', 'mutable', 'bind', 'crust', 'native' (now 'extern'), 'cont' (now 'again')
-
Constructs: do-while loops ('do' repurposed), fn binding, resources (replaced by destructors)
-
-
Compiler reorganization
- Syntax-layer of compiler split into separate crate
- Clang (from LLVM project) integrated into build
- Typechecker split into sub-modules
-
New library code
- New time functions
- Extension methods for many built-in types
- Arc: atomic-refcount read-only / exclusive-use shared cells
- Par: parallel map and search routines
- Extensive work on libuv interface
- Much vector code moved to libraries
- Syntax extensions: #line, #col, #file, #mod, #stringify, #include, #include_str, #include_bin
-
Tool improvements
- Cargo automatically resolves dependencies
Version 0.2 (2012-03-29)
-
1500 changes, numerous bugfixes
-
New docs and doc tooling
-
New port: FreeBSD x86_64
-
Compilation model enhancements
- Generics now specialized, multiply instantiated
- Functions now inlined across separate crates
-
Scheduling, stack and threading fixes
- Noticeably improved message-passing performance
- Explicit schedulers
- Callbacks from C
- Helgrind clean
-
Experimental new language features
- Operator overloading
- Region pointers
- Classes
-
Various language extensions
- C-callback function types: 'crust fn ...'
- Infinite-loop construct: 'loop { ... }'
- Shorten 'mutable' to 'mut'
- Required mutable-local qualifier: 'let mut ...'
- Basic glob-exporting: 'export foo::*;'
- Alt now exhaustive, 'alt check' for runtime-checked
- Block-function form of 'for' loop, with 'break' and 'ret'.
-
New library code
- AST quasi-quote syntax extension
- Revived libuv interface
- New modules: core::{future, iter}, std::arena
- Merged per-platform std::{os*, fs*} to core::{libc, os}
- Extensive cleanup, regularization in libstd, libcore
Version 0.1 (2012-01-20)
-
Most language features work, including:
- Unique pointers, unique closures, move semantics
- Interface-constrained generics
- Static interface dispatch
- Stack growth
- Multithread task scheduling
- Typestate predicates
- Failure unwinding, destructors
- Pattern matching and destructuring assignment
- Lightweight block-lambda syntax
- Preliminary macro-by-example
-
Compiler works with the following configurations:
- Linux: x86 and x86_64 hosts and targets
- macOS: x86 and x86_64 hosts and targets
- Windows: x86 hosts and targets
-
Cross compilation / multi-target configuration supported.
-
Preliminary API-documentation and package-management tools included.
Known issues:
-
Documentation is incomplete.
-
Performance is below intended target.
-
Standard library APIs are subject to extensive change, reorganization.
-
Language-level versioning is not yet operational - future code will break unexpectedly.