736 KiB
Version 1.82.0 (2024-10-17)
Language
- Don't make statement nonterminals match pattern nonterminals
- Patterns matching empty types can now be omitted in common cases
- Enforce supertrait outlives obligations when using trait impls
addr_of(_mut)!
macros and the newly stabilized&raw (const|mut)
are now safe to use with all static items- size_of_val_raw: for length 0 this is safe to call
- Reorder trait bound modifiers after
for<...>
binder in trait bounds - Stabilize opaque type precise capturing (RFC 3617)
- Stabilize
&raw const
and&raw mut
operators (RFC 2582) - Stabilize unsafe extern blocks (RFC 3484)
- Stabilize nested field access in
offset_of!
- Do not require
T
to be live when dropping[T; 0]
- Stabilize
const
operands in inline assembly - Stabilize floating-point arithmetic in
const fn
- Stabilize explicit opt-in to unsafe attributes
- Document NaN bit patterns guarantees
Compiler
- Promote riscv64gc-unknown-linux-musl to tier 2
- Promote Mac Catalyst targets
aarch64-apple-ios-macabi
andx86_64-apple-ios-macabi
to Tier 2, and ship them with rustup - Add tier 3 NuttX based targets for RISC-V and ARM
- Add tier 3 powerpc-unknown-linux-muslspe target
- Improved diagnostics to explain why a pattern is unreachable
- The compiler now triggers the unreachable code warning properly for async functions that don't return/are
-> !
- Promote
aarch64-apple-darwin
to Tier 1 - Add Trusty OS target
aarch64-unknown-trusty
andarmv7-unknown-trusty
as tier 3 targets - Promote
wasm32-wasip2
to Tier 2.
Libraries
Stabilized APIs
std::thread::Builder::spawn_unchecked
std::str::CharIndices::offset
std::option::Option::is_none_or
[T]::is_sorted
[T]::is_sorted_by
[T]::is_sorted_by_key
Iterator::is_sorted
Iterator::is_sorted_by
Iterator::is_sorted_by_key
std::future::Ready::into_inner
std::iter::repeat_n
impl<T: Clone> DoubleEndedIterator for Take<Repeat<T>>
impl<T: Clone> ExactSizeIterator for Take<Repeat<T>>
impl<T: Clone> ExactSizeIterator for Take<RepeatWith<T>>
impl Default for std::collections::binary_heap::Iter
impl Default for std::collections::btree_map::RangeMut
impl Default for std::collections::btree_map::ValuesMut
impl Default for std::collections::vec_deque::Iter
impl Default for std::collections::vec_deque::IterMut
Rc<T>::new_uninit
Rc<MaybeUninit<T>>::assume_init
Rc<[T]>::new_uninit_slice
Rc<[MaybeUninit<T>]>::assume_init
Arc<T>::new_uninit
Arc<MaybeUninit<T>>::assume_init
Arc<[T]>::new_uninit_slice
Arc<[MaybeUninit<T>]>::assume_init
Box<T>::new_uninit
Box<MaybeUninit<T>>::assume_init
Box<[T]>::new_uninit_slice
Box<[MaybeUninit<T>]>::assume_init
core::arch::x86_64::_bextri_u64
core::arch::x86_64::_bextri_u32
core::arch::x86::_mm_broadcastsi128_si256
core::arch::x86::_mm256_stream_load_si256
core::arch::x86::_tzcnt_u16
core::arch::x86::_mm_extracti_si64
core::arch::x86::_mm_inserti_si64
core::arch::x86::_mm_storeu_si16
core::arch::x86::_mm_storeu_si32
core::arch::x86::_mm_storeu_si64
core::arch::x86::_mm_loadu_si16
core::arch::x86::_mm_loadu_si32
core::arch::wasm32::u8x16_relaxed_swizzle
core::arch::wasm32::i8x16_relaxed_swizzle
core::arch::wasm32::i32x4_relaxed_trunc_f32x4
core::arch::wasm32::u32x4_relaxed_trunc_f32x4
core::arch::wasm32::i32x4_relaxed_trunc_f64x2_zero
core::arch::wasm32::u32x4_relaxed_trunc_f64x2_zero
core::arch::wasm32::f32x4_relaxed_madd
core::arch::wasm32::f32x4_relaxed_nmadd
core::arch::wasm32::f64x2_relaxed_madd
core::arch::wasm32::f64x2_relaxed_nmadd
core::arch::wasm32::i8x16_relaxed_laneselect
core::arch::wasm32::u8x16_relaxed_laneselect
core::arch::wasm32::i16x8_relaxed_laneselect
core::arch::wasm32::u16x8_relaxed_laneselect
core::arch::wasm32::i32x4_relaxed_laneselect
core::arch::wasm32::u32x4_relaxed_laneselect
core::arch::wasm32::i64x2_relaxed_laneselect
core::arch::wasm32::u64x2_relaxed_laneselect
core::arch::wasm32::f32x4_relaxed_min
core::arch::wasm32::f32x4_relaxed_max
core::arch::wasm32::f64x2_relaxed_min
core::arch::wasm32::f64x2_relaxed_max
core::arch::wasm32::i16x8_relaxed_q15mulr
core::arch::wasm32::u16x8_relaxed_q15mulr
core::arch::wasm32::i16x8_relaxed_dot_i8x16_i7x16
core::arch::wasm32::u16x8_relaxed_dot_i8x16_i7x16
core::arch::wasm32::i32x4_relaxed_dot_i8x16_i7x16_add
core::arch::wasm32::u32x4_relaxed_dot_i8x16_i7x16_add
These APIs are now stable in const contexts:
std::task::Waker::from_raw
std::task::Context::from_waker
std::task::Context::waker
$integer::from_str_radix
std::num::ParseIntError::kind
Cargo
Compatibility Notes
- We now disallow setting some built-in cfgs via the command-line with the newly added
explicit_builtin_cfgs_in_flags
lint in order to prevent incoherent state, eg.windows
cfg active but target is Linux based. The appropriaterustc
flag should be used instead. - The standard library has a new implementation of
binary_search
which is significantly improves performance (#128254). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation. - illumos/Solaris now sets
MSG_NOSIGNAL
when writing to sockets. This avoids killing the process with SIGPIPE when writing to a closed socket, which matches the existing behavior on other UNIX targets. - Removes a problematic hack that always passed the --whole-archive linker flag for tests, which may cause linker errors for code accidentally relying on it.
- The WebAssembly target features
multivalue
andreference-types
are now both enabled by default. These two features both have subtle changes implied for generated WebAssembly binaries. For themultivalue
feature, WebAssembly target support has changed when upgrading to LLVM 19. Support for generating functions with multiple returns no longer works and-Ctarget-feature=+multivalue
has a different meaning than it did in LLVM 18 and prior. There is no longer any supported means to generate a module that has a function with multiple returns in WebAssembly from Rust source code. For thereference-types
feature the encoding of immediates in thecall_indirect
, a commonly used instruction by the WebAssembly backend, has changed. Validators and parsers which don't understand thereference-types
proposal will no longer accept modules produced by LLVM due to this change in encoding of immediates. Additionally these features being enabled are encoded in thetarget_features
custom section and may affect downstream tooling such aswasm-opt
consuming the module. Generating a WebAssembly module that disables default features requires-Zbuild-std
support from Cargo and more information can be found at rust-lang/rust#128511. - Rust now raises unsafety errors for union patterns in parameter-position
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.81.0 (2024-09-05)
Language
- Abort on uncaught panics in
extern "C"
functions. - Fix ambiguous cases of multiple
&
in elided self lifetimes. - Stabilize
#[expect]
for lints (RFC 2383), like#[allow]
with a warning if the lint is not fulfilled. - Change method resolution to constrain hidden types instead of rejecting method candidates.
- Bump
elided_lifetimes_in_associated_constant
to deny. offset_from
: always allow pointers to point to the same address.- Allow constraining opaque types during subtyping in the trait system.
- Allow constraining opaque types during various unsizing casts.
- Deny keyword lifetimes pre-expansion.
Compiler
- Make casts of pointers to trait objects stricter.
- Check alias args for well-formedness even if they have escaping bound vars.
- Deprecate no-op codegen option
-Cinline-threshold=...
. - Re-implement a type-size based limit.
- Properly account for alignment in
transmute
size checks. - Remove the
box_pointers
lint. - Ensure the interpreter checks bool/char for validity when they are used in a cast.
- Improve coverage instrumentation for functions containing nested items.
- Target changes:
- Add Tier 3
no_std
Xtensa targets:xtensa-esp32-none-elf
,xtensa-esp32s2-none-elf
,xtensa-esp32s3-none-elf
- Add Tier 3
std
Xtensa targets:xtensa-esp32-espidf
,xtensa-esp32s2-espidf
,xtensa-esp32s3-espidf
- Add Tier 3 i686 Redox OS target:
i686-unknown-redox
- Promote
arm64ec-pc-windows-msvc
to Tier 2. - Promote
loongarch64-unknown-linux-musl
to Tier 2 with host tools. - Enable full tools and profiler for LoongArch Linux targets.
- Unconditionally warn on usage of
wasm32-wasi
. (see compatibility note below) - Refer to Rust's platform support page for more information on Rust's tiered platform support.
- Add Tier 3
Libraries
- Split core's
PanicInfo
and std'sPanicInfo
. (see compatibility note below) - Generalize
{Rc,Arc}::make_mut()
to unsized types. - Replace sort implementations with stable
driftsort
and unstableipnsort
. Allslice::sort*
andslice::select_nth*
methods are expected to see significant performance improvements. See the research project for more details. - Document behavior of
create_dir_all
with respect to empty paths. - Fix interleaved output in the default panic hook when multiple threads panic simultaneously.
Stabilized APIs
core::error
hint::assert_unchecked
fs::exists
AtomicBool::fetch_not
Duration::abs_diff
IoSlice::advance
IoSlice::advance_slices
IoSliceMut::advance
IoSliceMut::advance_slices
PanicHookInfo
PanicInfo::message
PanicMessage
These APIs are now stable in const contexts:
char::from_u32_unchecked
(function)char::from_u32_unchecked
(method)CStr::count_bytes
CStr::from_ptr
Cargo
- Generated
.cargo_vcs_info.json
is always included, even when--allow-dirty
is passed. - Disallow
package.license-file
andpackage.readme
pointing to non-existent files during packaging. - Disallow passing
--release
/--debug
flag along with the--profile
flag. - Remove
lib.plugin
key support inCargo.toml
. Rust plugin support has been deprecated for four years and was removed in 1.75.0.
Compatibility Notes
-
Usage of the
wasm32-wasi
target will now issue a compiler warning and request users switch to thewasm32-wasip1
target instead. Both targets are the same,wasm32-wasi
is only being renamed, and this change to the WASI target is being done to enable removingwasm32-wasi
in January 2025. -
We have renamed
std::panic::PanicInfo
tostd::panic::PanicHookInfo
. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.core::panic::PanicInfo
will remain unchanged, however, as this is now a different type.The reason is that these types have different roles:
std::panic::PanicHookInfo
is the argument to the panic hook in std context (where panics can have an arbitrary payload), whilecore::panic::PanicInfo
is the argument to the#[panic_handler]
in no_std context (where panics always carry a formatted message). Separating these types allows us to add more useful methods to these types, such asstd::panic::PanicHookInfo::payload_as_str()
andcore::panic::PanicInfo::message()
. -
The new sort implementations may panic if a type's implementation of
Ord
(or the given comparison function) does not implement a total order as the trait requires.Ord
's supertraits (PartialOrd
,Eq
, andPartialEq
) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
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.80.1 (2024-08-08)
- Fix miscompilation in the jump threading MIR optimization when comparing floats
- Revert changes to the
dead_code
lint from 1.80.0
Version 1.80.0 (2024-07-25)
Language
- Document maximum allocation size
- Allow zero-byte offsets and ZST read/writes on arbitrary pointers
- Support C23's variadics without a named parameter
- Stabilize
exclusive_range_pattern
feature - Guarantee layout and ABI of
Result
in some scenarios
Compiler
- Update cc crate to v1.0.97 allowing additional spectre mitigations on MSVC targets
- Allow field reordering on types marked
repr(packed(1))
- Add a lint against never type fallback affecting unsafe code
- Disallow cast with trailing braced macro in let-else
- Expand
for_loops_over_fallibles
lint to lint on fallibles behind references. - self-contained linker: retry linking without
-fuse-ld=lld
on CCs that don't support it - Do not parse CVarArgs (
...
) as a type in trait bounds - Improvements to LLDB formatting #124458 #124500
- For the wasm32-wasip2 target default to PIC and do not use
-fuse-ld=lld
- Add x86_64-unknown-linux-none as a tier 3 target
- Lint on
foo.into_iter()
resolving to&Box<[T]>: IntoIterator
Libraries
- Add
size_of
andsize_of_val
andalign_of
andalign_of_val
to the prelude - Abort a process when FD ownership is violated
- io::Write::write_fmt: panic if the formatter fails when the stream does not fail
- Panic if
PathBuf::set_extension
would add a path separator - Add assert_unsafe_precondition to unchecked_{add,sub,neg,mul,shl,shr} methods
- Update
c_char
on AIX to use the correct type offset_of!
no longer returns a temporary- Handle sigma in
str.to_lowercase
correctly - Raise
DEFAULT_MIN_STACK_SIZE
to at least 64KiB
Stabilized APIs
impl Default for Rc<CStr>
impl Default for Rc<str>
impl Default for Rc<[T]>
impl Default for Arc<str>
impl Default for Arc<CStr>
impl Default for Arc<[T]>
impl IntoIterator for Box<[T]>
impl FromIterator<String> for Box<str>
impl FromIterator<char> for Box<str>
LazyCell
LazyLock
Duration::div_duration_f32
Duration::div_duration_f64
Option::take_if
Seek::seek_relative
BinaryHeap::as_slice
NonNull::offset
NonNull::byte_offset
NonNull::add
NonNull::byte_add
NonNull::sub
NonNull::byte_sub
NonNull::offset_from
NonNull::byte_offset_from
NonNull::read
NonNull::read_volatile
NonNull::read_unaligned
NonNull::write
NonNull::write_volatile
NonNull::write_unaligned
NonNull::write_bytes
NonNull::copy_to
NonNull::copy_to_nonoverlapping
NonNull::copy_from
NonNull::copy_from_nonoverlapping
NonNull::replace
NonNull::swap
NonNull::drop_in_place
NonNull::align_offset
<[T]>::split_at_checked
<[T]>::split_at_mut_checked
str::split_at_checked
str::split_at_mut_checked
str::trim_ascii
str::trim_ascii_start
str::trim_ascii_end
<[u8]>::trim_ascii
<[u8]>::trim_ascii_start
<[u8]>::trim_ascii_end
Ipv4Addr::BITS
Ipv4Addr::to_bits
Ipv4Addr::from_bits
Ipv6Addr::BITS
Ipv6Addr::to_bits
Ipv6Addr::from_bits
Vec::<[T; N]>::into_flattened
<[[T; N]]>::as_flattened
<[[T; N]]>::as_flattened_mut
These APIs are now stable in const contexts:
Cargo
- Stabilize
-Zcheck-cfg
as always enabled - Warn, rather than fail publish, if a target is excluded
- Add special
check-cfg
lint config for theunexpected_cfgs
lint - Stabilize
cargo update --precise <yanked>
- Don't change file permissions on
Cargo.toml
when usingcargo add
- Support using
cargo fix
on IPv6-only networks
Rustdoc
- Allow searching for references
- Stabilize
custom_code_classes_in_docs
feature - fix: In cross-crate scenarios show enum variants on type aliases of enums
Compatibility Notes
- rustfmt estimates line lengths differently when using non-ascii characters
- Type aliases are now handled correctly in orphan check
- Allow instructing rustdoc to read from stdin via
-
std::env::{set_var, remove_var}
can no longer be converted to safe function pointers and no longer implement theFn
family of traits- Warn (or error) when
Self
constructor from outer item is referenced in inner nested item - Turn
indirect_structural_match
andpointer_structural_match
lints into hard errors - Make
where_clause_object_safety
lint a regular object safety violation - Turn
proc_macro_back_compat
lint into a hard error. - Detect unused structs even when implementing private traits
std::sync::ReentrantLockGuard<T>
is no longerSync
ifT: !Sync
which meansstd::io::StdoutLock
andstd::io::StderrLock
are no longer Sync- Type inference will fail in some cases due to new implementations of
FromIterator for Box<str>
. Notably, this breaks versions of thetime
crate before 0.3.35, due to no longer inferring the implementation forBox<[_]>
.
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.
- Misc improvements to size of generated html by rustdoc e.g. #124738 and #123734
- MSVC targets no longer depend on libc
Version 1.79.0 (2024-06-13)
Language
- Stabilize inline
const {}
expressions. - Prevent opaque types being instantiated twice with different regions within the same function.
- Stabilize WebAssembly target features that are in phase 4 and 5.
- Add the
redundant_lifetimes
lint to detect lifetimes which are semantically redundant. - Stabilize the
unnameable_types
lint for public types that can't be named. - Enable debuginfo in macros, and stabilize
-C collapse-macro-debuginfo
and#[collapse_debuginfo]
. - Propagate temporary lifetime extension into
if
andmatch
expressions. - Restrict promotion of
const fn
calls. - Warn against refining impls of crate-private traits with
refining_impl_trait
lint. - Stabilize associated type bounds (RFC 2289).
- Stabilize importing
main
from other modules or crates. - Check return types of function types for well-formedness
- Rework
impl Trait
lifetime inference - Change inductive trait solver cycles to be ambiguous
Compiler
- Define
-C strip
to only affect binaries, not artifacts like.pdb
. - Stabilize
-Crelro-level
for controlling runtime link hardening. - Stabilize checking of
cfg
names and values at compile-time with--check-cfg
. Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release. - Add
aarch64-apple-visionos
andaarch64-apple-visionos-sim
tier 3 targets. - Add
riscv32ima-unknown-none-elf
tier 3 target. - Promote several Windows targets to tier 2:
aarch64-pc-windows-gnullvm
,i686-pc-windows-gnullvm
, andx86_64-pc-windows-gnullvm
.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Implement
FromIterator
for(impl Default + Extend, impl Default + Extend)
. - Implement
{Div,Rem}Assign<NonZero<X>>
onX
. - Document overrides of
clone_from()
in core/std. - Link MSVC default lib in core.
- Caution against using
transmute
between pointers and integers. - Enable frame pointers for the standard library.
Stabilized APIs
{integer}::unchecked_add
{integer}::unchecked_mul
{integer}::unchecked_sub
<[T]>::split_at_unchecked
<[T]>::split_at_mut_unchecked
<[u8]>::utf8_chunks
str::Utf8Chunks
str::Utf8Chunk
<*const T>::is_aligned
<*mut T>::is_aligned
NonNull::is_aligned
<*const [T]>::len
<*mut [T]>::len
<*const [T]>::is_empty
<*mut [T]>::is_empty
NonNull::<[T]>::is_empty
CStr::count_bytes
io::Error::downcast
num::NonZero<T>
path::absolute
proc_macro::Literal::byte_character
proc_macro::Literal::c_string
These APIs are now stable in const contexts:
Atomic*::into_inner
io::Cursor::new
io::Cursor::get_ref
io::Cursor::position
io::empty
io::repeat
io::sink
panic::Location::caller
panic::Location::file
panic::Location::line
panic::Location::column
Cargo
- Prevent dashes in
lib.name
, always normalizing to_
. - Stabilize MSRV-aware version requirement selection in
cargo add
. - Switch to using
gitoxide
by default for listing files.
Rustdoc
- Always display stability version even if it's the same as the containing item.
- Show a single search result for items with multiple paths.
- Support typing
/
in docs to begin a search.
Misc
Compatibility Notes
- Update the minimum external LLVM to 17.
RustcEncodable
andRustcDecodable
are soft-destabilized, to be removed from the prelude in next edition.- The
wasm_c_abi
future-incompatibility lint will warn about use of the non-spec-compliant C ABI. Usewasm-bindgen v0.2.88
to generate forward-compatible bindings. - Check return types of function types for well-formedness
Version 1.78.0 (2024-05-02)
Language
- Stabilize
#[cfg(target_abi = ...)]
- Stabilize the
#[diagnostic]
namespace and#[diagnostic::on_unimplemented]
attribute - Make async-fn-in-trait implementable with concrete signatures
- Make matching on NaN a hard error, and remove the rest of
illegal_floating_point_literal_pattern
- static mut: allow mutable reference to arbitrary types, not just slices and arrays
- Extend
invalid_reference_casting
to include references casting to bigger memory layout - Add
non_contiguous_range_endpoints
lint for singleton gaps after exclusive ranges - Add
wasm_c_abi
lint for use of older wasm-bindgen versions This lint currently only works when using Cargo. - Update
indirect_structural_match
andpointer_structural_match
lints to match RFC - Make non-
PartialEq
-typed consts as patterns a hard error - Split
refining_impl_trait
lint into_reachable
,_internal
variants - Remove unnecessary type inference when using associated types inside of higher ranked
where
-bounds - Weaken eager detection of cyclic types during type inference
trait Trait: Auto {}
: allow upcasting fromdyn Trait
todyn Trait + Auto
Compiler
- Made
INVALID_DOC_ATTRIBUTES
lint deny by default - Increase accuracy of redundant
use
checking - Suggest moving definition if non-found macro_rules! is defined later
- Lower transmutes from int to pointer type as gep on null
Target changes:
- Windows tier 1 targets now require at least Windows 10
- Add
wasm32-wasip1
tier 2 (without host tools) target - Add
wasm32-wasip2
tier 3 target - Rename
wasm32-wasi-preview1-threads
towasm32-wasip1-threads
- Add
arm64ec-pc-windows-msvc
tier 3 target - Add
armv8r-none-eabihf
tier 3 target for the Cortex-R52 - Add
loongarch64-unknown-linux-musl
tier 3 target
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Bump Unicode to version 15.1.0, regenerate tables
- Make align_offset, align_to well-behaved in all cases
- PartialEq, PartialOrd: document expectations for transitive chains
- Optimize away poison guards when std is built with panic=abort
- Replace pthread
RwLock
with custom implementation - Implement unwind safety for Condvar on all platforms
- Add ASCII fast-path for
char::is_grapheme_extended
Stabilized APIs
impl Read for &Stdin
- Accept non
'static
lifetimes for severalstd::error::Error
related implementations - Make
impl<Fd: AsFd>
impl take?Sized
impl From<TryReserveError> for io::Error
These APIs are now stable in const contexts:
Cargo
- Stabilize lockfile v4
- Respect
rust-version
when generating lockfile - Control
--charset
via auto-detecting config value - Support
target.<triple>.rustdocflags
officially - Stabilize global cache data tracking
Misc
Compatibility Notes
- Many unsafe precondition checks now run for user code with debug assertions enabled This change helps users catch undefined behavior in their code, though the details of how much is checked are generally not stable.
- riscv only supports split_debuginfo=off for now
- Consistently check bounds on hidden types of
impl Trait
- Change equality of higher ranked types to not rely on subtyping
- When called, additionally check bounds on normalized function return type
- Expand coverage for
arithmetic_overflow
lint - Fix detection of potential interior mutability in
const
initializers This code was accidentally accepted. The fix can break generic code that borrows a value of unknown type, as there is currently no way to declare "this type has no interior mutability". In the future, stabilizing theFreeze
trait will allow proper support for such code.
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.
- Update to LLVM 18
- Build
rustc
with 1CGU onx86_64-pc-windows-msvc
- Build
rustc
with 1CGU onx86_64-apple-darwin
- Introduce
run-make
V2 infrastructure, arun_make_support
library and port over 2 tests as example - Windows: Implement condvar, mutex and rwlock using futex
Version 1.77.2 (2024-04-09)
Version 1.77.1 (2024-03-28)
- Revert stripping debuginfo by default for Windows This fixes a regression in 1.77 by reverting to the previous default. Platforms other than Windows are not affected.
- Internal: Fix heading anchor rendering in doc pages
Version 1.77.0 (2024-03-21)
Language
- Reveal opaque types within the defining body for exhaustiveness checking.
- Stabilize C-string literals.
- Stabilize THIR unsafeck.
- Add lint
static_mut_refs
to warn on references to mutable statics. - Support async recursive calls (as long as they have indirection).
- Undeprecate lint
unstable_features
and make use of it in the compiler. - Make inductive cycles in coherence ambiguous always.
- Get rid of type-driven traversal in const-eval interning, only as a future compatiblity lint for now.
- Deny braced macro invocations in let-else.
Compiler
- Include lint
soft_unstable
in future breakage reports. - Make
i128
andu128
16-byte aligned on x86-based targets. - Use
--verbose
in diagnostic output. - Improve spacing between printed tokens.
- Merge the
unused_tuple_struct_fields
lint intodead_code
. - Error on incorrect implied bounds in well-formedness check, with a temporary exception for Bevy.
- Fix coverage instrumentation/reports for non-ASCII source code.
- Fix
fn
/const
items implied bounds and well-formedness check. - Promote
riscv32{im|imafc}-unknown-none-elf
targets to tier 2. - Add several new tier 3 targets:
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Stabilized APIs
array::each_ref
array::each_mut
core::net
f32::round_ties_even
f64::round_ties_even
mem::offset_of!
slice::first_chunk
slice::first_chunk_mut
slice::split_first_chunk
slice::split_first_chunk_mut
slice::last_chunk
slice::last_chunk_mut
slice::split_last_chunk
slice::split_last_chunk_mut
slice::chunk_by
slice::chunk_by_mut
Bound::map
File::create_new
Mutex::clear_poison
RwLock::clear_poison
Cargo
- Extend the build directive syntax with
cargo::
. - Stabilize metadata
id
format asPackageIDSpec
. - Pull out
cargo-util-schemas
as a crate. - Strip all debuginfo when debuginfo is not requested.
- Inherit jobserver from env for all kinds of runners.
- Deprecate rustc plugin support in cargo.
Rustdoc
- Allows links in markdown headings.
- Search for tuples and unit by type with
()
. - Clean up the source sidebar's hide button.
- Prevent JS injection from
localStorage
.
Misc
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.76.0 (2024-02-08)
Language
- Document Rust ABI compatibility between various types
- Also: guarantee that char and u32 are ABI-compatible
- Add lint
ambiguous_wide_pointer_comparisons
that supersedesclippy::vtable_address_comparisons
Compiler
- Lint pinned
#[must_use]
pointers (in particular,Box<T>
whereT
is#[must_use]
) inunused_must_use
. - Soundness fix: fix computing the offset of an unsized field in a packed struct
- Soundness fix: fix dynamic size/align computation logic for packed types with dyn Trait tail
- Add
$message_type
field to distinguish json diagnostic outputs - Enable Rust to use the EHCont security feature of Windows
- Add tier 3 {x86_64,i686}-win7-windows-msvc targets
- Add tier 3 aarch64-apple-watchos target
- Add tier 3 arm64e-apple-ios & arm64e-apple-darwin targets
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add a column number to
dbg!()
- Add
std::hash::{DefaultHasher, RandomState}
exports - Fix rounding issue with exponents in fmt
- Add T: ?Sized to
RwLockReadGuard
andRwLockWriteGuard
's Debug impls. - Windows: Allow
File::create
to work on hidden files
Stabilized APIs
Arc::unwrap_or_clone
Rc::unwrap_or_clone
Result::inspect
Result::inspect_err
Option::inspect
type_name_of_val
std::hash::{DefaultHasher, RandomState}
These were previously available only throughstd::collections::hash_map
.ptr::{from_ref, from_mut}
ptr::addr_eq
Cargo
See Cargo release notes.
Rustdoc
- Don't merge cfg and doc(cfg) attributes for re-exports
- rustdoc: allow resizing the sidebar / hiding the top bar
- rustdoc-search: add support for traits and associated types
- rustdoc: Add highlighting for comments in items declaration
Compatibility Notes
- Add allow-by-default lint for unit bindings
This is expected to be upgraded to a warning by default in a future Rust
release. Some macros emit bindings with type
()
with user-provided spans, which means that this lint will warn for user code. - Remove x86_64-sun-solaris target.
- Remove asmjs-unknown-emscripten target
- Report errors in jobserver inherited through environment variables This may warn on benign problems too.
- Update the minimum external LLVM to 16.
- Improve
print_tts
This change can break some naive manual parsing of token trees in proc macro code which expect a particular structure after.to_string()
, rather than just arbitrary Rust code. - Make
IMPLIED_BOUNDS_ENTAILMENT
into a hard error from a lint - Vec's allocation behavior was changed when collecting some iterators
Allocation behavior is currently not specified, nevertheless changes can be surprising.
See
impl FromIterator for Vec
for more details. - Properly reject
default
on free const items
Version 1.75.0 (2023-12-28)
Language
- Stabilize
async fn
and return-positionimpl Trait
in traits. - Allow function pointer signatures containing
&mut T
inconst
contexts. - Match
usize
/isize
exhaustively with half-open ranges. - Guarantee that
char
has the same size and alignment asu32
. - Document that the null pointer has the 0 address.
- Allow partially moved values in
match
. - Add notes about non-compliant FP behavior on 32bit x86 targets.
- Stabilize ratified RISC-V target features.
Compiler
- Rework negative coherence to properly consider impls that only partly overlap.
- Bump
COINDUCTIVE_OVERLAP_IN_COHERENCE
to deny, and warn in dependencies. - Consider alias bounds when computing liveness in NLL.
- Add the V (vector) extension to the
riscv64-linux-android
target spec. - Automatically enable cross-crate inlining for small functions
- Add several new tier 3 targets:
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Override
Waker::clone_from
to avoid cloningWaker
s unnecessarily. - Implement
BufRead
forVecDeque<u8>
. - Implement
FusedIterator
forDecodeUtf16
when the inner iterator does. - Implement
Not, Bit{And,Or}{,Assign}
for IP addresses. - Implement
Default
forExitCode
. - Guarantee representation of None in NPO
- Document when atomic loads are guaranteed read-only.
- Broaden the consequences of recursive TLS initialization.
- Windows: Support sub-millisecond sleep.
- Fix generic bound of
str::SplitInclusive
'sDoubleEndedIterator
impl - Fix exit status / wait status on non-Unix
cfg(unix)
platforms.
Stabilized APIs
Atomic*::from_ptr
FileTimes
FileTimesExt
File::set_modified
File::set_times
IpAddr::to_canonical
Ipv6Addr::to_canonical
Option::as_slice
Option::as_mut_slice
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
These APIs are now stable in const contexts:
Ipv6Addr::to_ipv4_mapped
MaybeUninit::assume_init_read
MaybeUninit::zeroed
mem::discriminant
mem::zeroed
Cargo
- Add new packages to
[workspace.members]
automatically. - Allow version-less
Cargo.toml
manifests. - Make browser links out of HTML file paths.
Rustdoc
- Accept less invalid Rust in rustdoc.
- Document lack of object safety on affected traits.
- Hide
#[repr(transparent)]
if it isn't part of the public ABI. - Show enum discriminant if it is a C-like variant.
Compatibility Notes
- FreeBSD targets now require at least version 12.
- Formally demote tier 2 MIPS targets to tier 3.
- Make misalignment a hard error in
const
contexts. - Fix detecting references to packed unsized fields.
- Remove support for compiler plugins.
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.
- Optimize
librustc_driver.so
with BOLT. - Enable parallel rustc front end in dev and nightly builds.
- Distribute
rustc-codegen-cranelift
as rustup component on the nightly channel.
Version 1.74.1 (2023-12-07)
- Resolved spurious STATUS_ACCESS_VIOLATIONs in LLVM
- Clarify guarantees for std::mem::discriminant
- Fix some subtyping-related regressions
Version 1.74.0 (2023-11-16)
Language
- Codify that
std::mem::Discriminant<T>
does not depend on any lifetimes in T - Replace
private_in_public
lint withprivate_interfaces
andprivate_bounds
per RFC 2145. Read more in RFC 2145. - Allow explicit
#[repr(Rust)]
- closure field capturing: don't depend on alignment of packed fields
- Enable MIR-based drop-tracking for
async
blocks - Stabilize
impl_trait_projections
Compiler
- stabilize combining +bundle and +whole-archive link modifiers
- Stabilize
PATH
option for--print KIND=PATH
- Enable ASAN/LSAN/TSAN for
*-apple-ios-macabi
- Promote loongarch64-unknown-none* to Tier 2
- Add
i686-pc-windows-gnullvm
as a tier 3 target
Libraries
- Implement
From<OwnedFd/Handle>
for ChildStdin/out/err - Implement
From<{&,&mut} [T; N]>
forVec<T>
whereT: Clone
- impl Step for IP addresses
- Implement
From<[T; N]>
forRc<[T]>
andArc<[T]>
impl TryFrom<char> for u16
- Stabilize
io_error_other
feature - Stabilize the
Saturating
type - Stabilize const_transmute_copy
Stabilized APIs
core::num::Saturating
impl From<io::Stdout> for std::process::Stdio
impl From<io::Stderr> for std::process::Stdio
impl From<OwnedHandle> for std::process::Child{Stdin, Stdout, Stderr}
impl From<OwnedFd> for std::process::Child{Stdin, Stdout, Stderr}
std::ffi::OsString::from_encoded_bytes_unchecked
std::ffi::OsString::into_encoded_bytes
std::ffi::OsStr::from_encoded_bytes_unchecked
std::ffi::OsStr::as_encoded_bytes
std::io::Error::other
impl TryFrom<char> for u16
impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T>
impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T>
impl<T, const N: usize> From<[T; N]> for Arc<[T]>
impl<T, const N: usize> From<[T; N]> for Rc<[T]>
These APIs are now stable in const contexts:
Cargo
- In
Cargo.toml
, stabilize[lints]
- Stabilize credential-process and registry-auth
- Stabilize
--keep-going
build flag - Add styling to
--help
output - For
cargo clean
, add--dry-run
flag and summary line at the end - For
cargo update
, make--package
more convenient by being positional - For
cargo update
, clarify meaning of --aggressive as --recursive - Add '-n' as an alias for
--dry-run
- Allow version-prefixes in pkgid's (e.g.
--package
flags) to resolve ambiguities - In
.cargo/config.toml
, merge lists in precedence order - Add support for
target.'cfg(..)'.linker
Rustdoc
- Add warning block support in rustdoc
- rustdoc-search: add support for type parameters
- rustdoc: show inner enum and struct in type definition for concrete type
Compatibility Notes
- Raise minimum supported Apple OS versions
- make Cell::swap panic if the Cells partially overlap
- Reject invalid crate names in
--extern
- Don't resolve generic impls that may be shadowed by dyn built-in impls
- The new
impl From<{&,&mut} [T; N]> for Vec<T>
is known to cause some inference failures with overly-generic code. In those examples using thetui
crate, the combination ofAsRef<_>
andInto<Vec>
leaves the middle type ambiguous, and the newimpl
adds another possibility, so it now requires an explicit type annotation.
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.
None this cycle.
Version 1.73.0 (2023-10-05)
Language
- Uplift
clippy::fn_null_check
lint asuseless_ptr_null_checks
. - Make
noop_method_call
warn by default. - Support interpolated block for
try
andasync
in macros. - Make
unconditional_recursion
lint detect recursive drops. - Future compatibility warning for some impls being incorrectly considered not overlapping.
- The
invalid_reference_casting
lint is now deny-by-default (instead of allow-by-default)
Compiler
- Write version information in a
.comment
section 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-threads
as a tier 2 target.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add
Read
,Write
andSeek
impls forArc<File>
. - Merge functionality of
io::Sink
intoio::Empty
. - Implement
RefUnwindSafe
forBacktrace
- Make
ExitStatus
implementDefault
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
stat
struct definitions.
Stabilized APIs
- Unsigned
{integer}::div_ceil
- Unsigned
{integer}::next_multiple_of
- Unsigned
{integer}::checked_next_multiple_of
std::ffi::FromBytesUntilNulError
std::os::unix::fs::chown
std::os::unix::fs::fchown
std::os::unix::fs::lchown
LocalKey::<Cell<T>>::get
LocalKey::<Cell<T>>::set
LocalKey::<Cell<T>>::take
LocalKey::<Cell<T>>::replace
LocalKey::<RefCell<T>>::with_borrow
LocalKey::<RefCell<T>>::with_borrow_mut
LocalKey::<RefCell<T>>::set
LocalKey::<RefCell<T>>::take
LocalKey::<RefCell<T>>::replace
These APIs are now stable in const contexts:
Cargo
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_apfloat
with the new version of the crate. - Update to LLVM 17.
- Add
internal_features
lint 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_drops
lint - Uplift
clippy::invalid_utf8_in_unchecked
lint asinvalid_from_utf8_unchecked
andinvalid_from_utf8
- Uplift
clippy::cast_ref_to_mut
lint asinvalid_reference_casting
- Uplift
clippy::cmp_nan
lint asinvalid_nan_comparisons
- resolve: Remove artificial import ambiguity errors
- Don't require associated types with Self: Sized bounds in
dyn Trait
objects
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_frame
from 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: Sized
bounds onBufReader<T>
,BufWriter<T>
andLineWriter<T>
- Update runtime guarantee for
select_nth_unstable
- Return
Ok
on kill if process has already exited - Implement PartialOrd for
Vec
s 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_eq
ignore 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-workspace
by 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.jobs
parallelism back to the default. #12222
Compatibility Notes
- Alter
Display
forIpv6Addr
for 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_op
lint when callingborrow()
- Fix ICE: substitute types before checking inlining compatibility
- Fix ICE: don't use
can_eq
inderive(..)
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_type
and-Cdlltool
. - Uplift
clippy::{drop,forget}_{ref,copy}
lints. - Type inference is more conservative around constrained vars.
- Use fulfillment to check
Drop
impl compatibility
Compiler
- Evaluate place expression in
PlaceMention
, makinglet _ =
patterns more consistent with respect to the borrow checker. - Add
--print deployment-target
flag 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-musl
targets to 1.2.3, enabling time64 on 32-bit systems. - Stabilize
debugger_visualizer
for embedding metadata like Microsoft's Natvis. - Enable flatten-format-args by default.
- Make
Self
respect tuple constructor privacy. - Improve niche placement by trying two strategies and picking the better result.
- Use
apple-m1
as the target CPU foraarch64-apple-darwin
. - Add Tier 3 support for the
x86_64h-apple-darwin
target. - Promote
loongarch64-unknown-linux-gnu
to 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
Drop
implementation, but panicking within a panic hook is now an immediate abort. - Loosen
From<&[T]> for Box<[T]>
bound toT: Clone
. - Remove unnecessary
T: Send
bound inError for mpsc::SendError<T>
andTrySendError<T>
. - Fix docs for
alloc::realloc
to matchLayout
requirements 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_empty
BuildHasher::hash_one
NonZeroI*::is_positive
NonZeroI*::is_negative
NonZeroI*::checked_neg
NonZeroI*::overflowing_neg
NonZeroI*::saturating_neg
NonZeroI*::wrapping_neg
Neg 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_unaligned
ptr::read
ptr::read_unaligned
<[T]>::split_at
Cargo
- Allow named debuginfo options in
Cargo.toml
. - Add
workspace_default_members
to the output ofcargo metadata
. - Automatically inherit workspace fields when running
cargo new
/cargo init
.
Rustdoc
- Add a new
rustdoc::unescaped_backticks
lint for broken inline code. - Support strikethrough with single tildes. (
~~old~~
vs.~new~
)
Misc
Compatibility Notes
- Remove structural match from
TypeId
. Code that uses a constantTypeId
in a pattern will potentially be broken. Known cases have already been fixed -- in particular, users of thelog
crate'skv_unstable
feature should update tolog v0.4.18
or later. - Add a
sysroot
crate 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 runrustc
pointing 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_HOME
andRUSTUP_TOOLCHAIN
in 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_args
invocations to uses captures - Lint ambiguous glob re-exports
- Perform const and unsafe checking for expressions in
let _ = expr
position.
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_allocation
lint againstBox::new
too - 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
Command
prefer 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_cmp
to 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
FnPtr
trait that is implemented for all function pointers This extendsDebug
,Pointer
,Hash
,PartialEq
,Eq
,PartialOrd
, andOrd
implementations for function pointers with all ABIs.
Stabilized APIs
NonZero*::MIN/MAX
BinaryHeap::retain
Default for std::collections::binary_heap::IntoIter
Default 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::Range
Default for std::collections::btree_set::{IntoIter, Iter}
Default for std::collections::btree_set::Range
Default for std::collections::linked_list::{IntoIter, Iter, IterMut}
Default for std::vec::IntoIter
Default for std::iter::Chain
Default for std::iter::Cloned
Default for std::iter::Copied
Default for std::iter::Enumerate
Default for std::iter::Flatten
Default for std::iter::Fuse
Default for std::iter::Rev
Default for std::slice::Iter
Default for std::slice::IterMut
Rc::into_inner
Arc::into_inner
std::cell::OnceCell
Option::is_some_and
NonNull::slice_from_raw_parts
Result::is_ok_and
Result::is_err_and
std::sync::atomic::Atomic*::as_ptr
std::io::IsTerminal
std::os::linux::net::SocketAddrExt
std::os::unix::net::UnixDatagram::bind_addr
std::os::unix::net::UnixDatagram::connect_addr
std::os::unix::net::UnixDatagram::send_to_addr
std::os::unix::net::UnixListener::bind_addr
std::path::Path::as_mut_os_str
std::sync::OnceLock
Cargo
- Add
CARGO_PKG_README
- Make
sparse
the 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
libtest
from supporting-Zunstable-options
- Perform const and unsafe checking for expressions in
let _ = expr
position. - WebAssembly targets enable
sign-ext
andmutable-globals
features 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
Copy
fields. - Stabilize the
cmpxchg16b
target 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: Autotrait
bounds on dyn-safe trait methods. - Treat
str
as containing[u8]
for auto trait purposes.
Compiler
- Upgrade
*-pc-windows-gnu
on CI to mingw-w64 v10 and GCC 12.2. - Rework min_choice algorithm of member constraints.
- Support
true
andfalse
as boolean flags in compiler arguments. - Default
repr(C)
enums toc_int
size.
Libraries
- Implement the unstable
DispatchFromDyn
for 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
AsFd
andAsRawFd
forRc
.
Stabilized APIs
These APIs are now stable in const contexts:
SocketAddr::new
SocketAddr::ip
SocketAddr::port
SocketAddr::is_ipv4
SocketAddr::is_ipv6
SocketAddrV4::new
SocketAddrV4::ip
SocketAddrV4::port
SocketAddrV6::new
SocketAddrV6::ip
SocketAddrV6::port
SocketAddrV6::flowinfo
SocketAddrV6::scope_id
Cargo
- Cargo now suggests
cargo fix
orcargo clippy --fix
when compilation warnings are auto-fixable. - Cargo now suggests
cargo add
if you try to install a library crate. - Cargo now sets the
CARGO_BIN_NAME
environment variable also for binary examples.
Rustdoc
- Vertically compact trait bound formatting.
- Only include stable lints in
rustdoc::all
group. - Compute maximum Levenshtein distance based on the query.
- Remove inconsistently-present sidebar tooltips.
- Search by macro when query ends with
!
.
Compatibility Notes
- The
rust-analysis
component fromrustup
now only contains a warning placeholder. This was primarily intended for RLS, and the corresponding-Zsave-analysis
flag 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-features
is 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_HOME
in 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
@revoked
and a better error message for@cert-authority
in 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-clang
asclang
in 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
alloc
on stable without requiring the definition of a handler for allocation failure. Defining custom handlers is still unstable. - Stabilize
efiapi
calling convention. - Remove implicit promotion for types with drop glue
Compiler
- Change
bindings_with_variant_name
to deny-by-default - Allow .. to be parsed as let initializer
- Add
armv7-sony-vita-newlibeabihf
as 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 -> VecDeque
conversion 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_STR
impl DerefMut for PathBuf
These APIs are now stable in const contexts:
Cargo
- Stabilize sparse registry support for crates.io
cargo build --verbose
tells you more about why it recompiles.- Show progress of crates.io index update even
net.git-fetch-with-cli
option enabled
Misc
Compatibility Notes
- Only support Android NDK 25 or newer
- Add
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS
to future-incompat report - Only specify
--target
by default for-Zgcc-ld=lld
on wasm - Bump
IMPLIED_BOUNDS_ENTAILMENT
to Deny + ReportNow std::task::Context
no 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_args
to pedantic.
Version 1.67.0 (2023-01-26)
Language
- Make
Sized
predicates coinductive, allowing cycles. #[must_use]
annotations onasync fn
also 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
C
orcdecl
. - 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_std
targets for the QNX Neutrino RTOS,aarch64-unknown-nto-qnx710
andx86_64-pc-nto-qnx710
. - Promote UEFI targets to tier 2,
aarch64-unknown-uefi
,i686-unknown-uefi
, andx86_64-unknown-uefi
. - Remove tier 3
linuxkernel
targets (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-channel
intostd::sync::mpsc
. - Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.
- Derive
Eq
andHash
forControlFlow
. - Don't build
compiler_builtins
with-C panic=abort
.
Stabilized APIs
{integer}::checked_ilog
{integer}::checked_ilog2
{integer}::checked_ilog10
{integer}::ilog
{integer}::ilog2
{integer}::ilog10
NonZeroU*::ilog2
NonZeroU*::ilog10
NonZero*::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-dynamic
towasm-ld
. main
is now mangled as__main_void
onwasm32-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_use
onimpl Trait
for supertraits This makesimpl ExactSizeIterator
respect the existing#[must_use]
annotation onIterator
. - Allow
..=X
in patterns - Uplift
clippy::for_loops_over_fallibles
lint into rustc - Stabilize
sym
operands 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 unnecessaryDefault
bounds - Update to Unicode 15
Stabilized APIs
proc_macro::Span::source_text
uX::{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
AsFd
implementations for stdio lock types on WASI. impl TryFrom<Vec<T>> for Box<[T; N]>
core::hint::black_box
Duration::try_from_secs_{f32,f64}
Option::unzip
std::os::fd
Rustdoc
Cargo
- Added
cargo remove
to remove dependencies from Cargo.toml cargo publish
now waits for the new version to be downloadable before exiting
See detailed release notes for more.
Compatibility Notes
- Only apply
ProceduralMasquerade
hack to older versions ofrental
- Don't export
__heap_base
and__data_end
on wasm32-wasi. - Don't export
__wasm_init_memory
on WebAssembly. - Only export
__tls_*
on wasm32-unknown-unknown. - Don't link to
libresolv
in libstd on Darwin - Update libstd's libc to 0.2.135 (to make
libstd
no longer pull inlibiconv.dylib
on 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_objects
show 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
as
casts of enums with#[non_exhaustive]
variants - Stabilize
let else
- Stabilize generic associated types (GATs)
- Add lints
let_underscore_drop
andlet_underscore_lock
from Clippy - Stabilize
break
ing from arbitrary labeled blocks ("label-break-value") - Uninitialized integers, floats, and raw pointers are now considered immediate UB.
Usage of
MaybeUninit
is the correct way to work with uninitialized memory. - Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a
- Do not allow
Drop
impl 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_name
lint - 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::ne
in derive(PartialEq) - Windows RNG: Use
BCRYPT_RNG_ALG_HANDLE
by default - Forbid mixing
System
with direct system allocator calls - Document no support for writing to non-blocking stdio/stderr
std::layout::Layout
size must not overflowisize::MAX
when rounded up toalign
This also changes the safety conditions onLayout::from_size_align_unchecked
.
Stabilized APIs
std::backtrace::Backtrace
Bound::as_ref
std::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::Layout
size must not overflowisize::MAX
when rounded up toalign
. This also changes the safety conditions onLayout::from_size_align_unchecked
.PollFn
now only implementsUnpin
if 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-patches
allows 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.sh
andx.ps1
shell 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
&T
if every byte inT
is 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-width
compiler flag to define the terminal width. - Add support for link-flavor
rust-lld
for iOS, tvOS and watchOS
Libraries
- Remove restrictions on compare-exchange memory ordering.
- You can now
write!
orwriteln!
into anOsString
: Implementfmt::Write
forOsString
- Make RwLockReadGuard covariant
- Implement
FusedIterator
forstd::net::[Into]Incoming
impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>
ptr::copy
andptr::swap
are doing untyped copies- Add cgroupv1 support to
available_parallelism
- Mitigate many incorrect uses of
mem::uninitialized
Stabilized APIs
future::IntoFuture
future::poll_fn
task::ready!
num::NonZero*::checked_mul
num::NonZero*::checked_pow
num::NonZero*::saturating_mul
num::NonZero*::saturating_pow
num::NonZeroI*::abs
num::NonZeroI*::checked_abs
num::NonZeroI*::overflowing_abs
num::NonZeroI*::saturating_abs
num::NonZeroI*::unsigned_abs
num::NonZeroI*::wrapping_abs
num::NonZeroU*::checked_add
num::NonZeroU*::checked_next_power_of_two
num::NonZeroU*::saturating_add
os::unix::process::CommandExt::process_group
os::windows::fs::FileTypeExt::is_symlink_dir
os::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::CStr
core::ffi::FromBytesWithNulError
alloc::ffi::CString
alloc::ffi::FromVecWithNulError
alloc::ffi::IntoStringError
alloc::ffi::NulError
These types were previously stable in std::os::raw
, but are now also available in core::ffi
and std::ffi
:
ffi::c_char
ffi::c_double
ffi::c_float
ffi::c_int
ffi::c_long
ffi::c_longlong
ffi::c_schar
ffi::c_short
ffi::c_uchar
ffi::c_uint
ffi::c_ulong
ffi::c_ulonglong
ffi::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.package
andworkspace.dependencies
for more details on how to define these common settings. - Cargo commands can now accept multiple
--target
flags to build for multiple targets at once, and thebuild.target
config option may now take an array of multiple targets. - The
--jobs
argument can now take a negative number to count backwards from the max CPUs. cargo add
will now updateCargo.lock
.- Added the
--crate-type
flag tocargo rustc
to override the crate type. - Significantly improved the performance fetching git dependencies from GitHub
when using a hash in the
rev
field.
Misc
Compatibility Notes
- The minimum required versions for all
-linux-gnu
targets 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
'sU
is not larger thanT
- A soundness bug in
BTreeMap
was 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-eabi
target, 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 Trait
was 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::insert
for 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 Trait
args. - Make
cenum_impl_drop_cast
warnings deny-by-default. - Prevent unwinding when
-C panic=abort
is used regardless of declared ABI. - lub: don't bail out due to empty binders.
Compiler
- Stabilize the
bundle
native library modifier, also removing the deprecatedstatic-nobundle
linking 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
,PartialEq
andEq
forcore::fmt::Alignment
. - Extend
ptr::null
andnull_mut
to 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
Hash
forcore::alloc::Layout
. - Add capacity documentation for
OsString
. - Put a bound on collection misbehavior.
- Make
std::mem::needs_drop
accept?Sized
. impl Termination for Infallible
and then make theResult
impls ofTermination
more generic.- Document Rust's stance on
/proc/self/mem
.
Stabilized APIs
array::from_fn
Box::into_pin
BinaryHeap::try_reserve
BinaryHeap::try_reserve_exact
OsString::try_reserve
OsString::try_reserve_exact
PathBuf::try_reserve
PathBuf::try_reserve_exact
Path::try_exists
Ref::filter_map
RefMut::filter_map
NonNull::<[T]>::len
ToOwned::clone_into
Ipv6Addr::to_ipv4_mapped
unix::io::AsFd
unix::io::BorrowedFd<'fd>
unix::io::OwnedFd
windows::io::AsHandle
windows::io::BorrowedHandle<'handle>
windows::io::OwnedHandle
windows::io::HandleOrInvalid
windows::io::HandleOrNull
windows::io::InvalidHandleError
windows::io::NullHandleError
windows::io::AsSocket
windows::io::BorrowedSocket<'handle>
windows::io::OwnedSocket
thread::scope
thread::Scope
thread::ScopedJoinHandle
These APIs are now usable in const contexts:
array::from_ref
slice::from_ref
intrinsics::copy
intrinsics::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_nonoverlapping
str::from_utf8
Utf8Error::error_len
Utf8Error::valid_up_to
Condvar::new
Mutex::new
RwLock::new
Cargo
- Stabilize the
--config path
command-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 Trait
return types. - The compiler fixed an incremental compilation bug with
async fn
lifetimes. - Windows added a fallback for overlapped I/O in synchronous reads and writes.
- The
x86_64-fortanix-unknown-sgx
target 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
const
functions may now specifyextern "C"
orextern "Rust"
Compiler
- linker: Stop using whole-archive on dependencies of dylibs
- Make
unaligned_references
lint 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-gnullvm
andx86_64-pc-windows-gnullvm
targets* - Implement a lint to warn about unused macro rules
- Promote
x86_64-unknown-none
target 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_some
f32::total_cmp
f64::total_cmp
Stdin::lines
windows::CommandExt::raw_arg
impl<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 add
command for adding dependencies toCargo.toml
from the command-line. docs - Package ID specs now support
name@version
syntax in addition to the previousname:version
to align with the behavior incargo add
and other tools.cargo install
andcargo yank
also now support this syntax so the version does not need to passed as a separate flag. - The
git
andregistry
directories 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 torustc
exceeds the operating system's limit.
Compatibility Notes
cargo test
now passes--target
torustdoc
if 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
File
reads 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 fn
signatures can now include generic trait boundsconst fn
signatures can now useimpl Trait
in 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 Trait
return type
Compiler
- Linking modifier syntax in
#[link]
attributes and on the command line, as well as thewhole-archive
modifier specifically, are now supported - The
char
type 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'static
handles. Previously, the creation of locked handles to stdin/stdout/stderr would borrow the handles being locked, which prevented writinglet out = std::io::stdout().lock();
becauseout
would outlive the return value ofstdout()
. Such code now works, eliminating a common pitfall that affected many Rust users. Vec::from_raw_parts
is now less restrictive about its inputsstd::thread::available_parallelism
now takes cgroup quotas into account. Sinceavailable_parallelism
is often used to create a thread pool for parallel computation, which may be CPU-bound for performance,available_parallelism
will 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_parallelism
will return 4.
Stabilized APIs
Pin::static_mut
Pin::static_ref
Vec::retain_mut
VecDeque::retain_mut
Write
forCursor<[u8; N]>
std::os::unix::net::SocketAddr::from_pathname
std::process::ExitCode
andstd::process::Termination
. The stabilization of these two APIs now makes it possible for programs to return errors frommain
with custom exit codes.std::thread::JoinHandle::is_finished
These APIs are now usable in const contexts:
<*const T>::offset
and<*mut T>::offset
<*const T>::wrapping_offset
and<*mut T>::wrapping_offset
<*const T>::add
and<*mut T>::add
<*const T>::sub
and<*mut T>::sub
<*const T>::wrapping_add
and<*mut T>::wrapping_add
<*const T>::wrapping_sub
and<*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-archive
in some cases, but now rustc tries not to usewhole-archive
unless 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
a
depends onb
thena
should go first andb
second) - (less common) or be updated to use the
+whole-archive
modifier.
- (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
ident
matchers 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 vendor
now only accepts one value for each--sync
flagcfg
predicates 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 ofall
to 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-static
andrelocation-model=pic
onx86_64-unknown-linux-gnu
- Fixes wrong
unreachable_pub
lints on nested and glob public reexport - Stabilize
-Z instrument-coverage
as-C instrument-coverage
- Stabilize
-Z print-link-args
as--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=full
by 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
/f64
accuracy by directly processing exponent and mantissa - Make
Instant::{duration_since, elapsed, sub}
saturating - Remove non-monotonic clocks workarounds in
Instant::now
- Make
BuildHasherDefault
,iter::Empty
andfuture::Pending
covariant
Stabilized APIs
Arc::new_cyclic
Rc::new_cyclic
slice::EscapeAscii
<[u8]>::escape_ascii
u8::escape_ascii
Vec::spare_capacity_mut
MaybeUninit::assume_init_drop
MaybeUninit::assume_init_read
i8::abs_diff
i16::abs_diff
i32::abs_diff
i64::abs_diff
i128::abs_diff
isize::abs_diff
u8::abs_diff
u16::abs_diff
u32::abs_diff
u64::abs_diff
u128::abs_diff
usize::abs_diff
Display for io::ErrorKind
From<u8> for ExitCode
Not for !
(the "never" type)- Op
Assign<$t> for Wrapping<$t>
arch::is_aarch64_feature_detected!
Cargo
- Port cargo from
toml-rs
totoml_edit
- Stabilize
-Ztimings
as--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 to0
instead. 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 in0
rather 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-incompat
as--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_parallelism
Result::copied
Result::cloned
arch::asm!
arch::global_asm!
ops::ControlFlow::is_break
ops::ControlFlow::is_continue
TryFrom<char> for u8
char::TryFromCharError
implementingClone
,Debug
,Display
,PartialEq
,Copy
,Eq
,Error
iter::zip
NonZeroU8::is_power_of_two
NonZeroU16::is_power_of_two
NonZeroU32::is_power_of_two
NonZeroU64::is_power_of_two
NonZeroU128::is_power_of_two
NonZeroUsize::is_power_of_two
DoubleEndedIterator for ToLowercase
DoubleEndedIterator for ToUppercase
TryFrom<&mut [T]> for [T; N]
UnwindSafe for Once
RefUnwindSafe for Once
- armv8 neon intrinsics for aarch64
Const-stable:
mem::MaybeUninit::as_ptr
mem::MaybeUninit::assume_init
mem::MaybeUninit::assume_init_ref
ffi::CStr::from_bytes_with_nul_unchecked
Cargo
- Stabilize the
strip
profile option - Stabilize future-incompat-report
- Support abbreviating
--release
as-r
- Support
term.quiet
configuration - Remove
--host
from 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_format
Clippy lint - Move
non_send_fields_in_send_ty
Clippy 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 T
pointers can now be dereferenced in const contexts.- The rules for when a generic struct implements
Unsize
have 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
strip
option 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-none
at 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
copy
andcopy_nonoverlapping
- Implement
RefUnwindSafe
forRc<T>
- Make RSplit<T, P>: Clone not require T: Clone
- Implement
Termination
forResult<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 usesexec
to run another program).
Stabilized APIs
Metadata::is_symlink
Path::is_symlink
{integer}::saturating_div
Option::unwrap_unchecked
Result::unwrap_unchecked
Result::unwrap_err_unchecked
File::options
These APIs are now usable in const contexts:
Duration::new
Duration::checked_add
Duration::saturating_add
Duration::checked_sub
Duration::saturating_sub
Duration::checked_mul
Duration::saturating_mul
Duration::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::Command
will 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
Clone
andDebug
implementations during dead code analysis.
Compiler
- Create more accurate debuginfo for vtables.
- Add
armv6k-nintendo-3ds
at Tier 3*. - Add
armv7-unknown-linux-uclibceabihf
at Tier 3*. - Add
m68k-unknown-linux-gnu
at 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_end
andread_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_slice
collections::TryReserveError
HashMap::try_reserve
HashSet::try_reserve
String::try_reserve
String::try_reserve_exact
Vec::try_reserve
Vec::try_reserve_exact
VecDeque::try_reserve
VecDeque::try_reserve_exact
Iterator::map_while
iter::MapWhile
proc_macro::is_available
Command::get_program
Command::get_args
Command::get_envs
Command::get_current_dir
CommandArgs
CommandEnvs
These APIs are now usable in const contexts:
Cargo
Compatibility notes
- Ignore derived
Clone
andDebug
implementations 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 @ pattern
can 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-sim
to Tier 2*. - Add
powerpc-unknown-freebsd
at Tier 3*. - Add
riscv32imc-esp-espidf
at 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: Unpin
bound 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::chroot
UnsafeCell::raw_get
BufWriter::into_parts
core::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}
These APIs were previously stable instd
, but are now also available incore
.Vec::shrink_to
String::shrink_to
OsString::shrink_to
PathBuf::shrink_to
BinaryHeap::shrink_to
VecDeque::shrink_to
HashMap::shrink_to
HashSet::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_MACROS
warn by default - Warn when an escaped newline skips multiple lines.
- Calls to
libc::getpid
/std::process::id
fromCommand::pre_exec
may return different values on glibc <= 2.24. Rust now invokes theclone3
system 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 cachegetpid
for 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 atX
and 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::Drain
now implementsAsRef<str>
andAsRef<[u8]>
.
Stabilised APIs
Bound::cloned
Drain::as_str
IntoInnerError::into_error
IntoInnerError::into_parts
MaybeUninit::assume_init_mut
MaybeUninit::assume_init_ref
MaybeUninit::write
array::map
ops::ControlFlow
x86::_bittest
x86::_bittestandcomplement
x86::_bittestandreset
x86::_bittestandset
x86_64::_bittest64
x86_64::_bittestandcomplement64
x86_64::_bittestandreset64
x86_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 metadata
now includes the"default_run"
field from the manifest. - Added
cargo d
as an alias forcargo doc
. - Added
{lib}
as formatting option forcargo tree
to 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+F
in 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::Error
will no longer use theErrorKind::Other
variant. This is to better reflect that these kinds of errors could be categorised into newer more specificErrorKind
variants, and that they do not represent a user error. - Using environment variable names with
process::Command
on Windows now behaves as expected. Previously using environment variables withCommand
would cause them to be ASCII-uppercased. - Rustdoc will now warn on using rustdoc lints that aren't prefixed
with
rustdoc::
RUSTFLAGS
is no longer set for build scripts. Build scripts should useCARGO_ENCODED_RUSTFLAGS
instead. 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 Trait
where 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.json
where/
is the "sysroot" directory. You can find your sysroot directory by runningrustc --print sysroot
. - Added
wasm
as atarget_family
for 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-none
andbpfeb-unknown-none
. -Zmutable-noalias=yes
is 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_any
will now#[track_caller]
.- Added
OutOfMemory
as a variant ofio::ErrorKind
. -
proc_macro::Literal
now 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_keys
BTreeMap::into_values
HashMap::into_keys
HashMap::into_values
arch::wasm32
VecDeque::binary_search
VecDeque::binary_search_by
VecDeque::binary_search_by_key
VecDeque::partition_point
Cargo
- Added the
--prune <spec>
option tocargo-tree
to remove a package from the dependency graph. - Added the
--depth
option tocargo-tree
to print only to a certain depth in the tree - Added the
no-proc-macro
value tocargo-tree --edges
to hide procedural macro dependencies. - A new environment variable named
CARGO_TARGET_TMPDIR
is 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::arch
intrinsics now uses stricter const checking than before and may reject some previously accepted code. i128
multiplication 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_param
macro_rules!
matcher. This matcher has the same semantics as the:pat
matcher. This is to allow:pat
to 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-unknown
target. - 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_message
on 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 changeItem
toT
. CallingIntoIterator::into_iter
directly on arrays will provideimpl Iterator<Item=T>
as expected. leading_zeros
, andtrailing_zeros
are now available on allNonZero
integer types.{f32, f64}::from_str
now parse and print special values (NaN
,-0
) according to IEEE 754.- You can now index into slices using
(Bound<usize>, Bound<usize>)
. - Add the
BITS
associated constant to all numeric types.
Stabilised APIs
AtomicBool::fetch_update
AtomicPtr::fetch_update
BTreeMap::retain
BTreeSet::retain
BufReader::seek_relative
DebugStruct::non_exhaustive
Duration::MAX
Duration::ZERO
Duration::is_zero
Duration::saturating_add
Duration::saturating_mul
Duration::saturating_sub
ErrorKind::Unsupported
Option::insert
Ordering::is_eq
Ordering::is_ge
Ordering::is_gt
Ordering::is_le
Ordering::is_lt
Ordering::is_ne
OsStr::is_ascii
OsStr::make_ascii_lowercase
OsStr::make_ascii_uppercase
OsStr::to_ascii_lowercase
OsStr::to_ascii_uppercase
Peekable::peek_mut
Rc::decrement_strong_count
Rc::increment_strong_count
Vec::extend_from_within
array::from_mut
array::from_ref
cmp::max_by_key
cmp::max_by
cmp::min_by_key
cmp::min_by
f32::is_subnormal
f64::is_subnormal
Cargo
- Cargo now supports git repositories where the default
HEAD
branch is not "master". This also includes a switch to the version 3Cargo.lock
format which can handle default branches correctly. - macOS targets now default to
unpacked
split-debuginfo. - The
authors
field is no longer included inCargo.toml
for new projects.
Rustdoc
Compatibility Notes
- Implement token-based handling of attributes during expansion
Ipv4::from_str
will 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
BITS
constant may conflict with external definitions. In particular, this was known to be a problem in thelexical-core
crate, 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=1
environment 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::alloc
implementation. - 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_fn
lint, which checks whether the unsafe code in anunsafe fn
is wrapped in aunsafe
block. 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-musl
riscv32gc-unknown-linux-musl
&riscv64gc-unknown-linux-musl
powerpc-unknown-openbsd
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
OsString
now implementsExtend
andFromIterator
.cmp::Reverse
now has#[repr(transparent)]
representation.Arc<impl Error>
now implementserror::Error
.- All integer division and remainder operations are now
const
.
Stabilised APIs
Arguments::as_str
char::MAX
char::REPLACEMENT_CHARACTER
char::UNICODE_VERSION
char::decode_utf16
char::from_digit
char::from_u32_unchecked
char::from_u32
slice::partition_point
str::rsplit_once
str::split_once
The following previously stable APIs are now const
.
char::len_utf8
char::len_utf16
char::to_ascii_uppercase
char::to_ascii_lowercase
char::eq_ignore_ascii_case
u8::to_ascii_uppercase
u8::to_ascii_lowercase
u8::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 bar
will run all tests that matchfoo
andbar
. - Rustup now distributes PDB symbols for the
std
library on Windows, allowing you to seestd
symbols 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-netbsd
target. - Deprecated the
x86_64-sun-solaris
target in favor ofx86_64-pc-solaris
. - Rustdoc now only accepts
,
,\t
as 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-hack
versions. Acargo update
should 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
struct
s 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
, orchar
types 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-debuginfo
codegen 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_ilp32
targets. - Added tier 3 support for
i386-unknown-linux-gnu
andi486-unknown-linux-gnu
targets. - The
target-cpu=native
option 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::downcast
is now also implemented for anydyn Any + Send + Sync
object.str
now implementsAsMut<str>
.u64
andu128
now implementFrom<char>
.Error
is now implemented for&T
whereT
implementsError
.Poll::{map_ok, map_err}
are now implemented forPoll<Option<Result<T, E>>>
.unsigned_abs
is now implemented for all signed integer types.io::Empty
now implementsio::Seek
.rc::Weak<T>
andsync::Weak<T>
's methods such asas_ptr
are now implemented forT: ?Sized
types.Div
andRem
by theirNonZero
variant is now implemented for all unsigned integers.
Stabilized APIs
Arc::decrement_strong_count
Arc::increment_strong_count
Once::call_once_force
Peekable::next_if_eq
Peekable::next_if
Seek::stream_position
array::IntoIter
panic::panic_any
ptr::addr_of!
ptr::addr_of_mut!
slice::fill_with
slice::split_inclusive_mut
slice::split_inclusive
slice::strip_prefix
slice::strip_suffix
str::split_inclusive
sync::OnceState
task::Wake
VecDeque::range
VecDeque::range_mut
Cargo
- Added the
split-debuginfo
profile option to control the -Csplit-debuginfo codegen option. - Added the
resolver
field toCargo.toml
to 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 astd
feature in a build scripts and proc-macros, while using theno-std
feature 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
Deref
traits. - You can now provide a
--default-theme
flag 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-bindgen
ABI, and instead use the wasm32 ABI. rustc
no longer promotes division, modulo and indexing operations toconst
that 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-gnueabi
sparc64-unknown-linux-gnu
thumbv7neon-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabi
x86_64-unknown-linux-gnux32
atomic::spin_loop_hint
has been deprecated. It's recommended to usehint::spin_loop
instead.
Internal Only
Version 1.50.0 (2021-02-11)
Language
- You can now use
const
values forx
in[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-uclibceabi
target. - Added tier 3 support for the
aarch64-apple-ios-macabi
target. - The
x86_64-unknown-freebsd
is 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::Punct
now implementsPartialEq<char>
.ops::{Index, IndexMut}
are now implemented for fixed sized arrays of any length.- On Unix platforms, the
std::fs::File
type 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::then
btree_map::Entry::or_insert_with_key
f32::clamp
f64::clamp
hash_map::Entry::or_insert_with_key
Ord::clamp
RefCell::take
slice::fill
UnsafeCell::get_mut
The following previously stable methods are now const
.
IpAddr::is_ipv4
IpAddr::is_ipv6
IpAddr::is_unspecified
IpAddr::is_loopback
IpAddr::is_multicast
Ipv4Addr::octets
Ipv4Addr::is_loopback
Ipv4Addr::is_private
Ipv4Addr::is_link_local
Ipv4Addr::is_multicast
Ipv4Addr::is_broadcast
Ipv4Addr::is_documentation
Ipv4Addr::to_ipv6_compatible
Ipv4Addr::to_ipv6_mapped
Ipv6Addr::segments
Ipv6Addr::is_unspecified
Ipv6Addr::is_loopback
Ipv6Addr::is_multicast
Ipv6Addr::to_ipv4
Layout::size
Layout::align
Layout::from_size_align
pow
for all integer types.checked_pow
for all integer types.saturating_pow
for all integer types.wrapping_pow
for all integer types.next_power_of_two
for all unsigned integer types.checked_next_power_of_two
for 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-changed
will now, if provided a directory, scan the entire contents of that directory for changes.- Added the
--workspace
flag to thecargo update
command.
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_swap
method on atomics has been deprecated. It's recommended to use thecompare_exchange
andcompare_exchange_weak
methods instead. - Changes in how
TokenStream
s 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_unstable
lint.- Overriding a
forbid
lint 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
RangeInclusive
now checks for exhaustion when callingcontains
and indexing.ToString::to_string
now 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-package
should now be independently reproducible. cargo-tree
now marks proc-macro crates.- Added
CARGO_PRIMARY_PACKAGE
build-time environment variable. This variable will be set if the crate being built is one the user selected to build, either with-p
or through defaults. - You can now use glob patterns when specifying packages & targets.
Compatibility Notes
- Demoted
i686-unknown-freebsd
from 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-exec
Thread Local Storage model. - Calculate visibilities once in resolve.
- Added
system
to thellvm-libunwind
bootstrap config option. - Added
--color
for configuring terminal color support to bootstrap.
Version 1.48.0 (2020-11-19)
Language
- The
unsafe
keyword 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 tellsrustc
whether to link its own C runtime and libraries or to rely on a external linker to find them. (Supported only onwindows-gnu
,linux-musl
, andwasi
platforms.) - You can now use
-C target-feature=+crt-static
onlinux-gnu
targets. Note: If you're using cargo you must explicitly pass the--target
flag. - 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::Write
is 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_some
Option::is_none
Option::as_ref
Result::is_ok
Result::is_err
Result::as_ref
Ordering::reverse
Ordering::then
Cargo
Rustdoc
- You can now link to items in
rustdoc
using 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
'static
lifetime insideconst fn
now follows the same rules as inside afn
body. In particular,&foo()
will not be promoted to'static
lifetime any more insideconst fn
s. - 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.
&mut
references to non zero-sized types are no longer promoted.rustc
will now warn if you use attributes like#[link_name]
or#[cold]
in places where they have no effect.- Updated
_mm256_extract_epi8
and_mm256_extract_epi16
signatures inarch::{x86, x86_64}
to returni32
to match the vendor signatures. mem::uninitialized
will 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_unwind
and will cause an abort. Note: This behaviour is not guaranteed and is still considered undefined behaviour, see thecatch_unwind
documentation 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
rustc
from source now usesninja
by default overmake
. You can continue building withmake
by settingninja=false
in yourconfig.toml
. - cg_llvm:
fewer_names
inuncached_llvm_type
- Made
ensure_sufficient_stack()
non-generic
Version 1.47.0 (2020-10-08)
Language
Compiler
- Stabilized the
-C control-flow-guard
codegen 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-eabi
target. - 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
CStr
now implementsIndex<RangeFrom<usize>>
.- Traits in
std
/core
are now implemented for arrays of any length, not just those of length less than 33. ops::RangeFull
andops::Range
now implement Default.panic::Location
now implementsCopy
,Clone
,Eq
,Hash
,Ord
,PartialEq
, andPartialOrd
.
Stabilized APIs
Ident::new_raw
Range::is_empty
RangeInclusive::is_empty
Result::as_deref
Result::as_deref_mut
Vec::leak
pointer::offset_from
f32::TAU
f64::TAU
The following previously stable APIs have now been made const.
- The
new
method for allNonZero
integers. - The
checked_add
,checked_sub
,checked_mul
,checked_neg
,checked_shl
,checked_shr
,saturating_add
,saturating_sub
, andsaturating_mul
methods for all integers. - The
checked_abs
,saturating_abs
,saturating_neg
, andsignum
for 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_control
methods forchar
andu8
.
Cargo
build-dependencies
are 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 = 3
cargo-help
will now display man pages for commands rather just the--help
text.cargo-metadata
now emits atest
field indicating if a target has tests enabled.workspace.default-members
now respectsworkspace.exclude
.cargo-publish
will 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
{} && false
in 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-gnu
targets now require minimum kernel 2.6.32 and glibc 2.11.- Added the
rustc-docs
component. 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.py
defaults" post on the Inside Rust blog.
Version 1.46.0 (2020-08-27)
Language
if
,match
, andloop
expressions 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.0
over(x.0).0
. mem::transmute
can now be used in statics and constants. Note You currently can't usemem::transmute
in constant functions.
Compiler
- You can now use the
cdylib
target on Apple iOS and tvOS platforms. - Enabled static "Position Independent Executables" by default
for
x86_64-unknown-linux-musl
.
Libraries
mem::forget
is now aconst fn
.String
now implementsFrom<char>
.- The
leading_ones
, andtrailing_ones
methods have been stabilised for all integer types. vec::IntoIter<T>
now implementsAsRef<[T]>
.- All non-zero integer types (
NonZeroU8
) now implementTryFrom
for 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_NAME
andCARGO_CRATE_NAME
Providing the name of the specific binary being compiled and the name of the crate.CARGO_PKG_LICENSE
The license from the manifest of the package.CARGO_PKG_LICENSE_FILE
The path to the license file.
Compatibility Notes
- The target configuration option
abi_blacklist
has 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 onenum
s. - 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}::asinh
now 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
rustc
would 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 forrustc
to 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
as
has been defined as a saturating conversion. This was previously undefined behaviour, but you can use the{f64, f32}::to_int_unchecked
methods 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-feature
flag. E.g.-C target-feature=+avx2 -C target-feature=+fma
is now equivalent to-C target-feature=+avx2,+fma
. - Added the
force-unwind-tables
flag. This option allows rustc to always generate unwind tables regardless of panic strategy. - Added the
embed-bitcode
flag. This codegen flag allows rustc to include LLVM bitcode into generatedrlib
s (this is on by default). - Added the
tiny
value to thecode-model
codegen flag. - Added tier 3 support* for the
mipsel-sony-psp
target. - Added tier 3 support for the
thumbv7a-uwp-windows-msvc
target. - 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 implementsPartialOrd
andOrd
.proc_macro::TokenStream
now implementsDefault
.- You can now use
char
withops::{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"
OsString
now implementsFromStr
.- The
saturating_neg
method has been added to all signed integer primitive types, and thesaturating_abs
method has been added for all integer primitive types. Arc<T>
,Rc<T>
now implementFrom<Cow<'_, T>>
, andBox
now implementsFrom<Cow>
whenT
is[T: Copy]
,str
,CStr
,OsStr
, orPath
.Box<[T]>
now implementsFrom<[T; N]>
.BitOr
andBitOrAssign
are implemented for allNonZero
integer types.- The
fetch_min
, andfetch_max
methods have been added to all atomic integer types. - The
fetch_update
method has been added to all atomic integer types.
Stabilized APIs
Arc::as_ptr
BTreeMap::remove_entry
Rc::as_ptr
rc::Weak::as_ptr
rc::Weak::from_raw
rc::Weak::into_raw
str::strip_prefix
str::strip_suffix
sync::Weak::as_ptr
sync::Weak::from_raw
sync::Weak::into_raw
char::UNICODE_VERSION
Span::resolved_at
Span::located_at
Span::mixed_site
unix::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}::powi
now returns a slightly different value on Windows. This is due to changes in LLVM's intrinsics which{f32, f64}::powi
uses.- 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
lto
flag is incompatible with the newembed-bitcode=no
. This may cause issues if LTO is enabled throughRUSTFLAGS
orcargo rustc
flags while cargo is addingembed-bitcode
itself. The recommended way to control LTO is with Cargo profiles, either inCargo.toml
or.cargo/config
, or by settingCARGO_PROFILE_<name>_LTO
in 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-units
flag in incremental mode. Additionally when in incremental mode rustc defaults to 256 codegen units. - Refactored
catch_unwind
to have zero-cost, unless unwinding is enabled and a panic is thrown. - Added tier 3* support for the
aarch64-unknown-none
andaarch64-unknown-none-softfloat
targets. - Added tier 3 support for
arm64-apple-tvos
andx86_64-apple-tvos
targets.
Libraries
- Special cased
vec![]
to map directly toVec::new()
. This allowsvec![]
to be able to be used inconst
contexts. convert::Infallible
now implementsHash
.OsString
now implementsDerefMut
andIndexMut
returning a&mut OsStr
.- Unicode 13 is now supported.
String
now implementsFrom<&mut str>
.IoSlice
now implementsCopy
.Vec<T>
now implementsFrom<[T; N]>
. WhereN
is at most 32.proc_macro::LexError
now implementsfmt::Display
andError
.from_le_bytes
,to_le_bytes
,from_be_bytes
,to_be_bytes
,from_ne_bytes
, andto_ne_bytes
methods are nowconst
for all integer types.
Stabilized APIs
PathBuf::with_capacity
PathBuf::capacity
PathBuf::clear
PathBuf::reserve
PathBuf::reserve_exact
PathBuf::shrink_to_fit
f32::to_int_unchecked
f64::to_int_unchecked
Layout::align_to
Layout::pad_to_align
Layout::array
Layout::extend
Cargo
- Added the
cargo tree
command 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
.a
extension, rather than the previous.lib
. - Removed the
-C no_integrated_as
flag from rustc. - The
file_name
property 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
f64
tou32
using theas
operator has been defined as a saturating operation. This was previously undefined behaviour, but you can use the{f64, f32}::to_int_unchecked
methods 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 --list
not 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 onif
expressions.
Syntax only changes
- Allow
type Foo: Ord
syntactically. - Fuse associated and extern items up to defaultness.
- Syntactically allow
self
in allfn
contexts. - Merge
fn
syntax + cleanup item parsing. item
macro fragments can be interpolated intotrait
s,impl
s, andextern
blocks. 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-variables
denies everything in theunused
lint group exceptunused-variables
which is explicitly allowed. However, passingrustc -A unused-variables -D unused
denies everything in theunused
lint group includingunused-variables
since 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 whenN
is0..=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::MAX
orf32::NAN
with no imports. u8::is_ascii
is nowconst
.String
now implementsAsMut<str>
.- Added the
primitive
module tostd
andcore
. 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
HashMap
andHashSet
. string::FromUtf8Error
now 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-program
you would useenv!("CARGO_BIN_EXE_my-program")
.
Misc
- Certain checks in the
const_err
lint were deemed unrelated to const evaluation, and have been moved to theunconditional_panic
andarithmetic_overflow
lints.
Compatibility Notes
- Having trailing syntax in the
assert!
macro is now a hard error. This has been a warning since 1.36.0. - Fixed
Self
not 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=3
instead 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
Drop
terminators 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 univariantenum
s. 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:
default
is syntactically allowed before items intrait
definitions.- Items in
impl
s (i.e.const
s,type
s, andfn
s) may syntactically leave out their bodies in favor of;
. - Bounds on associated types in
impl
s 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 implementsSend
andSync
for anyT
.Pin::{map_unchecked, map_unchecked_mut}
no longer require the return type to implementSized
.io::Cursor
now derivesPartialEq
andEq
.Layout::new
is nowconst
.- Added Standard Library support for
riscv64gc-unknown-linux-gnu
.
Stabilized APIs
CondVar::wait_while
CondVar::wait_timeout_while
DebugMap::key
DebugMap::value
ManuallyDrop::take
matches!
ptr::slice_from_raw_parts_mut
ptr::slice_from_raw_parts
Cargo
Compatibility Notes
Error::description
has been deprecated, and its use will now produce a warning. It's recommended to useDisplay
/to_string
instead.
Version 1.41.1 (2020-02-27)
- Always check types of static items
- Always check lifetime bounds of
Copy
impls - 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
self
position. 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_args
macro. 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
'label
s. - Removed support for the
i686-unknown-dragonfly
target. - Added tier 3 support* for the
riscv64gc-unknown-linux-gnu
target. - You can now pass an arguments file passing the
@path
syntax 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
--extern
flag without a path, indicating that it is available from the search path or specified with an-L
flag.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- The
core::panic
module is now stable. It was already stable throughstd
. NonZero*
numerics now implementFrom<NonZero*>
if it's a smaller integer width. E.g.NonZeroU16
now implementsFrom<NonZeroU8>
.MaybeUninit<T>
now implementsfmt::Debug
.
Stabilized APIs
Result::map_or
Result::map_or_else
std::rc::Weak::weak_count
std::rc::Weak::strong_count
std::sync::Weak::weak_count
std::sync::Weak::strong_count
Cargo
- Cargo will now document all the private items for binary crates by default.
cargo-install
will 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 = 2
sets theimage
crate's optimisation level to2
for debug builds. You can also use[profile.<profile>.build-override]
to override build scripts and their dependencies.
Misc
- You can now specify
edition
in documentation code blocks to compile the block for that edition. E.g.edition2018
tells 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
struct
s and tupleenum
variant's constructors inconst
contexts. e.g.pub struct Point(i32, i32); const ORIGIN: Point = { let constructor = Point; constructor(0, 0) };
-
You can now mark
struct
s,enum
s, andenum
variants 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
extern
blocks and in type positions. e.g.type Generated = macro!();
-
The
meta
pattern 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-musleabihf
target. - Added tier 3 support for the
aarch64-unknown-none-softfloat
target. - Added tier 3 support for the
mips64-unknown-linux-muslabi64
, andmips64el-unknown-linux-muslabi64
targets.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Stabilized APIs
BTreeMap::get_key_value
HashMap::get_key_value
Option::as_deref_mut
Option::as_deref
Option::flatten
UdpSocket::peer_addr
f32::to_be_bytes
f32::to_le_bytes
f32::to_ne_bytes
f64::to_be_bytes
f64::to_le_bytes
f64::to_ne_bytes
f32::from_be_bytes
f32::from_le_bytes
f32::from_ne_bytes
f64::from_be_bytes
f64::from_le_bytes
f64::from_ne_bytes
mem::take
slice::repeat
todo!
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-dependencies
without 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_attribute
lint. Using#[inline]
anywhere else inside traits orextern
blocks now correctly emits a hard error.
Version 1.39.0 (2019-11-07)
Language
- You can now create
async
functions and blocks withasync fn
,async move {}
, andasync {}
respectively, and you can now call.await
on async expressions. - You can now use certain attributes on function, closure, and function pointer
parameters. These attributes include
cfg
,cfg_attr
,allow
,warn
,deny
,forbid
as 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
if
guards ofmatch
arms. 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-uefi
target. - Added tier 3 support for the
sparc64-unknown-openbsd
target. - 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-output
argument 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::new
andString::new
are nowconst
functions.LinkedList::new
is now aconst
function.str::len
,[T]::len
andstr::as_bytes
are nowconst
functions.- The
abs
,wrapping_abs
, andoverflowing_abs
numeric functions are nowconst
.
Stabilized APIs
Cargo
- You can now publish git dependencies if supplied with a
version
. - The
--all
flag has been renamed to--workspace
. Using--all
is 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.
rustdoc
now requiresrustc
to 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-msvc
targets. - Added tier 3 support for the
armv7-unknown-linux-gnueabi
andarmv7-unknown-linux-musleabi
targets. - Added tier 3 support for the
hexagon-unknown-linux-musl
target. - Added tier 3 support for the
riscv32i-unknown-none-elf
target. - Upgraded to LLVM 9.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
ascii::EscapeDefault
now implementsClone
andDisplay
.- Derive macros for prelude traits (e.g.
Clone
,Debug
,Hash
) are now available at the same path as the trait. (e.g. TheClone
derive macro is available atstd::clone::Clone
). This also makes all built-in macros available instd
/core
root. e.g.std::include_bytes!
. str::Chars
now implementsDebug
.slice::{concat, connect, join}
now accepts&[T]
in addition to&T
.*const T
and*mut T
now 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
, andwrapping
versions are available for all integer primitives. thread::AccessError
now implementsClone
,Copy
,Eq
,Error
, andPartialEq
.iter::{StepBy, Peekable, Take}
now implementDoubleEndedIterator
.
Stabilized APIs
<*const T>::cast
<*mut T>::cast
Duration::as_secs_f32
Duration::as_secs_f64
Duration::div_f32
Duration::div_f64
Duration::from_secs_f32
Duration::from_secs_f64
Duration::mul_f32
Duration::mul_f64
any::type_name
Cargo
- Added pipelined compilation support to
cargo
. - You can now pass the
--features
option multiple times to enable multiple features.
Rustdoc
Misc
Compatibility Notes
- The
x86_64-unknown-uefi
platform can not be built with rustc 1.38.0. - The
armv7-unknown-linux-gnueabihf
platform 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
cfg
andcfg_attr
attributes 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-generate
and-C profile-use
flags. For more information on how to use profile guided optimization, please refer to the rustc book. - The
rust-lldb
wrapper script should now work again.
Libraries
Stabilized APIs
BufReader::buffer
BufWriter::buffer
Cell::from_mut
Cell<[T]>::as_slice_of_cells
DoubleEndedIterator::nth_back
Option::xor
Wrapping::reverse_bits
i128::reverse_bits
i16::reverse_bits
i32::reverse_bits
i64::reverse_bits
i8::reverse_bits
isize::reverse_bits
slice::copy_within
u128::reverse_bits
u16::reverse_bits
u32::reverse_bits
u64::reverse_bits
u8::reverse_bits
usize::reverse_bits
Cargo
Cargo.lock
files 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
dyn
will now warn by default. Please transition your code to usedyn Trait
for 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::Debug
is now equivalent todyn fmt::Debug + Send
, where this was previously not the case.
Libraries
HashMap
's implementation has been replaced withhashbrown::HashMap
implementation.TryFromSliceError
now implementsFrom<Infallible>
.mem::needs_drop
is now available as a const fn.alloc::Layout::from_size_align_unchecked
is now available as a const fn.String
now implementsBorrowMut<str>
.io::Cursor
now implementsDefault
.- Both
NonNull::{dangling, cast}
are now const fns. - The
alloc
crate is now stable.alloc
allows you to use a subset ofstd
(e.g.Vec
,Box
,Arc
) in#![no_std]
environments if the environment has access to heap memory allocation. String
now 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_left
VecDeque::rotate_right
Iterator::copied
io::IoSlice
io::IoSliceMut
Read::read_vectored
Write::write_vectored
str::as_mut_ptr
mem::MaybeUninit
pointer::align_offset
future::Future
task::Context
task::RawWaker
task::RawWakerVTable
task::Waker
task::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
--offline
flag 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::uninitialized
use is no longer recommended, and will be deprecated in 1.39.0.
Version 1.35.0 (2019-05-23)
Language
FnOnce
,FnMut
, and theFn
traits 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-gnueabihf
andarmv7-unknown-freebsd-gnueabihf
targets. - Added the
wasm32-unknown-wasi
target.
Libraries
Thread
will now show its ID inDebug
output.StdinLock
,StdoutLock
, andStderrLock
now implementAsRawFd
.alloc::System
now implementsDefault
.- Expanded
Debug
output ({:#?}
) for structs now has a trailing comma on the last field. char::{ToLowercase, ToUppercase}
now implementExactSizeIterator
.- All
NonZero
numeric types now implementFromStr
. - Removed the
Read
trait 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 implementSync
andSend
.
Stabilized APIs
f32::copysign
f64::copysign
RefCell::replace_with
RefCell::map_split
ptr::hash
Range::contains
RangeFrom::contains
RangeTo::contains
RangeInclusive::contains
RangeToInclusive::contains
Option::copied
Cargo
- You can now set
cargo:rustc-cdylib-link-arg
at 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_closure
Clippy lint - Fix false positives for the
missing_const_for_fn
Clippy 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-elf
andriscv64gc-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 theHash
trait to create an iterator. - The
Ord
trait bounds have been removed on some ofBinaryHeap<T>
's basic methods. Most notably you no longer require theOrd
trait to create an iterator. - The methods
overflowing_neg
andwrapping_neg
are nowconst
functions for all numeric types. - Indexing a
str
is now generic over all types that implementSliceIndex<str>
. str::trim
,str::trim_matches
,str::trim_{start, end}
, andstr::trim_{start, end}_matches
are now#[must_use]
and will produce a warning if their returning type is unused.- The methods
checked_pow
,saturating_pow
,wrapping_pow
, andoverflowing_pow
are now available for all numeric types. These are equivalent to methods such aswrapping_add
for thepow
operation.
Stabilized APIs
std & core
Any::type_id
Error::type_id
atomic::AtomicI16
atomic::AtomicI32
atomic::AtomicI64
atomic::AtomicI8
atomic::AtomicU16
atomic::AtomicU32
atomic::AtomicU64
atomic::AtomicU8
convert::Infallible
convert::TryFrom
convert::TryInto
iter::from_fn
iter::successors
num::NonZeroI128
num::NonZeroI16
num::NonZeroI32
num::NonZeroI64
num::NonZeroI8
num::NonZeroIsize
slice::sort_by_cached_key
str::escape_debug
str::escape_default
str::escape_unicode
str::split_ascii_whitespace
std
Cargo
Misc
Compatibility Notes
Command::before_exec
is being replaced by the unsafe methodCommand::pre_exec
and will be deprecated with Rust 1.37.0.- Use of
ATOMIC_{BOOL, ISIZE, USIZE}_INIT
is now deprecated as you can now useconst
functions instatic
variables.
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
u8
that covers0..=255
and you would no longer be required to have a_ => unreachable!()
case. - You can now have multiple patterns in
if let
andwhile let
expressions. You can do this with the same syntax as amatch
expression. 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 let
andwhile let
patterns. Using this feature will by default produce a warning as this behaviour can be unintuitive. E.g.if let _ = 5 {}
- You can now use
let
bindings, 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_attr
attribute. 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
, andPin
as method receivers.
Compiler
- You can now set a linker flavor for
rustc
with the-Clinker-flavor
command 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-sgx
target 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-androideabi
andthumbv7neon-unknown-linux-gnueabihf
targets. - Added support for the
x86_64-unknown-uefi
target.
Libraries
- The methods
overflowing_{add, sub, mul, shl, shr}
are nowconst
functions for all numeric types. - The methods
rotate_left
,rotate_right
, andwrapping_{add, sub, mul, shl, shr}
are nowconst
functions for all numeric types. - The methods
is_positive
andis_negative
are nowconst
functions for all signed numeric types. - The
get
method for allNonZero
types is nowconst
. - The methods
count_ones
,count_zeros
,leading_zeros
,trailing_zeros
,swap_bytes
,from_be
,from_le
,to_be
,to_le
are nowconst
for all numeric types. Ipv4Addr::new
is now aconst
function
Stabilized APIs
unix::FileExt::read_exact_at
unix::FileExt::write_all_at
Option::transpose
Result::transpose
convert::identity
pin::Pin
marker::Unpin
marker::PhantomPinned
Vec::resize_with
VecDeque::resize_with
Duration::as_millis
Duration::as_micros
Duration::as_nanos
Cargo
- You can now publish crates that require a feature flag to compile with
cargo publish --features
orcargo 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::cause
method has been deprecated in favor ofError::source
which 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
literal
specifier. 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 Trait
ordyn Trait
is 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-msvc
target.
Libraries
PathBuf
now 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_ptr
UnsafeCell::get
char::is_ascii
iter::empty
ManuallyDrop::new
ManuallyDrop::into_inner
RangeInclusive::start
RangeInclusive::end
NonNull::as_ptr
slice::as_ptr
str::as_ptr
Duration::as_secs
Duration::subsec_millis
Duration::subsec_micros
Duration::subsec_nanos
CStr::as_ptr
Ipv4Addr::is_unspecified
Ipv6Addr::new
Ipv6Addr::octets
Stabilized APIs
i8::to_be_bytes
i8::to_le_bytes
i8::to_ne_bytes
i8::from_be_bytes
i8::from_le_bytes
i8::from_ne_bytes
i16::to_be_bytes
i16::to_le_bytes
i16::to_ne_bytes
i16::from_be_bytes
i16::from_le_bytes
i16::from_ne_bytes
i32::to_be_bytes
i32::to_le_bytes
i32::to_ne_bytes
i32::from_be_bytes
i32::from_le_bytes
i32::from_ne_bytes
i64::to_be_bytes
i64::to_le_bytes
i64::to_ne_bytes
i64::from_be_bytes
i64::from_le_bytes
i64::from_ne_bytes
i128::to_be_bytes
i128::to_le_bytes
i128::to_ne_bytes
i128::from_be_bytes
i128::from_le_bytes
i128::from_ne_bytes
isize::to_be_bytes
isize::to_le_bytes
isize::to_ne_bytes
isize::from_be_bytes
isize::from_le_bytes
isize::from_ne_bytes
u8::to_be_bytes
u8::to_le_bytes
u8::to_ne_bytes
u8::from_be_bytes
u8::from_le_bytes
u8::from_ne_bytes
u16::to_be_bytes
u16::to_le_bytes
u16::to_ne_bytes
u16::from_be_bytes
u16::from_le_bytes
u16::from_ne_bytes
u32::to_be_bytes
u32::to_le_bytes
u32::to_ne_bytes
u32::from_be_bytes
u32::from_le_bytes
u32::from_ne_bytes
u64::to_be_bytes
u64::to_le_bytes
u64::to_ne_bytes
u64::from_be_bytes
u64::from_le_bytes
u64::from_ne_bytes
u128::to_be_bytes
u128::to_le_bytes
u128::to_ne_bytes
u128::from_be_bytes
u128::from_le_bytes
u128::from_ne_bytes
usize::to_be_bytes
usize::to_le_bytes
usize::to_ne_bytes
usize::from_be_bytes
usize::from_le_bytes
usize::from_ne_bytes
Cargo
- You can now run
cargo c
as 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_ps
have been changed from*const
to*mut
as 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
const
functions. 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 theFrom
trait. E.g.u8
now implementsFrom<NonZeroU8>
. - You can now convert a
&Option<T>
intoOption<&T>
and&mut Option<T>
intoOption<&mut T>
using theFrom
trait. - You can now multiply (
*
) atime::Duration
by au32
.
Stabilized APIs
slice::align_to
slice::align_to_mut
slice::chunks_exact
slice::chunks_exact_mut
slice::rchunks
slice::rchunks_mut
slice::rchunks_exact
slice::rchunks_exact_mut
Option::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
package
key 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
crate
in paths. This allows you to refer to the crate root in the path, e.g.use crate::foo;
refers tofoo
insrc/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
use
syntax. 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 thevis
specifier. - 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-elf
target. - Added the
aarch64-unknown-netbsd
target - 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 run
doesn't require specifying a package in workspaces.cargo doc
now supports--message-format=json
. This is equivalent to callingrustdoc --error-format=json
.- Cargo will now provide a progress bar for builds.
Misc
rustdoc
allows you to specify what edition to treat your code as with the--edition
option.rustdoc
now has the--color
(specify whether to output color) and--error-format
(specify error format, e.g.json
) options.- We now distribute a
rust-gdbgui
script that invokesgdbgui
with Rust debug symbols. - Attributes from Rust tools such as
rustfmt
orclippy
are 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-preview
component on the windows-gnu targets has been restored.
Version 1.29.1 (2018-09-25)
Security Notes
-
The standard library's
str::repeat
function 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-musl
target. - Added
aarch64-unknown-hermit
andx86_64-unknown-hermit
targets. - Upgraded to LLVM 7.
Libraries
Once::call_once
no longer requiresOnce
to be'static
.BuildHasherDefault
now implementsPartialEq
andEq
.Box<CStr>
,Box<OsStr>
, andBox<Path>
now implementClone
.- Implemented
PartialEq<&str>
forOsString
andPartialEq<OsString>
for&str
. Cell<T>
now allowsT
to be unsized.SocketAddr
is now stable on Redox.
Stabilized APIs
Cargo
- Cargo can silently fix some bad lockfiles. You can use
--locked
to disable this behavior. cargo-install
will now allow you to cross compile an install using--target
.- Added the
cargo-fix
subcommand to automatically move project code from 2015 edition to 2018. cargo doc
can now optionally document private types using the--document-private-items
flag.
Misc
rustdoc
now has the--cap-lints
option which demotes all lints above the specified level to that level. For example--cap-lints warn
will demotedeny
andforbid
lints towarn
.rustc
andrustdoc
will now have the exit code of1
if compilation fails and101
if 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_dir
is now deprecated for its unintuitive behavior. Consider using thehome_dir
function from https://crates.io/crates/dirs instead.rustc
will no longer silently ignore invalid data in target spec.cfg
attributes and--cfg
command 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
, andoffsetof
have been unreserved and can now be used as identifiers. - The
GlobalAlloc
trait 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
lifetime
specifier formacro_rules!
is now stable. This allows macros to easily target lifetimes.
Compiler
- The
s
andz
optimisation levels are now stable. These optimisations prioritise making smaller binary sizes.z
is the same ass
with 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=short
this option will provide a more compressed output of rust error messages. - Added a lint warning when you have duplicated
macro_export
s. - Reduced the number of allocations in the macro parser. This can improve compile times of macro heavy crates on average by 5%.
Libraries
- Implemented
Default
for&mut str
. - Implemented
From<bool>
for all integer and unsigned number types. - Implemented
Extend
for()
. - The
Debug
implementation oftime::Duration
should now be more easily human readable. Previously aDuration
of 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
Shl
andShr
forWrapping<u128>
andWrapping<i128>
. DirEntry::metadata
now usesfstatat
instead oflstat
when possible. This can provide up to a 40% speed increase.- Improved error messages when using
format!
.
Stabilized APIs
Iterator::step_by
Path::ancestors
SystemTime::UNIX_EPOCH
alloc::GlobalAlloc
alloc::Layout
alloc::LayoutErr
alloc::System
alloc::alloc
alloc::alloc_zeroed
alloc::dealloc
alloc::realloc
alloc::handle_alloc_error
btree_map::Entry::or_default
fmt::Alignment
hash_map::Entry::or_default
iter::repeat_with
num::NonZeroUsize
num::NonZeroU128
num::NonZeroU16
num::NonZeroU32
num::NonZeroU64
num::NonZeroU8
ops::RangeBounds
slice::SliceIndex
slice::from_mut
slice::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
src
directory. Thesrc
directory in a crate should be considered to be immutable.
Misc
- The
suggestion_applicability
field 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
proc
to be used as an identifier. - The dyn syntax is now available. This syntax is equivalent to the
bare
Trait
syntax, and should make it clearer when being used in tandem withimpl Trait
because 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_64
modules which contain SIMD intrinsics, a new macro calledis_x86_feature_detected!
, the#[target_feature(enable="")]
attribute, and addingtarget_feature = ""
to thecfg
attribute. - A lot of methods for
[u8]
,f32
, andf64
previously only available in std are now available in core. - The generic
Rhs
type parameter onops::{Shl, ShlAssign, Shr}
now defaults toSelf
. std::str::replace
now has the#[must_use]
attribute to clarify that the operation isn't done in place.Clone::clone
,Iterator::collect
, andToOwned::to_owned
now have the#[must_use]
attribute to warn about unused potentially expensive allocations.
Stabilized APIs
DoubleEndedIterator::rfind
DoubleEndedIterator::rfold
DoubleEndedIterator::try_rfold
Duration::from_micros
Duration::from_nanos
Duration::subsec_micros
Duration::subsec_millis
HashMap::remove_entry
Iterator::try_fold
Iterator::try_for_each
NonNull::cast
Option::filter
String::replace_range
Take::set_limit
hint::unreachable_unchecked
os::unix::process::parent_id
ptr::swap_nonoverlapping
slice::rsplit_mut
slice::rsplit
slice::swap_with_slice
Cargo
cargo-metadata
now includesauthors
,categories
,keywords
,readme
, andrepository
fields.cargo-metadata
now includes a package'smetadata
table.- Added the
--target-dir
optional argument. This allows you to specify a different directory thantarget
for 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=0
in 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.org
are now searchable.
Compatibility Notes
- Calling a
CharExt
orStrExt
method directly on core will no longer work. e.g.::core::prelude::v1::StrExt::is_empty("")
will not compile,"".is_empty()
will still compile. Debug
output 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::Error
trait 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 Trait
no longer works for non-Termination trait. This reverts an accidental stabilization.NaN > NaN
no longer returns true in const-fn contexts.- Prohibit using turbofish for
impl Trait
in method arguments.
Version 1.26.0 (2018-05-10)
Language
- Closures now implement
Copy
and/orClone
if all captured variables implement either or both traits. - The inclusive range syntax e.g.
for x in 0..=10
is now stable. - The
'_
lifetime is now stable. The underscore lifetime can be used anywhere a lifetime can be elided. impl Trait
is 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
u128
andi128
are now stable. main
can 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-prefix
option to rustc. Allowing you to remap path prefixes outputted by the compiler. - Added
powerpc-unknown-netbsd
target.
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, Hash
forcmp::Reverse
. - Optimized
str::repeat
being 8x faster in large cases. ascii::escape_default
is now available in libcore.- Trailing commas are now supported in std and core macros.
- Implemented
Copy, Clone
forcmp::Reverse
- Implemented
Clone
forchar::{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::write
Box::leak
FromUtf8Error::as_bytes
LocalKey::try_with
Option::cloned
btree_map::Entry::and_modify
fs::read_to_string
fs::read
fs::write
hash_map::Entry::and_modify
iter::FusedIterator
ops::RangeInclusive
ops::RangeToInclusive
process::id
slice::rotate_left
slice::rotate_right
String::retain
Cargo
- Cargo will now output path to custom commands when
-v
is passed with--list
- The Cargo binary version is now the same as the Rust version
Misc
Compatibility Notes
- aliasing a
Fn
trait asdyn
no 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
AsciiExt
trait in favor of inherent methods. ".e0"
will now no longer parse as0.0
and 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::Command
on Unix. - Impl PartialEq and Eq for
ParseCharError
. UnsafeCell::into_inner
is now safe.- Implement libstd for CloudABI.
Float::{from_bits, to_bits}
is now available in libcore.- Implement
AsRef<Path>
for Component - Implemented
Write
forCursor<&mut Vec<u8>>
- Moved
Duration
to libcore.
Stabilized APIs
The following functions can now be used in a constant expression.
eg. static MINUTE: Duration = Duration::from_secs(60);
Cargo
cargo new
no longer removesrust
orrs
prefixes/suffixes.cargo new
now defaults to creating a binary crate, instead of a library crate.
Misc
Compatibility Notes
- Deprecated
net::lookup_host
. rustdoc
has 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
sysv64
ffi 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-gnueabi
target. - Add
aarch64-unknown-openbsd
support
Libraries
str::find::<char>
now uses memchr. This should lead to a 10x improvement in performance in the majority of cases.OsStr
'sDebug
implementation 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
AsciiExt
methods ontochar
- Remove
T: Sized
requirement onptr::is_null()
- impl
From<RecvError>
for{TryRecvError, RecvTimeoutError}
- Optimised
f32::{min, max}
to generate more efficient x86 assembly [u8]::contains
now 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::new
AtomicUsize::new
AtomicIsize::new
AtomicPtr::new
Cell::new
{integer}::min_value
{integer}::max_value
mem::size_of
mem::align_of
ptr::null
ptr::null_mut
RefCell::new
UnsafeCell::new
Cargo
- Added a
workspace.default-members
config that overrides implied--all
in virtual workspaces. - Enable incremental by default on development builds. Also added
configuration keys to
Cargo.toml
and.cargo/config
to disable on a per-project or global basis respectively.
Misc
Compatibility Notes
- Floating point types
Debug
impl now always prints a decimal point. Ipv6Addr
now 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::flags
method is now deprecated. Thesign_plus
,sign_minus
,alternate
, andsign_aware_zero_pad
should be used instead.- Leading zeros in tuple struct members is now an error
column!()
macro is one-based instead of zero-basedfmt::Arguments
can 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
auto
traits 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
TrapUnreachable
in 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/ne
macro - Implement Hash for raw pointers to unsized types
- impl
From<*mut T>
forAtomicPtr<T>
- impl
From<usize/isize>
forAtomicUsize/AtomicIsize
. - Removed the
T: Sync
requirement forRwLock<T>: Send
- Removed
T: Sized
requirement for{<*const T>, <*mut T>}::as_ref
and<*mut T>::as_mut
- Optimized
Thread::{park, unpark}
implementation - Improved
SliceExt::binary_search
performance. - impl
FromIterator<()>
for()
- Copied
AsciiExt
trait methods to primitive types. Use ofAsciiExt
is now deprecated.
Stabilized APIs
Cargo
- Cargo now supports uninstallation of multiple packages
eg.
cargo uninstall foo bar
uninstallsfoo
andbar
. - 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_debug
now 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_case
lint now allows extern no-mangle functions- Now accepts underscores in unicode escapes
T op= &T
now works for numeric types. eg.let mut x = 2; x += &8;
- types that impl
Drop
are now allowed inconst
andstatic
types
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::Discriminant
is now guaranteed to beSend + Sync
fs::copy
now returns the length of the main stream on NTFS.- Properly detect overflow in
Instant += Duration
. - impl
Hasher
for{&mut Hasher, Box<Hasher>}
- impl
fmt::Debug
forSplitWhitespace
. Option<T>
now implsTry
This allows for using?
withOption
types.
Stabilized APIs
Cargo
- Cargo will now build multi file examples in subdirectories of the
examples
folder that have amain.rs
file. - Changed
[root]
to[package]
inCargo.lock
Packages with the old format will continue to work and can be updated withcargo update
. - Now supports vendoring git repositories
Misc
libbacktrace
is now available on Apple platforms.- Stabilised the
compile_fail
attribute 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.0
from2.3
- Allowing
T op= &T
for 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
Clone
for all arrays and tuples that areT: Clone
Stdin
,Stdout
, andStderr
now implementAsRawFd
.Rc
andArc
now 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 install
with multiple package names - Cargo commands inside a virtual workspace will now implicitly
pass
--all
- Added a
[patch]
section toCargo.toml
to handle prepublication dependencies RFC 1969 include
&exclude
fields inCargo.toml
now accept gitignore like patterns- Added the
--all-targets
option - 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::os
documentation 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
CodeMap
struct which required the unstable librarylibsyntax
to correctly use. unused_results
lint 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-emscripten
target. - 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-elf
target. - 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
,Hash
for unsized tuples. - Impl
fmt::{Display, Debug}
forRef
,RefMut
,MutexGuard
,RwLockReadGuard
,RwLockWriteGuard
- Impl
Clone
forDefaultHasher
. - Impl
Sync
forSyncSender
. - Impl
FromStr
forchar
- 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}::Display
now avoids allocations where possible
Stabilized APIs
CStr::into_c_string
CString::as_c_str
CString::into_boxed_c_str
Chain::get_mut
Chain::get_ref
Chain::into_inner
Option::get_or_insert_with
Option::get_or_insert
OsStr::into_os_string
OsString::into_boxed_os_str
Take::get_mut
Take::get_ref
Utf8Error::error_len
char::EscapeDebug
char::escape_debug
compile_error!
f32::from_bits
f32::to_bits
f64::from_bits
f64::to_bits
mem::ManuallyDrop
slice::sort_unstable_by_key
slice::sort_unstable_by
slice::sort_unstable
str::from_boxed_utf8_unchecked
str::as_bytes_mut
str::as_bytes_mut
str::from_utf8_mut
str::from_utf8_unchecked_mut
str::get_mut
str::get_unchecked_mut
str::get_unchecked
str::get
str::into_boxed_bytes
Cargo
- Cargo API token location moved from
~/.cargo/config
to~/.cargo/credentials
. - Cargo will now build
main.rs
binaries that are in sub-directories ofsrc/bin
. ie. Havingsrc/bin/server/main.rs
andsrc/bin/client/main.rs
generatestarget/debug/server
andtarget/debug/client
- You can now specify version of a binary when installed through
cargo install
using--vers
. - Added
--no-fail-fast
flag to cargo to run all benchmarks regardless of failure. - Changed the convention around which file is the crate root.
Compatibility Notes
- Functions with
'static
in 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.
loop
can now return a value withbreak
. RFC 1624 For example:let x = loop { break 7; };
- C compatible
union
s are now available. RFC 1444 They can only containCopy
types and cannot have aDrop
implementation. Example:union Foo { bar: u8, baz: usize }
- Non capturing closures can now be coerced into
fn
s, RFC 1558 Example:let foo: fn(u8) -> u8 = |v: u8| { v };
Compiler
- Add support for bootstrapping the Rust compiler toolchain on Android.
- Change
arm-linux-androideabi
to correspond to thearmeabi
official ABI. If you wish to continue targeting thearmeabi-v7a
ABI you should use--target armv7-linux-androideabi
. - Fixed ICE when removing a source file between compilation sessions.
- Minor optimisation of string operations.
- Compiler error message is now
aborting due to previous error(s)
instead ofaborting due to N previous errors
This was previously inaccurate and would only count certain kinds of errors. - The compiler now supports Visual Studio 2017
- The compiler is now built against LLVM 4.0.1 by default
- Added a lot of new error codes
- Added
target-feature=+crt-static
option RFC 1721 Which allows libraries with C Run-time Libraries(CRT) to be statically linked. - Fixed various ARM codegen bugs
Libraries
String
now implementsFromIterator<Cow<'a, str>>
andExtend<Cow<'a, str>>
Vec
now implementsFrom<&mut [T]>
Box<[u8]>
now implementsFrom<Box<str>>
SplitWhitespace
now implementsClone
[u8]::reverse
is now 5x faster and[u16]::reverse
is now 1.5x fastereprint!
andeprintln!
macros added to prelude. Same as theprint!
macros, but for printing to stderr.
Stabilized APIs
Cargo
- Build scripts can now add environment variables to the environment
the crate is being compiled in.
Example:
println!("cargo:rustc-env=FOO=bar");
- Subcommands now replace the current process rather than spawning a new child process
- Workspace members can now accept glob file patterns
- Added
--all
flag to thecargo bench
subcommand to run benchmarks of all the members in a given workspace. - Updated
libssh2-sys
to 0.2.6 - Target directory path is now in the cargo metadata
- Cargo no longer checks out a local working directory for the crates.io index This should provide smaller file size for the registry, and improve cloning times, especially on Windows machines.
- Added an
--exclude
option for excluding certain packages when using the--all
option - Cargo will now automatically retry when receiving a 5xx error from crates.io
- The
--features
option now accepts multiple comma or space delimited values. - Added support for custom target specific runners
Misc
- Added
rust-windbg.cmd
for loading rust.natvis
files in the Windows Debugger. - Rust will now release XZ compressed packages
- rustup will now prefer to download rust packages with XZ compression over GZip packages.
- Added the ability to escape
#
in rust documentation By adding additional#
's ie.##
is now#
Compatibility Notes
MutexGuard<T>
may only beSync
ifT
isSync
.-Z
flags are now no longer allowed to be used on the stable compiler. This has been a warning for a year previous to this.- As a result of the
-Z
flag change, thecargo-check
plugin no longer works. Users should migrate to the built-incheck
command, which has been available since 1.16. - Ending a float literal with
._
is now a hard error. Example:42._
. - Any use of a private
extern crate
outside of its module is now a hard error. This was previously a warning. use ::self::foo;
is now a hard error.self
paths are always relative while the::
prefix makes a path absolute, but was ignored and the path was relative regardless.- Floating point constants in match patterns is now a hard error This was previously a warning.
- Struct or enum constants that don't derive
PartialEq
&Eq
used match patterns is now a hard error This was previously a warning. - Lifetimes named
'_
are no longer allowed. This was previously a warning. - From the pound escape, lines consisting of multiple
#
s are now visible - It is an error to re-export private enum variants. This is known to break a number of crates that depend on an older version of mustache.
- On Windows, if
VCINSTALLDIR
is set incorrectly,rustc
will try to use it to find the linker, and the build will fail where it did not previously
Version 1.18.0 (2017-06-08)
Language
- Stabilize pub(restricted)
pub
can now accept a module path to make the item visible to just that module tree. Also accepts the keywordcrate
to 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/SUBSYSTEM
linker flag on Windows platforms. RFC 1665. - Refactor of trait object type parsing Now
ty
in 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
repr
attribute 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_iter
being passedvec::IntoIter
if the iterator hasn't been advanced the originalVec
is 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_wait
HashMap::retain
HashSet::retain
PeekMut::pop
TcpStream::peek
UdpSocket::peek
UdpSocket::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
--bins
and--tests
flags now you can build all programs of a certain type, for examplecargo build --bins
will build all binaries. - Added support for haiku
Misc
- rustdoc can now use pulldown-cmark with the
--enable-commonmark
flag - 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
0
flag 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
transmute
on structs that have norepr
attribute 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> + Send
as&(for<'a> Tr<'a> + Send)
instead of(&for<'a> Tr<'a>) + Send
-
rustc main.rs -o out --emit=asm,llvm-ir
Now will outputout.asm
andout.ll
instead of only one of the filetypes. -
calling a function that returns
Self
will no longer work when the size ofSelf
cannot 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
Self
may be included in thewhere
clause ofimpls
. RFC 1647- When coercing to an unsized type lifetimes must be equal. That is,
there is no subtyping between
T
andU
whenT: Unsize<U>
. For example, coercing&mut [&'a X; N]
to&mut [&'b X]
requires'a
be equal to'b
. Soundness fix. - Values passed to the indexing operator,
[]
, automatically coerce - Static variables may contain references to other statics
Compiler
- Exit quickly on only
--emit dep-info
- Make
-C relocation-model
more correctly determine whether the linker creates a position-independent executable - Add
-C overflow-checks
to directly control whether integer overflow panics - The rustc type checker now checks items on demand instead of in a single
in-order pass. This is mostly an internal refactoring in support of
future work, including incremental type checking, but also resolves RFC
1647, allowing
Self
to appear inimpl
where
clauses. - Optimize vtable loads
- Turn off vectorization for Emscripten targets
- Provide suggestions for unknown macros imported with
use
- Fix ICEs in path resolution
- Strip exception handling code on Emscripten when
panic=abort
- Add clearer error message using
&str + &str
Stabilized APIs
Arc::into_raw
Arc::from_raw
Arc::ptr_eq
Rc::into_raw
Rc::from_raw
Rc::ptr_eq
Ordering::then
Ordering::then_with
BTreeMap::range
BTreeMap::range_mut
collections::Bound
process::abort
ptr::read_unaligned
ptr::write_unaligned
Result::expect_err
Cell::swap
Cell::replace
Cell::into_inner
Cell::take
Libraries
BTreeMap
andBTreeSet
can iterate over rangesCell
can store non-Copy
types. RFC 1651String
implementsFromIterator<&char>
Box
implements a number of new conversions:From<Box<str>> for String
,From<Box<[T]>> for Vec<T>
,From<Box<CStr>> for CString
,From<Box<OsStr>> for OsString
,From<Box<Path>> for PathBuf
,Into<Box<str>> for String
,Into<Box<[T]>> for Vec<T>
,Into<Box<CStr>> for CString
,Into<Box<OsStr>> for OsString
,Into<Box<Path>> for PathBuf
,Default for Box<str>
,Default for Box<CStr>
,Default for Box<OsStr>
,From<&CStr> for Box<CStr>
,From<&OsStr> for Box<OsStr>
,From<&Path> for Box<Path>
ffi::FromBytesWithNulError
implementsError
andDisplay
- Specialize
PartialOrd<A> for [A] where A: Ord
- Slightly optimize
slice::sort
- Add
ToString
trait specialization forCow<'a, str>
andString
Box<[T]>
implementsFrom<&[T]> where T: Copy
,Box<str>
implementsFrom<&str>
IpAddr
implementsFrom
for various arrays.SocketAddr
implementsFrom<(I, u16)> where I: Into<IpAddr>
format!
estimates the needed capacity before writing a string- Support unprivileged symlink creation in Windows
PathBuf
implementsDefault
- Implement
PartialEq<[A]>
forVecDeque<A>
HashMap
resizes adaptively to guard against DOS attacks and poor hash functions.
Cargo
- Add
cargo check --all
- Add an option to ignore SSL revocation checking
- Add
cargo run --package
- Add
required_features
- Assume
build.rs
is a build script - Find workspace via
workspace_root
link in containing member
Misc
- Documentation is rendered with mdbook instead of the obsolete, in-tree
rustbook
- The "Unstable Book" documents nightly-only features
- Improve the style of the sidebar in rustdoc output
- Configure build correctly on 64-bit CPU's with the armhf ABI
- Fix MSP430 breakage due to
i128
- Preliminary Solaris/SPARCv9 support
rustc
is linked statically on Windows MSVC targets, allowing it to run without installing the MSVC runtime.rustdoc --test
includes file names in test names- This release includes builds of
std
forsparc64-unknown-linux-gnu
,aarch64-unknown-linux-fuchsia
, andx86_64-unknown-linux-fuchsia
. - Initial support for
aarch64-unknown-freebsd
- Initial support for
i686-unknown-netbsd
- This release no longer includes the old makefile build system. Rust is built with a custom build system, written in Rust, and with Cargo.
- Add Debug implementations for libcollection structs
TypeId
implementsPartialOrd
andOrd
--test-threads=0
produces an errorrustup
installs documentation by default- The Rust source includes NatVis visualizations. These can be used by WinDbg and Visual Studio to improve the debugging experience.
Compatibility Notes
- Rust 1.17 does not correctly detect the MSVC 2017 linker. As a workaround, either use MSVC 2015 or run vcvars.bat.
- When coercing to an unsized type lifetimes must be equal. That is,
disallow subtyping between
T
andU
whenT: Unsize<U>
, e.g. coercing&mut [&'a X; N]
to&mut [&'b X]
requires'a
be equal to'b
. Soundness fix. format!
andDisplay::to_string
panic if an underlying formatting implementation returns an error. Previously the error was silently ignored. It is incorrect forwrite_fmt
to return an error when writing to a string.- In-tree crates are verified to be unstable. Previously, some minor crates were marked stable and could be accessed from the stable toolchain.
- Rust git source no longer includes vendored crates. Those that need to build with vendored crates should build from release tarballs.
- Fix inert attributes from
proc_macro_derives
- During crate resolution, rustc prefers a crate in the sysroot if two crates are otherwise identical. Unlikely to be encountered outside the Rust build system.
- Fixed bugs around how type inference interacts with dead-code. The existing code generally ignores the type of dead-code unless a type-hint is provided; this can cause surprising inference interactions particularly around defaulting. The new code uniformly ignores the result type of dead-code.
- Tuple-struct constructors with private fields are no longer visible
- Lifetime parameters that do not appear in the arguments are now considered
early-bound, resolving a soundness bug (#32330). The
hr_lifetime_in_assoc_type
future-compatibility lint has been in effect since April of 2016. - rustdoc: fix doctests with non-feature crate attributes
- Make transmuting from fn item types to pointer-sized types a hard error
Version 1.16.0 (2017-03-16)
Language
- The compiler's
dead_code
lint now accounts for type aliases. - Uninhabitable enums (those without any variants) no longer permit wildcard match patterns
- Clean up semantics of
self
in an import list Self
may appear inimpl
headersSelf
may appear in struct expressions
Compiler
rustc
now supports--emit=metadata
, which causes rustc to emit a.rmeta
file 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>
whereT
requires a bigger alignment thanU
- rustc: use -Xlinker when specifying an rpath with ',' in it
rustc
no longer attempts to provide "consider using an explicit lifetime" suggestions. They were inaccurate.
Stabilized APIs
VecDeque::truncate
VecDeque::resize
String::insert_str
Duration::checked_add
Duration::checked_sub
Duration::checked_div
Duration::checked_mul
str::replacen
str::repeat
SocketAddr::is_ipv4
SocketAddr::is_ipv6
IpAddr::is_ipv4
IpAddr::is_ipv6
Vec::dedup_by
Vec::dedup_by_key
Result::unwrap_or_default
<*const T>::wrapping_offset
<*mut T>::wrapping_offset
CommandExt::creation_flags
File::set_permissions
String::split_off
Libraries
[T]::binary_search
and[T]::binary_search_by_key
now take their argument byBorrow
parameter- All public types in std implement
Debug
IpAddr
implementsFrom<Ipv4Addr>
andFrom<Ipv6Addr>
Ipv6Addr
implementsFrom<[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
&str
slicing errors TcpListener::set_only_v6
is 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::Sum
anditer::Product
forResult
- Reduce the size of static data in
std_unicode::tables
char::EscapeDebug
,EscapeDefault
,EscapeUnicode
,CaseMappingIter
,ToLowercase
,ToUppercase
, implementDisplay
Duration
implementsSum
String
implementsToSocketAddrs
Cargo
- The
cargo check
command 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 totrue
andfalse
. These are passed torustc
as 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
rustdoc
has a--sysroot
argument that, likerustc
, specifies the path to the Rust implementation- The
armv7-linux-androideabi
target 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_code
lint now accounts for type aliases. - Ctrl-Z returns from
Stdin.read()
when reading from the console on Windows - Clean up semantics of
self
in 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_imports
lint since 1.14, with no known regressions. - In
macro_rules
,path
fragments can now be parsed as type parameter bounds ?Sized
can be used inwhere
clauses- 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
--test
flag works with procedural macro crates - Fix
extern "aapcs" fn
ABI - The
-C no-stack-check
flag is deprecated. It does nothing. - The
format!
expander recognizes incorrectprintf
and 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_ty
calls inTy::super_fold_with
- Avoid more unnecessary
mk_ty
calls inTy::super_fold_with
- Don't clone in
UnificationTable::probe
- Remove
scope_auxiliary
to 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_by
std::iter::Iterator::max_by
std::os::*::fs::FileExt
std::sync::atomic::Atomic*::get_mut
std::sync::atomic::Atomic*::into_inner
std::vec::IntoIter::as_slice
std::vec::IntoIter::as_mut_slice
std::sync::mpsc::Receiver::try_iter
std::os::unix::process::CommandExt::before_exec
std::rc::Rc::strong_count
std::rc::Rc::weak_count
std::sync::Arc::strong_count
std::sync::Arc::weak_count
std::char::encode_utf8
std::char::encode_utf16
std::cell::Ref::clone
std::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::nth
no longer has aSized
boundExtend<&T>
is specialized forVec
whereT: Copy
to 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
Default
forDuration
- Support creation of anonymous pipes on WinXP/2k
mpsc::RecvTimeoutError
implementsError
- Don't pass overlapped handles to processes
Cargo
- In this release, Cargo build scripts no longer have access to the
OUT_DIR
environment 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
--all
flag 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 --vers
to take a semver version - Fix retrying crate downloads for network errors
- Implement string lookup for
build.rustflags
config key - Emit more info on --message-format=json
- Assume
build.rs
in the same directory asCargo.toml
is a build script - Don't ignore errors in workspace manifest
- Fix
--message-format JSON
when rustc emits non-JSON warnings
Tooling
- Test runners (binaries built with
--test
) now support a--list
argument that lists the tests it contains - Test runners now support a
--exact
argument that makes the test filter match exactly, instead of matching only a substring of the test name - rustdoc supports a
--playground-url
flag - 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-rustbuild
to 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_imports
lint since 1.14, with no known regressions. - In this release, Cargo build scripts no longer have access to the
OUT_DIR
environment 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_type
lint 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_ownership
lint, 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
Peekable
peeks aNone
it will return thatNone
without 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
fn
items can be coerced tounsafe fn
pointers 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 mut
names 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
SmallVector
inCombineFields::instantiate
- Avoid some allocations in the macro parser
- Use a faster deflate setting
- Add
ArrayVec
andAccumulateVec
to reduce heap allocations during interning of slices - Optimize
write_metadata
- Don't process obligation forest cycles when stalled
- Avoid many
CrateConfig
clones - Optimize
Substs::super_fold_with
- Optimize
ObligationForest
'sNodeState
handling - Speed up
plug_leaks
Libraries
println!()
, with no arguments, prints newline. Previously, an empty string was required to achieve the same.Wrapping
impls standard binary and unary operators, as well as theSum
andProduct
iterators- Implement
From<Cow<str>> for String
andFrom<Cow<[T]>> for Vec<T>
- Improve
fold
performance forchain
,cloned
,map
, andVecDeque
iterators - Improve
SipHasher
performance on small values - Add Iterator trait TrustedLen to enable better FromIterator / Extend
- Expand
.zip()
specialization to.map()
and.cloned()
ReadDir
implementsDebug
- Implement
RefUnwindSafe
for atomic types - Specialize
Vec::extend
toVec::extend_from_slice
- Avoid allocations in
Decoder::read_str
io::Error
implementsFrom<io::ErrorKind>
- Impl
Debug
for raw pointers to unsized data - Don't reuse
HashMap
random seeds - The internal memory layout of
HashMap
is more cache-friendly, for significant improvements in some operations HashMap
uses 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
replace
sections from lock files - Ignore
panic
configuration 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-gnu
mipsel-unknown-linux-gnu
mips64-unknown-linux-gnuabi64
mips64el-unknown-linux-gnuabi64
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
s390x-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-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
- This release includes experimental support for WebAssembly, via
the
wasm32-unknown-emscripten
target. 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-docs
to 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
Ordering
enum may not be matched exhaustively - Future-proofing
#[no_link]
breaks some obscure cases - The
$crate
macro 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-arg
argument - 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 self
when 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::Drain
covariant - Implement
AsRef<[T]>
forstd::slice::Iter
- Implement
Debug
forstd::vec::IntoIter
CString
: avoid excessive growth just to 0-terminate- Implement
CoerceUnsized
for{Cell, RefCell, UnsafeCell}
- Use arc4rand on FreeBSD
- memrchr: Correct aligned offset computation
- Improve Demangling of Rust Symbols
- Use monotonic time in condition variables
- Implement
Debug
forstd::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
Debug
forDirEntry
- When
getaddrinfo
returnsEAI_SYSTEM
retrieve actual error fromerrno
SipHasher
is 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::exec
forcargo run
on Unix - Update curl and curl-sys
- Call rustdoc test with the correct cfg flags of a package
Tooling
- rustdoc: Add the
--sysroot
argument - 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
SipHasher
is 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
ethcore
crate 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
rustc
translates 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.rustc
presents 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
rustc
translates 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
TypeId
is correct in some cases where it was previously producing inconsistent results - The
mips-unknown-linux-gnu
target uses hardware floating point by default - The
rustc
arguments,--print target-cpus
,--print target-features
,--print relocation-models
, and--print code-models
print the available options to the-C target-cpu
,-C target-feature
,-C relocation-model
and-C code-model
code generation arguments rustc
supports 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
rustc
presents 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_
rustc
emits 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!
tt
matchers can be reparsed correctly, making them much more usefulmacro_rules!
stmt
matchers correctly consume the entire contents when inside non-braces invocations- Semicolons are properly required as statement delimiters inside
macro_rules!
invocations cfg_attr
works onpath
attributes
Stabilized APIs
Cell::as_ptr
RefCell::as_ptr
IpAddr::is_unspecified
IpAddr::is_loopback
IpAddr::is_multicast
Ipv4Addr::is_unspecified
Ipv6Addr::octets
LinkedList::contains
VecDeque::contains
ExitStatusExt::from_raw
. Both on Unix and Windows.Receiver::recv_timeout
RecvTimeoutError
BinaryHeap::peek_mut
PeekMut
iter::Product
iter::Sum
OccupiedEntry::remove_entry
VacantEntry::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_by
and[T]::binary_search_by_key
have been adjusted to be more flexible Option
implementsFrom
for its contained typeCell
,RefCell
andUnsafeCell
implementFrom
for their contained typeRwLock
panics if the reader count overflowsvec_deque::Drain
,hash_map::Drain
andhash_set::Drain
are covariantvec::Drain
andbinary_heap::Drain
are covariantCow<str>
implementsFromIterator
forchar
,&str
andString
- Sockets on Linux are correctly closed in subprocesses via
SOCK_CLOEXEC
hash_map::Entry
,hash_map::VacantEntry
andhash_map::OccupiedEntry
implementDebug
btree_map::Entry
,btree_map::VacantEntry
andbtree_map::OccupiedEntry
implementDebug
String
implementsAddAssign
- Variadic
extern fn
pointers implement theClone
,PartialEq
,Eq
,PartialOrd
,Ord
,Hash
,fmt::Pointer
, andfmt::Debug
traits FileType
implementsDebug
- References to
Mutex
andRwLock
are unwind-safe mpsc::sync_channel
Receiver
s return any available message before reporting a disconnect- Unicode definitions have been updated to 9.0
env
iterators 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 --target
work as expected - Speed up noop registry updates
- Update OpenSSL
- Fix
--panic=abort
with plugins - Always pass
-C metadata
to the compiler - Fix depending on git repos with workspaces
- Add a
--lib
flag tocargo new
- Add
http.cainfo
for custom certs - Indicate the compilation profile after compiling
- Allow enabling features for dependencies with
--features
- Add
--jobs
flag tocargo package
- Add
--dry-run
tocargo publish
- Add support for
RUSTDOCFLAGS
Performance
panic::catch_unwind
is more optimizedpanic::catch_unwind
no longer accesses thread-local storage on entry
Tooling
- Test binaries now support a
--test-threads
argument to specify the number of threads used to run tests, and which acts the same as theRUST_TEST_THREADS
environment variable - The test runner now emits a warning when tests run over 60 seconds
- rustdoc: Fix methods in search results
rust-lldb
warns 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
OsStr
s, 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
Debug
impl for strings no longer escapes all non-ASCII characters
Version 1.11.0 (2016-08-18)
Language
- Support nested
cfg_attr
attributes - 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::append
BTreeMap::append
BTreeMap::split_off
BTreeSet::append
BTreeSet::split_off
f32::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::sum
Iterator::product
Cell::get_mut
RefCell::get_mut
Libraries
- The
thread_local!
macro supports multiple definitions in a single invocation, and can apply attributes Cow
implementsDefault
Wrapping
implements binary, octal, lower-hex and upper-hexDisplay
formatting- The range types implement
Hash
lookup_host
ignores 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 = false
on[lib]
sections - Don't panic when
links
contains a '.' - Build scripts can emit warnings,
and
-vv
prints warnings for all crates. - Ignore file locks on OS X NFS mounts
- Don't warn about
package.metadata
keys. 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 --open
on Windows - Improve autocompletion
- Configure colors of stderr as well as stdout
Performance
- Caching projections speeds up type check dramatically for some workloads
- The default
HashMap
hasher 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
Ipv4Addr
is 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
const
s andstatic
s 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. cfg
attribute process has been refactored to fix various bugs. This causes breakage in some corner cases.
Version 1.10.0 (2016-07-07)
Language
Copy
types are required to have a trivial implementation ofClone
. RFC 1521.- Single-variant enums support the
#[repr(..)]
attribute. - Fix
#[derive(RustcEncodable)]
in the presence of otherencode
methods. panic!
can be converted to a runtime abort with the-C panic=abort
flag. 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_mode
os::windows::fs::OpenOptionsExt::share_mode
os::windows::fs::OpenOptionsExt::custom_flags
os::windows::fs::OpenOptionsExt::attributes
os::windows::fs::OpenOptionsExt::security_qos_flags
os::unix::fs::OpenOptionsExt::custom_flags
sync::Weak::new
Default for sync::Weak
panic::set_hook
panic::take_hook
panic::PanicInfo
panic::PanicInfo::payload
panic::PanicInfo::location
panic::Location
panic::Location::file
panic::Location::line
ffi::CStr::from_bytes_with_nul
ffi::CStr::from_bytes_with_nul_unchecked
ffi::FromBytesWithNulError
fs::Metadata::modified
fs::Metadata::accessed
fs::Metadata::created
sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange
sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak
collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key
os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}
SocketAddr::is_unnamed
SocketAddr::as_pathname
UnixStream::connect
UnixStream::pair
UnixStream::try_clone
UnixStream::local_addr
UnixStream::peer_addr
UnixStream::set_read_timeout
UnixStream::set_write_timeout
UnixStream::read_timeout
UnixStream::write_timeout
UnixStream::set_nonblocking
UnixStream::take_error
UnixStream::shutdown
- Read/Write/RawFd impls for
UnixStream
UnixListener::bind
UnixListener::accept
UnixListener::try_clone
UnixListener::local_addr
UnixListener::set_nonblocking
UnixListener::take_error
UnixListener::incoming
- RawFd impls for
UnixListener
UnixDatagram::bind
UnixDatagram::unbound
UnixDatagram::pair
UnixDatagram::connect
UnixDatagram::try_clone
UnixDatagram::local_addr
UnixDatagram::peer_addr
UnixDatagram::recv_from
UnixDatagram::recv
UnixDatagram::send_to
UnixDatagram::send
UnixDatagram::set_read_timeout
UnixDatagram::set_write_timeout
UnixDatagram::read_timeout
UnixDatagram::write_timeout
UnixDatagram::set_nonblocking
UnixDatagram::take_error
UnixDatagram::shutdown
- RawFd impls for
UnixDatagram
{BTree,Hash}Map::values_mut
<[_]>::binary_search_by_key
Libraries
- The
abs_sub
method 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
HashMap
s can't be initialized withgetrandom
they will fall back to/dev/urandom
temporarily to avoid blocking during early boot. - Implemented negation for wrapping numerals.
- Implement
Clone
forbinary_heap::IntoIter
. - Implement
Display
andHash
forstd::num::Wrapping
. - Add
Default
implementation for&CStr
,CString
. - Implement
From<Vec<T>>
andInto<Vec<T>>
forVecDeque<T>
. - Implement
Default
forUnsafeCell
,fmt::Error
,Condvar
,Mutex
,RwLock
.
Cargo
- Cargo.toml supports the
profile.*.panic
option. 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
-p
arguments. - Report status to stderr instead of stdout.
- Build scripts are passed a
CARGO_MANIFEST_LINKS
environment variable that corresponds to thelinks
field of the manifest. - Ban keywords from crate names.
- Canonicalize
CARGO_HOME
on Windows. - Retry network requests.
By default they are retried twice, which can be customized with the
net.retry
value in.cargo/config
. - Don't print extra error info for failing subcommands.
- Add
--force
flag tocargo install
. - Don't use
flock
on NFS mounts. - Prefer building
cargo install
artifacts in temporary directories. Makes it possible to install multiple crates in parallel. - Add
cargo test --doc
. - Add
cargo --explain
. - Don't print warnings when
-q
is passed. - Add
cargo doc --lib
and--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
HashMap
s by caching the random keys used to initialize the hash state. - The
find
implementation forChain
iterators 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
fn
type. - Do not suggest changing
&mut self
to&mut mut self
.
Misc
- Update i686-linux-android features to match Android ABI.
- Update aarch64-linux-android features to match Android ABI.
std
no 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-gdb
andrust-lldb
scripts are distributed on all Unix platforms. - On Unix the runtime aborts by calling
libc::abort
instead 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
AtomicBool
is now bool-sized, not word-sized.target_env
for Linux ARM targets is justgnu
, notgnueabihf
,gnueabi
, etc.- Consistently panic on overflow in
Duration::new
. - Change
String::truncate
to panic less. - Add
:block
to the follow set for:ty
and: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. fn
item types are zero sized, and eachfn
names a unique type. This will break code that transmutesfn
s, so callingtransmute
on afn
type 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_SPACE
category to be whitespace.
Stabilized APIs
std::panic
std::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_mut
AsciiExt::make_ascii_uppercase
AsciiExt::make_ascii_lowercase
char::decode_utf16
char::DecodeUtf16
char::DecodeUtf16Error
char::DecodeUtf16Error::unpaired_surrogate
BTreeSet::take
BTreeSet::replace
BTreeSet::get
HashSet::take
HashSet::replace
HashSet::get
OsString::with_capacity
OsString::clear
OsString::capacity
OsString::reserve
OsString::reserve_exact
OsStr::is_empty
OsStr::len
std::os::unix::thread
RawPthread
JoinHandleExt
JoinHandleExt::as_pthread_t
JoinHandleExt::into_pthread_t
HashSet::hasher
HashMap::hasher
CommandExt::exec
File::try_clone
SocketAddr::set_ip
SocketAddr::set_port
SocketAddrV4::set_ip
SocketAddrV4::set_port
SocketAddrV6::set_ip
SocketAddrV6::set_port
SocketAddrV6::set_flowinfo
SocketAddrV6::set_scope_id
slice::copy_from_slice
ptr::read_volatile
ptr::write_volatile
OpenOptions::create_new
TcpStream::set_nodelay
TcpStream::nodelay
TcpStream::set_ttl
TcpStream::ttl
TcpStream::set_only_v6
TcpStream::only_v6
TcpStream::take_error
TcpStream::set_nonblocking
TcpListener::set_ttl
TcpListener::ttl
TcpListener::set_only_v6
TcpListener::only_v6
TcpListener::take_error
TcpListener::set_nonblocking
UdpSocket::set_broadcast
UdpSocket::broadcast
UdpSocket::set_multicast_loop_v4
UdpSocket::multicast_loop_v4
UdpSocket::set_multicast_ttl_v4
UdpSocket::multicast_ttl_v4
UdpSocket::set_multicast_loop_v6
UdpSocket::multicast_loop_v6
UdpSocket::set_multicast_ttl_v6
UdpSocket::multicast_ttl_v6
UdpSocket::set_ttl
UdpSocket::ttl
UdpSocket::set_only_v6
UdpSocket::only_v6
UdpSocket::join_multicast_v4
UdpSocket::join_multicast_v6
UdpSocket::leave_multicast_v4
UdpSocket::leave_multicast_v6
UdpSocket::take_error
UdpSocket::connect
UdpSocket::send
UdpSocket::recv
UdpSocket::set_nonblocking
Libraries
std::sync::Once
is poisoned if its initialization function fails.cell::Ref
andcell::RefMut
can contain unsized types.- Most types implement
fmt::Debug
. - The default buffer size used by
BufReader
andBufWriter
was reduced to 8K, from 64K. This is in line with the buffer size used by other languages. Instant
,SystemTime
andDuration
implement+=
and-=
.Duration
additionally implements*=
and/=
.Skip
is aDoubleEndedIterator
.From<[u8; 4]>
is implemented forIpv4Addr
.Chain
implementsBufRead
.HashMap
,HashSet
and 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_AUTHORS
environment variable. - Cargo will pass the contents of the
RUSTFLAGS
variable torustc
on the commandline.rustc
arguments can also be specified in thebuild.rustflags
configuration 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.
ToString
is specialized forstr
, giving it the same performance asto_owned
.- Spawning processes with
Command::output
no longer creates extra threads. #[derive(PartialEq)]
and#[derive(PartialOrd)]
emit less code for C-like enums.
Misc
- Passing the
--quiet
flag 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-msvc
targets.
Compatibility Notes
std::sync::Once
is poisoned if its initialization function fails.- It is illegal to define methods with the same name in overlapping
inherent
impl
blocks. fn
item types are zero sized, and eachfn
names a unique type. This will break code that transmutesfn
s, so callingtransmute
on afn
type 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
, orShrAssign
traits. 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::map
RefMut::map
ptr::drop_in_place
time::Instant
time::SystemTime
Instant::now
Instant::duration_since
(renamed fromduration_from_earlier
)Instant::elapsed
SystemTime::now
SystemTime::duration_since
(renamed fromduration_from_earlier
)SystemTime::elapsed
- Various
Add
/Sub
impls forTime
andSystemTime
SystemTimeError
SystemTimeError::duration
- Various impls for
SystemTimeError
UNIX_EPOCH
AddAssign
,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
raw
modules, 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_t
anddev_t
. The inconsistency of these definitions across platforms was making it difficult to implementstd
correctly. Those that need these definitions should use thelibc
crate. RFC 1415. - The Unix-specific
MetadataExt
traits, 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::mpsc
implementfmt::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 targets
flag prints a list of supported targets. - The
--print cfg
flag prints thecfg
s defined for the current target. rustc
can 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
match
patterns 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-gnu
x86_64-rumprun-netbsd
. These can be installed with tools such as multirust.
Cargo
cargo init
creates a new Cargo project in the current directory. It is otherwise likecargo new
.- Cargo has configuration keys for
-v
and--color
.verbose
andcolor
, 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.jobs
key can be set viaCARGO_BUILD_JOBS
. Environment variables take precedence over config files. - Target-specific dependencies support Rust
cfg
syntax for describing targets so that dependencies for multiple targets can be specified together. RFC 1361. - The environment variables
CARGO_TARGET_ROOT
,RUSTC
, andRUSTDOC
take precedence over thebuild.target-dir
,build.rustc
, andbuild.rustdoc
configuration values. - The child process tree is killed on Windows when Cargo is killed.
- The
build.target
configuration value sets the target platform, like--target
.
Compatibility Notes
- Unstable compiler flags have been further restricted. Since
1.0
-Z
flags have been considered unstable, and other flags that were considered unstable additionally required passing-Z unstable-options
to 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
match
on empty enum variants using theVariant(..)
syntax. This has been a warning since 1.6. - The Unix-specific
MetadataExt
traits, 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.
--cfg
compiler flags are parsed strictly as identifiers.- On Unix, stack overflow triggers a runtime abort instead of a SIGSEGV.
Command::spawn
and its equivalents return an error if any of its command-line arguments contain interiorNUL
s.- Tuple and unit enum variants from other crates are in the type namespace.
- On Windows
rustc
emits.lib
files for thestaticlib
library type instead of.a
files. Additionally, for the MSVC toolchain,rustc
emits import libraries namedfoo.dll.lib
instead offoo.lib
.
Version 1.7.0 (2016-03-03)
Libraries
- Stabilized APIs
Path
Path::strip_prefix
(renamed from relative_from)path::StripPrefixError
(new error type returned from strip_prefix)
Ipv4Addr
Ipv6Addr
Vec
String
- 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_shr
i32::saturating_mul
i32::overflowing_add
,i32::overflowing_sub
,i32::overflowing_mul
,i32::overflowing_div
i32::overflowing_rem
,i32::overflowing_neg
,i32::overflowing_shl
,i32::overflowing_shr
u32::checked_rem
,u32::checked_neg
,u32::checked_shl
,u32::checked_shl
u32::saturating_mul
u32::overflowing_add
,u32::overflowing_sub
,u32::overflowing_mul
,u32::overflowing_div
u32::overflowing_rem
,u32::overflowing_neg
,u32::overflowing_shl
,u32::overflowing_shr
- and checked, saturated, and overflowing operations for other primitive types
- FFI
ffi::IntoStringError
CString::into_string
CString::into_bytes
CString::into_bytes_with_nul
From<CString> for Vec<u8>
IntoStringError
IntoStringError::into_cstring
IntoStringError::utf8_error
Error for IntoStringError
- Hashing
- Validating UTF-8 is faster by a factor of between 7 and 14x for
ASCII input. This means that creating
String
s andstr
s from bytes is faster. - The performance of
LineWriter
(and thusio::stdout
) was improved by usingmemchr
to search for newlines. f32::to_degrees
andf32::to_radians
are stable. Thef64
variants were stabilized previously.BTreeMap
was rewritten to use less memory and improve the performance of insertion and iteration, the latter by as much as 5x.BTreeSet
and its iterators,Iter
,IntoIter
, andRange
are covariant over their contained type.LinkedList
and its iterators,Iter
andIntoIter
are covariant over their contained type.str::replace
now accepts aPattern
, like other string searching methods.Any
is implemented for unsized types.Hash
is implemented forDuration
.
Misc
- When running tests with
--test
, rustdoc will pass--cfg
arguments to the compiler. - The compiler is built with RPATH information by default.
This means that it will be possible to run
rustc
when installed in unusual configurations without configuring the dynamic linker search path explicitly. rustc
passes--enable-new-dtags
to GNU ld. This makes any RPATH entries (emitted with-C rpath
) not take precedence overLD_LIBRARY_PATH
.
Cargo
cargo rustc
accepts a--profile
flag that runsrustc
under any of the compilation profiles, 'dev', 'bench', or 'test'.- The
rerun-if-changed
build 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_public
lint. - 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
Vec
reserves additional elements was tweaked to not allocate excessive space while still growing exponentially. From
conversions 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 tof32
orf64
. They are also not implemented forisize
andusize
because the implementations would be platform-specific.From
is also implemented fromf32
tof64
.From<&Path>
andFrom<PathBuf>
are implemented forCow<Path>
.From<T>
is implemented forBox<T>
,Rc<T>
andArc<T>
.IntoIterator
is implemented for&PathBuf
and&Path
.BinaryHeap
was refactored for modest performance improvements.- Sorting slices that are already sorted is 50% faster in some cases.
Cargo
- Cargo will look in
$CARGO_HOME/bin
for subcommands by default. - Cargo build scripts can specify their dependencies by emitting the
rerun-if-changed
key. - 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 clean
accepts a--release
flag to clean the release folder. A variety of artifacts that Cargo failed to clean are now correctly deleted.
Misc
- The
unreachable_code
lint 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_PATH
environment 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/bin
with thecargo install
command. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g.cargo-foo
is found in$PATH
it 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
AsRef
andAsMut
were 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
Self
are not object safe. Soundness fix. - Target specifications support a
no_default_libraries
setting that controls whether-nodefaultlibs
is passed to the linker, and in turn theis_like_windows
setting no longer affects the-nodefaultlibs
flag. #[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
use
statements 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_ctypes
lint no longer warns about usingisize
andusize
in FFI.
Libraries
Arc<T>
andRc<T>
are covariant with respect toT
instead of invariant.Default
is implemented for mutable slices.FromStr
is implemented forSockAddrV4
andSockAddrV6
.- There are now
From
conversions between floating point types where the conversions are lossless. - There are now
From
conversions between integer types where the conversions are lossless. fs::Metadata
implementsClone
.- The
parse
method accepts a leading "+" when parsing integers. AsMut
is implemented forVec
.- The
clone_from
implementations forString
andBinaryHeap
have 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::Debug
for up to 12 arguments. - Dropping
Vec
s is much faster in unoptimized builds when the element types don't implementDrop
. - A bug that caused in incorrect behavior when combining
VecDeque
with zero-sized types was resolved. PartialOrd
for 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::lines
andBufRead::lines
iterators treat\r\n
as line breaks in addition to\n
. - Loans of
'static
lifetime extend to the end of a function. str::parse
no 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
use
statements 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::copy
allows?Sized
arguments.- The
Windows
,Chunks
, andChunksMut
iterators over slices all overridecount
,nth
andlast
with an O(1) implementation. Default
is implemented for arrays up to[T; 32]
.IntoRawFd
has been added to the Unix-specific prelude,IntoRawSocket
andIntoRawHandle
to the Windows-specific prelude.Extend<String>
andFromIterator<String
are both implemented forString
.IntoIterator
is implemented for references toOption
andResult
.HashMap
andHashSet
implementExtend<&T>
whereT: Copy
as part of RFC 839. This will cause type inference breakage in rare situations.BinaryHeap
implementsDebug
.Borrow
andBorrowMut
are implemented for fixed-size arrays.extern fn
s with the "Rust" and "C" ABIs implement common traits includingEq
,Ord
,Debug
,Hash
.- String comparison is faster.
&mut T
whereT: std::fmt::Write
also implementsstd::fmt::Write
.- A stable regression in
VecDeque::push_back
and 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
isize
andusize
. - 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
Duration
API, 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_import
feature gate. This change is believed to break no existing code. - The behavior of
size_of_val
andalign_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is thought to be broken. - The
dropck
rules, 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_val
andalign_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is not known to exist, and suspected to be broken. 'static
variables may now be recursive.ref
bindings choose betweenDeref
andDerefMut
implementations correctly.- The
dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC.
Libraries
- The
Duration
API, has been stabilized, as well as thestd::time
module, which presently contains onlyDuration
. Box<str>
andBox<[T]>
both implementClone
.- The owned C string,
CString
, implementsBorrow
and the borrowed C string,CStr
, implementsToOwned
. The two of these allow C strings to be borrowed and cloned in generic code. CStr
implementsDebug
.AtomicPtr
implementsDebug
.Error
trait objects can be downcast to their concrete types in many common configurations, using theis
,downcast
,downcast_ref
anddowncast_mut
methods, similarly to theAny
trait.- 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_with
andends_with
are also faster. - The performance of
PartialEq
for slices is much faster. - The
Hash
trait offers the default method,hash_slice
, which is overridden and optimized by the implementations for scalars. - The
Hasher
trait 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::cause
also delegates to the inner error. process::Child
gained theid
method, which returns au32
representing the platform-specific process identifier.- The
connect
method on slices is deprecated, replaced by the newjoin
method (note that both of these are on the unstableSliceConcatExt
trait, but through the magic of the prelude are available to stable code anyway). - The
Div
operator is implemented forWrapping
types. DerefMut
is implemented forString
.- Performance of SipHash (the default hasher for
HashMap
) is better for long data. AtomicPtr
implementsSend
.- The
read_to_end
implementations forStdin
andFile
are 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
--explain
flag. - The
dropck
pass, 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. rustc
now 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_unsigned
lints 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
Rc
to 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=N
flag 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_uppercase
andto_lowercase
methods onchar
now do unicode case mapping, which is a previously-planned change in behavior and considered a bugfix. mem::align_of
now 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_of
is 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_defaults
feature 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 mut
now correctly invokeDerefMut
when matching against dereferenceable values.
Libraries
- The
Extend
trait, which grows a collection from an iterator, is implemented over iterators of references, forString
,Vec
,LinkedList
,VecDeque
,EnumSet
,BinaryHeap
,VecMap
,BTreeSet
andBTreeMap
. RFC. - The
iter::once
function returns an iterator that yields a single element, anditer::empty
returns an iterator that yields no elements. - The
matches
andrmatches
methods onstr
return iterators over substring matches. Cell
andRefCell
both 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_mul
methods, and alternatives to theWrapping
type.. 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 theDebug
formatter. This feature was actually introduced prior to 1.0 with little fanfare. fmt::Formatter
implementsfmt::Write
, afmt
-specific trait for writing data to formatted strings, similar toio::Write
.fmt::Formatter
adds 'debug builder' methods,debug_struct
,debug_tuple
,debug_list
,debug_set
,debug_map
. These are used by code generators to emit implementations ofDebug
.str
has newto_uppercase
andto_lowercase
methods that convert case, following Unicode case mapping.- It is now easier to handle poisoned locks. The
PoisonError
type, 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_poisoned
method ofRwLock
andMutex
can poll for a poisoned lock without attempting to take the lock. - On Unix the
FromRawFd
trait is implemented forStdio
, andAsRawFd
forChildStdin
,ChildStdout
,ChildStderr
. On Windows theFromRawHandle
trait is implemented forStdio
, andAsRawHandle
forChildStdin
,ChildStdout
,ChildStderr
. io::ErrorKind
has a new variant,InvalidData
, which indicates malformed input.
Misc
rustc
employs smarter heuristics for guessing at typos.rustc
emits 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::fs
module has been expanded to expand the set of functionality exposed:DirEntry
now supports optimizations likefile_type
andmetadata
which don't incur a syscall on some platforms.- A
symlink_metadata
function has been added. - The
fs::Metadata
structure 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
--explain
flag 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_whitespace
method 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
FromRawFd
andAsRawFd
, on WindowsFromRawHandle
andAsRawHandle
. These are implemented forFile
,TcpStream
,TcpListener
, andUpdSocket
. Further implementations forstd::process
will be stabilized later. - On Unix,
std::os::unix::symlink
creates symlinks. On Windows, symlinks can be created withstd::os::windows::symlink_dir
andstd::os::windows::symlink_file
. - The
mpsc::Receiver
type can now be converted into an iterator withinto_iter
on theIntoIterator
trait. Ipv4Addr
can be created fromu32
with theFrom<u32>
implementation of theFrom
trait.- The
Debug
implementation forRangeFull
creates output that is more consistent with other implementations. Debug
is implemented forFile
.- The
Default
implementation forArc
no longer requiresSync + Send
. - The
Iterator
methodscount
,nth
, andlast
have 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.
AtomicPtr
gained aDefault
implementation.- In accordance with Rust's policy on arithmetic overflow
abs
now panics on overflow when debug assertions are enabled. - The
Cloned
iterator, which was accidentally left unstable for 1.0 has been stabilized. - The
Incoming
iterator, which iterates over incoming TCP connections, and which was accidentally unnamable in 1.0, is now properly exported. BinaryHeap
no longer corrupts itself when functions called bysift_up
orsift_down
panic.- The
split_off
method ofLinkedList
no 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_env
cfg value, which is used for distinguishing toolchains that are otherwise for the same platform. Presently this is set tognu
for common GNU Linux targets and for MinGW targets, andmusl
for MUSL Linux targets. - The
cargo rustc
command invokes a build with custom flags to rustc. - Android executables are always position independent.
- The
drop_with_repr_extern
lint 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,
0b1234
is now lexed as0b1234
instead of two tokens,0b1
and234
. - Trait bounds are always invariant, eliminating the need for
the
PhantomFn
andMarkerTrait
lang items, which have been removed. - "-" is no longer a valid character in crate names, the
extern crate "foo" as bar
syntax 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.
Send
no 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: Sized
in theirwhere
clause are considered object-safe, allowing many extension traits likeIteratorExt
to be merged into the traits they extended. - You can now refer to associated types whose
corresponding trait bounds appear only in a
where
clause. - The final bits of OIBIT landed, meaning that traits
like
Send
andSync
are now library-defined. - A Reflect trait was introduced, which means that
downcasting via the
Any
trait 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_destructor
feature is now deprecated in favor of the newdropck
. This change is a major reduction in unsafe code.
Libraries
- The
thread_local
module has been renamed tostd::thread
. - The methods of
IteratorExt
have been moved to theIterator
trait itself. - Several traits that implement Rust's conventions for type
conversions,
AsMut
,AsRef
,From
, andInto
have been centralized in thestd::convert
module. - The
FromError
trait was removed in favor ofFrom
. - The basic sleep function has moved to
std::thread::sleep_ms
. - The
splitn
function now takes ann
parameter that represents the number of items yielded by the returned iterator instead of the number of 'splits'. - On Unix, all file descriptors are
CLOEXEC
by default. - Derived implementations of
PartialOrd
now order enums according to their explicitly-assigned discriminants. - Methods for searching strings are generic over
Pattern
s, implemented presently by&char
,&str
,FnMut(char) -> bool
and some others. - In method resolution, object methods are resolved before inherent methods.
String::from_str
has been deprecated in favor of theFrom
impl,String::from
.io::Error
implementsSync
.- The
words
method on&str
has 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
std
were 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
Fn
traits are now related via inheritance and provide ergonomic blanket implementations. - The
Index
andIndexMut
traits were changed to take the index by value, enabling code likehash_map["string"]
to work. Copy
now inherits fromClone
, meaning that allCopy
data is known to beClone
as well.
Misc
- Many errors now have extended explanations that can be accessed with
the
--explain
flag 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
io
module 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
for
loops now operate on theIntoIterator
trait, 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 implementDrop
for 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. Self
is a keyword.
-
Libraries
- The
Show
andString
formatting traits have been renamed toDebug
andDisplay
to 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_raw
andBox::from_raw
functions 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
isize
andusize
, rather thanint
anduint
, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle. - Most crates that are not
std
have 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.
where
clauses 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..j
that produce range types and which, when combined with theIndex
operator 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
Copy
trait is no longer implemented automatically. Unsafe pointers no longer implementSync
andSend
so types containing them don't automatically either.Sync
andSend
are now 'unsafe traits' so one can "forcibly" implement them viaunsafe impl
if 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 (thoughSync
andSend
will 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.
String
to be compared with&str
. if let
andwhile let
are 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
self
instead ofmod
, as in usefoo::{self, bar}
- Glob imports are no longer feature-gated.
- The
box
operator andbox
patterns 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,
OsRng
prefers the new, more reliablegetrandom
syscall 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
Show
formatter, 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 newString
formatter 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
std
have 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
Index
andIndexMut
traits. - The
if let
construct takes a branch only if thelet
pattern 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 theSlice
orSliceMut
traits. - 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..3
to0...4
to 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.0
syntax, currently behind thetuple_indexing
feature 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 bar
instead ofextern crate bar = foo
. - Renaming use statements are now written
use foo as bar
instead ofuse bar = foo
. let
andmatch
bindings 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.
move
has 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
Share
trait is now calledSync
to 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
Sized
trait 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::Duration
type has been added for use in I/O methods that rely on timers, as well as in the 'time' crate'sTimespec
arithmetic. - 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::btree
has been rewritten to have a more idiomatic and efficient design.
-
Tooling
- rustdoc output now indicates the stability levels of API's.
- The
--crate-name
flag can specify the name of the crate being compiled, like#[crate_name]
. - The
-C metadata
specifies additional metadata to hash into symbol names, and-C extra-filename
specifies 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-units
flag. - 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
uint
instead 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
priv
keyword 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 ndebug
is 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 use
has 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. @str
has been removed from the language.@[T]
has been removed from the language.@self
has been removed from the language.@Trait
has 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 crate
statements, and unnecessary visibility (priv
) is no longer allowed onuse
statements. - Trailing commas are now allowed in argument lists and tuple patterns.
- The
do
keyword 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 mod
is nowextern crate
- The
Freeze
trait has been removed. - The
Share
trait 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 mut
locations has been tweaked. - The
*
and.
operators are now overloadable through theDeref
andDerefMut
traits. ~Trait
andproc
no longer haveSend
bounds by default.- Partial type hints are now supported with the
_
type marker. - An
Unsafe
type was introduced for interior mutability. It is now considered undefined to transmute from&T
to&mut T
without using theUnsafe
type. - The #[linkage] attribute was implemented for extern statics/functions.
- The inner attribute syntax has changed from
#[foo];
to#![foo]
. Pod
was renamed toCopy
.
-
Libraries
- The
libextra
library 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::condition
has been removed. All I/O errors are now propagated through theResult
type. 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
vec
module 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::io
now has more public re-exports. Types such asBufferedReader
are now found atstd::io::BufferedReader
instead ofstd::io::buffered::BufferedReader
. - std:
print
andprintln
are no longer in the prelude, theprint!
andprintln!
macros are intended to be used instead. - std:
Rc
now has aWeak
pointer 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::Default
has been renamed tofmt::Show
, and it now has a new deriving mode:#[deriving(Show)]
. - std:
ToStr
is now implemented for all types implementingShow
. - std: The formatting trait methods now take
&self
instead of&T
- std: The
invert()
method on iterators has been renamed torev()
- std:
std::num
has 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_BACKTRACE
is 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 theReader
trait. 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
e
andE
formatting specifiers for floats have been added to print them in exponential notation. - std: The
Times
trait has been removed - std: Indications of variance and opting out of builtin bounds is done
through marker types in
std::kinds::marker
now - std:
hash
has been rewritten,IterBytes
has been removed, and#[deriving(Hash)]
is now possible. - std:
SharedChan
has been removed,Sender
is now cloneable. - std:
Chan
andPort
were renamed toSender
andReceiver
. - std:
Chan::new
is nowchannel()
. - std: A new synchronous channel type has been implemented.
- std: A
select!
macro is now provided for selecting overReceiver
s. - std:
hashmap
andtrie
have been moved tolibcollections
- std:
run
has been rolled intoio::process
- std:
assert_eq!
now uses{}
instead of{:?}
- std: The equality and comparison traits have seen some reorganization.
- std:
rand
has moved tolibrand
. - std:
to_{lower,upper}case
has been implemented forchar
. - std: Logging has been moved to
liblog
. - collections:
HashMap
has been rewritten for higher performance and less memory usage. - native: The default runtime is now
libnative
. Iflibgreen
is 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
libgreen
has been optimized with stack caching and various trimming of code. - green: Tasks spawned by
libgreen
now have an unmapped guard page. - sync: The
extra::sync
module has been updated to modern rust (and moved to thesync
library), tweaking and improving various interfaces while dropping redundant functionality. - sync: A new
Barrier
type has been added to thesync
library. - sync: An efficient mutex for native and green tasks has been implemented.
- serialize: The
base64
module 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
rustpkg
has 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
--emit
flag. - Crate type flags have been centralized into one
--crate-type
flag. - Codegen flags have been consolidated behind a
-C
flag. - 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
rustdoc
improvements:- 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
float
type has been removed. Usef32
orf64
instead. - 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'sGc
orRc
types instead. @mut
has been removed. Usestd::cell::{Cell, RefCell}
instead.- Jumping back to the top of a loop is now done with
continue
instead 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"###
. ~fn
is now writtenproc (args) -> retval { ... }
and may only be called once.- The
&fn
type is now written|args| -> ret
to match the literal form. @fn
s have been removed.do
only works with procs in order to make it obvious what the cost ofdo
is.- 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
impl
s must be terminated with empty braces and may not be terminated with a semicolon. - Keywords are no longer allowed as lifetime names; the
self
lifetime 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!
.mut
works 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
repr
attribute 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.._
. rustc
supports the "win64" calling convention viaextern "win64"
.rustc
supports the "system" calling convention, which defaults to the preferred convention for the target platform, "stdcall" on 32-bit Windows, "C" elsewhere.- The
type_overflow
lint (default: warn) checks literals for overflow. - The
unsafe_block
lint (default: allow) checks for usage ofunsafe
. - The
attribute_usage
lint (default: warn) warns about unknown attributes. - The
unknown_features
lint (default: warn) warns about unknown feature gates. - The
dead_code
lint (default: warn) checks for dead code. - Rust libraries can be linked statically to one another
#[link_args]
is behind thelink_args
feature 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_local
feature gate. - The
return
keyword may be used in closures. - Types that can be copied via a memcpy implement the
Pod
kind. - The
cfg
attribute can now be used on struct fields and enum variants.
- The
-
Libraries
- std: The
option
andresult
API's have been overhauled to make them simpler, more consistent, and more composable. - std: The entire
std::io
module 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::util
contains a number of useful implementations ofReader
andWriter
, includingNullReader
,NullWriter
,ZeroReader
,TeeReader
. - std: The reference counted pointer type
extra::rc
moved into std. - std: The
Gc
type in thegc
module will replace@
(it is currently just a wrapper around it). - std: The
Either
type has been removed. - std:
fmt::Default
can be implemented for any type to provide default formatting to theformat!
macro, as informat!("{}", myfoo)
. - std: The
rand
API continues to be tweaked. - std: The
rust_begin_unwind
function, useful for inserting breakpoints on failure in gdb, is now namedrust_fail
. - std: The
each_key
andeach_value
methods onHashMap
have been replaced by thekeys
andvalues
iterators. - std: Functions dealing with type size and alignment have moved from the
sys
module to themem
module. - std: The
path
module was written and API changed. - std:
str::from_utf8
has been changed to cast instead of allocate. - std:
starts_with
andends_with
methods added to vectors via theImmutableEqVector
trait, which is in the prelude. - std: Vectors can be indexed with the
get_opt
method, which returnsNone
if 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
Any
type can be used for dynamic typing. - std:
~Any
can be passed to thefail!
macro and retrieved viatask::try
. - std: Methods that produce iterators generally do not have an
_iter
suffix now. - std:
cell::Cell
andcell::RefCell
can be used to introduce mutability roots (mutable fields, etc.). Use instead of e.g.@mut
. - std:
util::ignore
renamed toprelude::drop
. - std: Slices have
sort
andsort_by
methods via theMutableVector
trait. - std:
vec::raw
has 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
comm
module 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
flatpipes
module 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_vec
has been modernized. - extra: The
sort
module has been removed. Use thesort
method on mutable slices.
- std: The
-
Tooling
- The
rust
andrusti
commands have been removed, due to lack of maintenance. rustdoc
was completely rewritten.rustdoc
can test code examples in documentation.rustpkg
can test packages with the argument, 'test'.rustpkg
supports arbitrary dependencies, including C libraries.rustc
's support for generating debug info is improved again.rustc
has 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)
rustc
adds a--dep-info
flag for communicating dependencies to build tools.
- The
Version 0.8 (2013-09-26)
-
~2200 changes, numerous bugfixes
-
Language
- The
for
loop syntax has changed to work with theIterator
trait. - 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.
copy
is no longer a keyword. It has been replaced by theClone
trait.- 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_str
module provides new mechanisms for converting to C strings. - The type of foreign functions is now
extern "C" fn
instead 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. pub
andpriv
modifiers onextern
blocks are no longer parsed.unsafe
is no longer allowed on extern fns - they are all unsafe.priv
is disallowed everywhere except for struct fields and enum variants.&T
(besides&'static T
) is no longer allowed in@T
.ref
bindings in irrefutable patterns work correctly now.char
is now prevented from containing invalid code points.- Casting to
bool
is no longer allowed. \0
is now accepted as an escape in chars and strings.yield
is a reserved keyword.typeof
is 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_qualification
lint 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 forlet
declarations.- 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
range
function was added to the prelude, replacinguint::range
and friends. - std:
range_rev
no longer exists. Since range is an iterator it can be reversed withrange(lo, hi).invert()
. - std: The
chain
method on option renamed toand_then
;unwrap_or_default
renamed tounwrap_or
. - std: The
iterator
module was renamed toiter
. - std: Integral types now support the
checked_add
,checked_sub
, andchecked_mul
operations 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_foo
for copying,into_foo
for moving,as_foo
for temporary and cheap casts. - std: The
CString
type inc_str
provides new ways to convert to and from C strings. - std:
DoubleEndedIterator
can yield elements in two directions. - std: The
mut_split
method on vectors partitions an&mut [T]
into two splices. - std:
str::from_bytes
renamed tostr::from_utf8
. - std:
pop_opt
andshift_opt
methods added to vectors. - std: The task-local data interface no longer uses @, and keys are no longer function pointers.
- std: The
swap_unwrap
method ofOption
renamed totake_unwrap
. - std: Added
SharedPort
tocomm
. - std:
Eq
has a default method forne
; onlyeq
is required in implementations. - std:
Ord
has default methods forle
,gt
andge
; onlylt
is required in implementations. - std:
is_utf8
performance is improved, impacting many string functions. - std:
os::MemoryMap
provides cross-platform mmap. - std:
ptr::offset
is now unsafe, but also more optimized. Offsets that are not 'in-bounds' are considered undefined. - std: Many freestanding functions in
vec
removed 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
FromIterator
so can be created by thecollect
method. - std: More complete atomic types in
unstable::atomics
. - std:
comm::PortSet
removed. - std: Mutating methods in the
Set
andMap
traits have been moved into theMutableSet
andMutableMap
traits.Container::is_empty
,Map::contains_key
,MutableMap::insert
, andMutableMap::remove
have default implementations. - std: Various
from_str
functions were removed in favor of a genericfrom_str
which is available in the prelude. - std:
util::unreachable
removed in favor of theunreachable!
macro. - extra:
dlist
, the doubly-linked list was modernized. - extra: Added a
hex
module withToHex
andFromHex
traits. - extra: Added
glob
module, replacingstd::os::glob
. - extra:
rope
was removed. - extra:
deque
was renamed toringbuf
.RingBuf
implementsDeque
. - extra:
net
, andtimer
were removed. The experimental replacements arestd::rt::io::net
andstd::rt::io::timer
. - extra: Iterators implemented for
SmallIntMap
. - extra: Iterators implemented for
Bitv
andBitvSet
. - extra:
SmallIntSet
removed. UseBitvSet
. - extra: Performance of JSON parsing greatly improved.
- extra:
semver
updated to SemVer 2.0.0. - extra:
term
handles more terminals correctly. - extra:
dbg
module removed. - extra:
par
module removed. - extra:
future
was cleaned up, with some method renames. - extra: Most free functions in
getopts
were converted to methods.
-
Other
- rustc's debug info generation (
-Z debug-info
) is greatly improved. - rustc accepts
--target-cpu
to compile to a specific CPU architecture, similarly to gcc's--march
flag. - 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
--test
now support the-h
and--help
flags. - 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
rustdoc
command.
- rustc's debug info generation (
Version 0.7 (2013-07-03)
-
~2000 changes, numerous bugfixes
-
Language
impl
s 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
self
parameter 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
for
loop protocol now requiresfor
-iterators to returnbool
so they compose better. - The
Durable
trait is replaced with the'static
bounds. - Trait default methods work more often.
- Structs with the
#[packed]
attribute have byte alignment and no padding between fields. - Type parameters bound by
Copy
must now be copied explicitly with thecopy
keyword. - It is now illegal to move out of a dereferenced unsafe pointer.
Option<~T>
is now represented as a nullable pointer.@mut
does dynamic borrow checks correctly.- The
main
function 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_STACK
environment variable (default: 1GB). - The
vecs_implicitly_copyable
lint 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 mod
statement no longer exists.
-
Syntax extensions
fail!
andassert!
accept~str
,&'static str
orfmt!
-style argument list.Encodable
,Decodable
,Ord
,TotalOrd
,TotalEq
,DeepClone
,Rand
,Zero
andToStr
can all be automatically derived with#[deriving(...)]
.- The
bytes!
macro returns a vector of bytes for string, u8, char, and unsuffixed integer literals.
-
Libraries
- The
core
crate was renamed tostd
. - The
std
crate was renamed toextra
. - More and improved documentation.
- std:
iterator
module 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
finalize
method ofDrop
renamed todrop
. - std: The
drop
method now takes&mut self
instead 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:
path
type renamed toPath
. - std:
mut
module andMut
type 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_cast
removed. Usetransmute
. - std: ascii string handling in
std::ascii
. - std:
Rand
is implemented for ~/@. - std:
run
module for spawning processes overhauled. - std: Various atomic types added to
unstable::atomic
. - std: Various types implement
Zero
. - std:
LinearMap
andLinearSet
renamed toHashMap
andHashSet
. - std: Borrowed pointer functions moved from
ptr
toborrow
. - std: Added
os::mkdir_recursive
. - std: Added
os::glob
function performs filesystems globs. - std:
FuzzyEq
renamed toApproxEq
. - std:
Map
now definespop
andswap
methods. - std:
Cell
constructors converted to static methods. - extra:
rc
module adds the reference counted pointers,Rc
andRcMut
. - extra:
flate
module moved fromstd
toextra
. - extra:
fileinput
module for iterating over a series of files. - extra:
Complex
number type andcomplex
module. - extra:
Rational
number type andrational
module. - extra:
BigInt
,BigUint
implement numeric and comparison traits. - extra:
term
uses terminfo now, is more correct. - extra:
arc
functions converted to methods. - extra: Implementation of fixed output size variations of SHA-2.
- The
-
Tooling
unused_variables
lint mode for unused variables (default: warn).unused_unsafe
lint mode for detecting unnecessaryunsafe
blocks (default: warn).unused_mut
lint mode for identifying unusedmut
qualifiers (default: warn).dead_assignment
lint mode for unread variables (default: warn).unnecessary_allocation
lint mode detects some heap allocations that are immediately borrowed so could be written without allocating (default: warn).missing_doc
lint mode (default: allow).unreachable_code
lint mode (default: warn).- The
rusti
command has been rewritten and a number of bugs addressed. - rustc outputs in color on more terminals.
- rustc accepts a
--link-args
flag to pass arguments to the linker. - rustc accepts a
-Z print-link-args
flag for debugging linkage. - Compiling with
-g
will 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
self
parameter 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
static
keyword and instead are distinguished by the lack of aself
parameter - Replaced the
Durable
trait with the'static
lifetime - The old closure type syntax with the trailing sigil has been removed in favor of the more consistent leading sigil
super
is a keyword, and may be prefixed to paths- Trait bounds are separated with
+
instead of whitespace - Traits are implemented with
impl Trait for Type
instead ofimpl Type: Trait
- Lifetime syntax is now
&'l foo
instead of&l/foo
- The
export
keyword has finally been removed - The
move
keyword has been removed (see "Semantic changes") - The interior mutability qualifier on vectors,
[mut T]
, has been removed. Use&mut [T]
, etc. mut
is no longer valid in~mut T
. Use inherited mutabilityfail
is no longer a keyword. Usefail!()
assert
is no longer a keyword. Useassert!()
log
is 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::mut
orcore::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
const
renamed tostatic
to correspond to lifetime name, and make room for futurestatic mut
unsafe mutable globals.- Replaced
#[deriving_eq]
with#[deriving(Eq)]
, etc. Clone
implementations can be automatically generated with#[deriving(Clone)]
- Casts to traits must use a pointer sigil, e.g.
@foo as @Bar
instead 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
move
keyword - 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
use
statements may no longer be "chained" - they cannot import identifiers imported by previoususe
statementsuse
statements 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::oldcomm
module - Added pipe-based
core::comm
module - Numeric traits have been reorganized under
core::num
vec::slice
finally returns a slicedebug!
and friends don't require a format string, e.g.debug!(Foo)
- Containers reorganized around traits in
core::container
core::dvec
removed,~[T]
is a drop-in replacementcore::send_map
renamed tocore::hashmap
std::map
removed; replaced withcore::hashmap
std::treemap
reimplemented as an owned balanced treestd::deque
andstd::smallintmap
reimplemented as owned containerscore::trie
added as a fast ordered map for integer keys- Set types added to
core::hashmap
,core::trie
andstd::treemap
Ord
split intoOrd
andTotalOrd
.Ord
is still used to overload the comparison operators, whereasTotalOrd
is used by certain container types
- Added big integers to
-
Other
- Replaced the 'cargo' package manager with 'rustpkg'
- Added all-purpose 'rust' tool
rustc --test
now 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
#fmt
extension 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 projectionEq
andIterBytes
implementations can be automatically generated with#[deriving_eq]
and#[deriving_iter_bytes]
respectively- Removed the special crate language for
.rc
files - 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
move
explicitly &T
may now be coerced to*T
- Coercions happen in
let
statements as well as function calls use
statements 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~self
all 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
getopts
definitions - Moved futures to
std
- More functions are pure now
core::comm
renamed tooldcomm
. Still deprecatedrustdoc
andcargo
are 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
ret
becamereturn
andalt
becamematch
import
is nowuse
;use is now
extern mod`extern mod { ... }
is nowextern { ... }
use mod
is the recommended way to import modulespub
andpriv
replace deprecated export lists- The syntax of
match
pattern arms now uses fat arrow (=>) main
no longer accepts an args vector; useos::args
instead
-
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::url
for 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.