std::mem::Discriminant<T>
does not depend on any lifetimes in Tprivate_in_public
lint with private_interfaces
and private_bounds
per RFC 2145
Read more in RFC 2145.#[repr(Rust)]
async
blocksPATH
option for --print KIND=PATH
*-apple-ios-macabi
i686-pc-windows-gnullvm
as a tier 3 targetFrom<OwnedFd/Handle>
for ChildStdin/out/errFrom<{&,&mut} [T; N]>
for Vec<T>
where T: Clone
From<[T; N]>
for Rc<[T]>
and Arc<[T]>
impl TryFrom<char> for u16
io_error_other
featureSaturating
typecore::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:
-p
more convenient by being positionaltarget.'cfg(..)'.linker
--keep-going
--extern
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.
clippy::fn_null_check
lint as useless_ptr_null_checks
.noop_method_call
warn by default.try
and async
in macros.unconditional_recursion
lint detect recursive drops.invalid_reference_casting
lint is now deny-by-default (instead of allow-by-default).comment
section like GCC/Clang.extern "thiscall"
and "thiscall-unwind"
ABIs.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.
Read
, Write
and Seek
impls for Arc<File>
.io::Sink
into io::Empty
.RefUnwindSafe
for Backtrace
ExitStatus
implement Default
impl SliceIndex<str> for (Bound<usize>, Bound<usize>)
assert_eq!
& assert_ne!
panic messages.stat
struct definitions.{integer}::div_ceil
{integer}::next_multiple_of
{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:
SourceId
in Cargo.lock
.cargo::
in custom build script.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.
rustc_apfloat
with the new version of the crate.internal_features
lint for internal unstable features.#![cfg(FALSE)]
behaves on crate rootclippy::undropped_manually_drops
lintclippy::invalid_utf8_in_unchecked
lint as invalid_from_utf8_unchecked
and invalid_from_utf8
clippy::cast_ref_to_mut
lint as invalid_reference_casting
clippy::cmp_nan
lint as invalid_nan_comparisons
dyn Trait
objectscfg
-ed out items to mention them in diagnostics-
is given as output fileloongarch64-unknown-none*
.eh_frame
from being emitted for -C panic=abort
Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
thread::{park, unpark}
T: Sized
bounds on BufReader<T>
, BufWriter<T>
and LineWriter<T>
select_nth_unstable
Ok
on kill if process has already exitedVec
s over different allocators{Arc,Rc,Weak}::ptr_eq
ignore pointer metadata[]
These APIs are now stable in const contexts:
-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
#12288build.jobs
parallelism back to the default.
#12222Display
for Ipv6Addr
for IPv4-compatible addressesmips*-unknown-linux-gnu*
targets from host tier 2 to target tier 3 support.suspicious_double_ref_op
lint when calling borrow()
can_eq
in derive(..)
suggestion for missing methodraw-dylib
, link_ordinal
, import_name_type
and -Cdlltool
.clippy::{drop,forget}_{ref,copy}
lints.Drop
impl compatibilityPlaceMention
,
making let _ =
patterns more consistent with respect to the borrow checker.--print deployment-target
flag for Apple targets.extern "C-unwind"
and friends.
The existing extern "C"
etc. may change behavior for cross-language unwinding in a future release.*-linux-musl
targets to 1.2.3,
enabling time64 on 32-bit systems.debugger_visualizer
for embedding metadata like Microsoft’s Natvis.Self
respect tuple constructor privacy.apple-m1
as the target CPU for aarch64-apple-darwin
.x86_64h-apple-darwin
target.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.
Drop
implementation, but panicking within a panic hook is now an immediate abort.From<&[T]> for Box<[T]>
bound to T: Clone
.T: Send
bound
in Error for mpsc::SendError<T>
and TrySendError<T>
.alloc::realloc
to match Layout
requirements that the size must not exceed isize::MAX
.const {}
syntax for std::thread_local
.
This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.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.toml
.workspace_default_members
to the output of cargo metadata
.cargo new
/cargo init
.rustdoc::unescaped_backticks
lint for broken inline code.~~old~~
vs. ~new~
)TypeId
.
Code that uses a constant TypeId
in a pattern will potentially be broken.
Known cases have already been fixed – in particular, users of the log
crate’s kv_unstable
feature should update to log v0.4.18
or later.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.rustup
. When
Cargo detects it will run rustc
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 and
RUSTUP_TOOLCHAIN
. However, it’s not expected to affect normal users.RUSTUP_HOME
and
RUSTUP_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.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.
asm!
operandsformat_args
invocations to uses captureslet _ = expr
position.-Cdebuginfo=line-tables-only
), which may eventually become the default for -Cdebuginfo=1
.unused_allocation
lint against Box::new
tooloongarch64-unknown-linux-gnu
i586-pc-nto-qnx700
(QNX Neutrino RTOS, version 7.0), Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Command
prefer non-verbatim pathsconcat!
Cell
partial_cmp
to implement tuple lt
/le
/ge
/gt
atomic_as_ptr
nonnull_slice_from_raw_parts
once_cell
nonzero_min_max
FnPtr
trait that is implemented for all function pointers
This extends Debug
, Pointer
, Hash
, PartialEq
, Eq
, PartialOrd
, and Ord
implementations for function pointers with all ABIs.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_PKG_README
sparse
the default protocol for crates.iocargo logout
libtest
from supporting -Zunstable-options
let _ = expr
position.sign-ext
and mutable-globals
features in codegen
This may cause incompatibility with older execution environments.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.
Copy
fields.cmpxchg16b
target feature on x86 and x86_64.Self: Autotrait
bounds on dyn-safe trait methods.str
as containing [u8]
for auto trait purposes.*-pc-windows-gnu
on CI to mingw-w64 v10 and GCC 12.2.true
and false
as boolean flags in compiler arguments.repr(C)
enums to c_int
size.DispatchFromDyn
for cell types, allowing downstream experimentation with custom method receivers.fmt::Arguments::as_str()
may return Some(_)
in more cases after optimization, subject to change.AsFd
and AsRawFd
for Rc
.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 fix
or cargo clippy --fix
when compilation warnings are auto-fixable.cargo add
if you try to install a library crate.CARGO_BIN_NAME
environment variable also for binary examples.rustdoc::all
group.!
.rust-analysis
component from rustup
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.default-features
is set to false of a workspace dependency, and an inherited dependency of a member has default-features = true
, Cargo will enable default features of that dependency.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.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.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.
@revoked
and a better error message for @cert-authority
in Cargo’s SSH host key verification$prefix-clang
as clang
in linker detection codealloc
on stable without requiring the
definition of a handler for allocation failure. Defining custom handlers is still unstable.efiapi
calling convention.bindings_with_variant_name
to deny-by-defaultarmv7-sony-vita-newlibeabihf
as a tier 3 targetstd::task::Context
!Send and !SyncOnceWith
& RepeatWith
Vec -> VecDeque
conversion guarantee{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 build --verbose
tells you more about why it recompiles.net.git-fetch-with-cli
option enabledSEMICOLON_IN_EXPRESSIONS_FROM_MACROS
to future-incompat report--target
by default for -Zgcc-ld=lld
on wasmIMPLIED_BOUNDS_ENTAILMENT
to Deny + ReportNowstd::task::Context
no longer implements Send and SyncThese changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
x86_64-pc-windows-msvc
x86_64-apple-darwin
clippy::uninlined_format_args
to pedantic.Sized
predicates coinductive, allowing cycles.#[must_use]
annotations on async fn
also affect the Future::Output
.cfg(FALSE)
.C
or cdecl
.verbatim
.Added, updated, and removed targets:
powerpc64-ibm-aix
.mipsel-sony-psx
.no_std
targets for the QNX Neutrino RTOS,
aarch64-unknown-nto-qnx710
and x86_64-pc-nto-qnx710
.aarch64-unknown-uefi
, i686-unknown-uefi
, and x86_64-unknown-uefi
.linuxkernel
targets (not used by the actual kernel).Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
crossbeam-channel
into std::sync::mpsc
.Eq
and Hash
for ControlFlow
.compiler_builtins
with -C panic=abort
.{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:
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
of repr(Rust)
types is an implementation detail, subject to change.&&
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.-export-dynamic
to wasm-ld
.main
is now mangled as __main_void
on wasm32-wasi
.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.
repr(Int)
enums
#[repr(u8)]
enum Foo {
A(u8) = 0,
B(i8) = 1,
C(bool) = 42,
}
Runmust_use
on impl Trait
for supertraits
This makes impl ExactSizeIterator
respect the existing #[must_use]
annotation on Iterator
...=X
in patternsclippy::for_loops_over_fallibles
lint into rustcsym
operands in inline assembly#[derive(Default)]
on a generic #[default]
enum adding unnecessary Default
boundsproc_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}
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
cargo remove
to remove dependencies from Cargo.tomlcargo publish
now waits for the new version to be downloadable before exitingSee detailed release notes for more.
ProceduralMasquerade
hack to older versions of rental
__heap_base
and __data_end
on wasm32-wasi.__wasm_init_memory
on WebAssembly.__tls_*
on wasm32-unknown-unknown.libresolv
in libstd on Darwinlibstd
no longer pull in libiconv.dylib
on Darwin)order_dependent_trait_objects
show up in future-breakage reportsThese changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
as
casts of enums with #[non_exhaustive]
variantslet else
let_underscore_drop
and let_underscore_lock
from Clippybreak
ing from arbitrary labeled blocks (“label-break-value”)MaybeUninit
is the correct way to work with uninitialized memory.Drop
impl on foreign ADTsspecial_module_name
lint-C instrument-coverage
New targets:
PartialEq::ne
in derive(PartialEq)BCRYPT_RNG_ALG_HANDLE
by defaultSystem
with direct system allocator callsstd::layout::Layout
size must not overflow isize::MAX
when rounded up to align
This also changes the safety conditions on Layout::from_size_align_unchecked
.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:
std::layout::Layout
size must not overflow isize::MAX
when rounded up to align
.
This also changes the safety conditions on Layout::from_size_align_unchecked
.PollFn
now only implements Unpin
if the closure is Unpin
.
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.#![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 via llvm-config
, not the built-in LLVM.lld
. For more information, see issue 102754.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.
x.sh
and x.ps1
shell scripts&T
if every byte in T
is inside an UnsafeCell
unused_tuple_struct_fields
, similar to the existing warning for unused struct fields. This lint will become warn-by-default in the future.#[used]
as llvm.compiler.used for ELF targets--diagnostic-width
compiler flag to define the terminal width.rust-lld
for iOS, tvOS and watchOSwrite!
or writeln!
into an OsString
: Implement fmt::Write
for OsString
FusedIterator
for std::net::[Into]Incoming
impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>
ptr::copy
and ptr::swap
are doing untyped copiesavailable_parallelism
mem::uninitialized
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:
workspace.package
and
workspace.dependencies
for more details on how to define these common settings.--target
flags to build for
multiple targets at once, and the
build.target
config option may now take an array of multiple targets.--jobs
argument can now take a negative number to count backwards from
the max CPUs.cargo add
will now update Cargo.lock
.--crate-type
flag to cargo rustc
to override the crate type.rev
field.-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 versionstransmute_copy
’s U
is not larger than T
BTreeMap
was fixed that allowed data it was borrowing to be dropped before the container.thumbv6m-none-eabi
target, some incorrect asm!
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-position impl Trait
, without fulfilling all the trait bounds of that associated type, as long as the hidden type satisfies said bounds. This has been fixed.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.
Vec::insert
for the case where index == len
.impl Trait
args.cenum_impl_drop_cast
warnings deny-by-default.-C panic=abort
is used regardless of declared ABI.bundle
native library modifier, also removing the
deprecated static-nobundle
linking kind.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Copy
, Clone
, PartialEq
and Eq
for core::fmt::Alignment
.ptr::null
and null_mut
to all thin (including extern) types.impl Read and Write for VecDeque<u8>
.[OsStr]::join
.Hash
for core::alloc::Layout
.OsString
.std::mem::needs_drop
accept ?Sized
.impl Termination for Infallible
and then make the Result
impls of Termination
more generic./proc/self/mem
.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
--config path
command-line argument.CARGO_PKG_RUST_VERSION
.#[link]
attributes are now checked more strictly, which may introduce
errors for invalid attribute arguments that were previously ignored.Duration
. The converted
duration can differ slightly from what it was.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
Rust 1.62.1 addresses a few recent regressions in the compiler and standard library, and also mitigates a CPU vulnerability on Intel SGX.
impl Trait
return types.async fn
lifetimes.x86_64-fortanix-unknown-sgx
target added a mitigation for the
MMIO stale data vulnerability, advisory INTEL-SA-00615.#[derive(Default)]
on enums with a #[default]
variantconst
functions may now specify extern "C"
or extern "Rust"
unaligned_references
lint deny-by-default
This lint is also a future compatibility lint, and is expected to eventually
become a hard error.#[thread_local]
attribute on non-static itemsaarch64-pc-windows-gnullvm
and x86_64-pc-windows-gnullvm
targets*x86_64-unknown-none
target to Tier 2** Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
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
cargo add
command for adding dependencies to Cargo.toml
from
the command-line.
docsname@version
syntax in addition to the
previous name:version
to align with the behavior in cargo add
and other
tools. cargo install
and cargo yank
also now support this syntax so the
version does not need to passed as a separate flag.git
and registry
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).@
argfile support, which will use “response files” if the
command-line to rustc
exceeds the operating system’s limit.cargo test
now passes --target
to rustdoc
if the specified target is
the same as the host target.
#10594macro_rules!
macros, matching other private itemsFile
reads or writes cannot
complete synchronously.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
const fn
signatures can now include generic trait boundsconst fn
signatures can now use impl Trait
in argument and return positionconst fn
impl Trait
return type#[link]
attributes and on the command line, as well as the whole-archive
modifier specifically, are now supportedchar
type is now described as UTF-32 in debuginfo#[target_feature]
attribute can now be used with aarch64 features#[target_feature = "adx"]
is now stableManuallyDrop<T>
is now documented to have the same layout as T
#[ignore = "…"]
messages are printed when running testsstd::io::stdio::lock()
return 'static
handles. Previously, the creation of locked handles to stdin/stdout/stderr would borrow the handles being locked, which prevented writing let out = std::io::stdout().lock();
because out
would outlive the return value of stdout()
. 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. Since available_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.Pin::static_mut
Pin::static_ref
Vec::retain_mut
VecDeque::retain_mut
Write
for Cursor<[u8; N]>
std::os::unix::net::SocketAddr::from_pathname
std::process::ExitCode
and std::process::Termination
. The stabilization of these two APIs now makes it possible for programs to return errors from main
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
No feature changes, but see compatibility notes.
whole-archive
in some cases, but now rustc tries not to use whole-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
a
depends on b
then a
should go first and b
second)+whole-archive
modifier.ident
matchers wrapped in groups#
in r#
raw string literals is now required to be less than 256cargo vendor
now only accepts one value for each --sync
flagcfg
predicates in all()
and any()
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 of all
to write something like cfg(all(feature = "nightly", syntax-requiring-nightly))
, which will now fail to compile. Instead, use either cfg_attr(feature = "nightly", ...)
or nested uses of cfg
.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
#[cfg(panic = "...")]
for either "unwind"
or "abort"
.#[cfg(target_has_atomic = "...")]
for each integer size and "ptr"
.+crt-static
and relocation-model=pic
on x86_64-unknown-linux-gnu
unreachable_pub
lints on nested and glob public reexport-Z instrument-coverage
as -C instrument-coverage
-Z print-link-args
as --print link-args
mips64-openwrt-linux-musl
*armv7-unknown-linux-uclibceabi
(softfloat)*RUST_BACKTRACE=full
by default* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
sort_by_cached_key
Duration::try_from_secs_f32
/f64
accuracy by directly processing exponent and mantissaInstant::{duration_since, elapsed, sub}
saturatingInstant::now
BuildHasherDefault
, iter::Empty
and future::Pending
covariantArc::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)Assign<$t> for Wrapping<$t>
arch::is_aarch64_feature_detected!
toml-rs
to toml_edit
-Ztimings
as --timings
cargo:rustc-link-arg-*
types from build script output.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 to 0
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 in 0
rather than a panic.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
-Cremark
#[test]
-like built-in attribute macro is present multiple times.-Z emit-future-incompat
as --json future-incompat
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.
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
implementing Clone
, 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
Const-stable:
mem::MaybeUninit::as_ptr
mem::MaybeUninit::assume_init
mem::MaybeUninit::assume_init_ref
ffi::CStr::from_bytes_with_nul_unchecked
strip
profile option--release
as -r
term.quiet
configuration--host
from cargo {publish,search,login}#![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.#[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.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
std::fs::remove_dir_all
(CVE-2022-21658)useless_format
Clippy lintnon_send_fields_in_send_ty
Clippy lint to nursery{ident}
in the string. This works in all macros accepting format strings. Support for this in panic!
(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.Unsize
have been relaxed.strip
option to remove these symbols to produce smaller release binaries. Note that this release only includes support in rustc, not directly in cargo.-Cremark
x86_64-unknown-none
at Tier 3** Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
#[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.copy
and copy_nonoverlapping
RefUnwindSafe
for Rc<T>
Termination
for Result<Infallible, E>
. This allows writing fn main() -> Result<Infallible, ErrorType>
, for a program whose successful exits never involve returning from main
(for instance, a program that calls exit
, or that uses exec
to run another program).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
std::process::Command
will no longer search the current directory for executables.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
#[derive]
and will see the original (pre-cfg
) input.m!{ .. }.method()
and m!{ .. }?
.Clone
and Debug
implementations during dead code analysis.armv6k-nintendo-3ds
at Tier 3*.armv7-unknown-linux-uclibceabihf
at Tier 3*.m68k-unknown-linux-gnu
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.
Vec::leak
#[repr(i8)]
to Ordering
File::read_to_end
and read_to_string
#[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.[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:
Clone
and Debug
implementations during dead code analysis.
This will break some builds that set #![deny(dead_code)]
.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
binding @ pattern
can now also introduce new bindings.const fn
.--force-warn
.
This feature is primarily intended for usage by cargo fix
, rather than end users.aarch64-apple-ios-sim
to Tier 2*.powerpc-unknown-freebsd
at Tier 3*.riscv32imc-esp-espidf
at Tier 3*.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
AtomicU{64,128}
over Mutex for Instant backsliding protection.
For this use case, atomics scale much better under contention.Extend<(A, B)>
for (Extend<A>, Extend<B>)
impl From<[(K, V); N]>
for all collections.P: Unpin
bound on impl Future for Pin.=
). 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.std::os::unix::fs::chroot
UnsafeCell::raw_get
BufWriter::into_parts
core::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}
These APIs were previously stable in std
, but are now also available in core
.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:
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS
warn by defaultlibc::getpid
/ std::process::id
from Command::pre_exec
may return different values on glibc <= 2.24.
Rust now invokes the clone3
system call directly, when available, to use new functionality
available via that system call. Older versions of glibc cache the result of getpid
, 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 cache getpid
for exactly this reason.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
X..
), which will start at X
and
will end at the maximum value of the integer.std::prelude
(e.g. use std::prelude::rust_2021::*;
).* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
string::Drain
now implements AsRef<str>
and AsRef<[u8]>
.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 test
.cargo metadata
now includes the "default_run"
field from the manifest.cargo d
as an alias for cargo doc
.{lib}
as formatting option for cargo tree
to print the "lib_name"
of packages.CTRL+F
in your browser.#[doc(hidden)]
will no longer appear in the
“Trait Implementations” section.io::Error
will no longer use the
ErrorKind::Other
variant. This is to better reflect that these
kinds of errors could be categorised into newer more specific ErrorKind
variants, and that they do not represent a user error.process::Command
on Windows now
behaves as expected. Previously using environment variables with
Command
would cause them to be ASCII-uppercased.rustdoc::
RUSTFLAGS
is no longer set for build scripts. Build scripts
should use CARGO_ENCODED_RUSTFLAGS
instead. See the
documentation
for more details.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")]
RunYou 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 have impl Trait<'a, 'b>
where as before you could
only have impl Trait<'a, 'b> where 'b: 'a
.
/lib/rustlib/<target-triple>/target.json
where /
is the “sysroot”
directory. You can find your sysroot directory by running
rustc --print sysroot
.wasm
as a target_family
for WebAssembly platforms.#[target_feature]
on safe functions when targeting
WebAssembly platforms.bpfel-unknown-none
and bpfeb-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.
panic::panic_any
will now #[track_caller]
.OutOfMemory
as a variant of io::ErrorKind
.proc_macro::Literal
now implements FromStr
.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
--prune <spec>
option to cargo-tree
to remove a package from
the dependency graph.--depth
option to cargo-tree
to print only to a certain depth
in the tree no-proc-macro
value to cargo-tree --edges
to hide procedural
macro dependencies.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.?
is no longer permitted in closures for inferred types.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 with codegen-units = 1
.◆
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.|
(OR) on complete patterns. E.g.
let x = Some(2u8);
// Before
matches!(x, Some(1) | Some(2));
// Now
matches!(x, Some(1 | 2));
Run: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.wasm64-unknown-unknown
target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
android_set_abort_message
on
Android platforms when available.slice::IterMut<'_, T>
now implements AsRef<[T]>
IntoIterator
.
Currently calling .into_iter()
as a method on an array will
return impl Iterator<Item=&T>
, but this may change in a
future edition to change Item
to T
. Calling IntoIterator::into_iter
directly on arrays will provide impl Iterator<Item=T>
as expected.leading_zeros
, and trailing_zeros
are now available on all
NonZero
integer types.{f32, f64}::from_str
now parse and print special values
(NaN
, -0
) according to IEEE 754.(Bound<usize>, Bound<usize>)
.BITS
associated constant to all numeric types.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
HEAD
branch is not
“master”. This also includes a switch to the version 3 Cargo.lock
format
which can handle default branches correctly.unpacked
split-debuginfo.authors
field is no longer included in Cargo.toml
for new
projects.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.BITS
constant may conflict with external definitions.
In particular, this was known to be a problem in the lexical-core
crate,
but they have published fixes for semantic versions 0.4 through 0.7. To
update this dependency alone, use cargo update -p lexical-core
.RUSTC_FORCE_INCREMENTAL=1
environment variable added in 1.52.1.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
std::sys::windows::alloc
implementation.get_blanket_impls
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.
unsafe_op_in_unsafe_fn
lint, which checks whether the unsafe code
in an unsafe fn
is wrapped in a unsafe
block. This lint
is allowed by default, and may become a warning or hard error in a
future edition.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.
OsString
now implements Extend
and FromIterator
.cmp::Reverse
now has #[repr(transparent)]
representation.Arc<impl Error>
now implements error::Error
.const
.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::
(e.g. #[warn(rustdoc::broken_intra_doc_links)]
).
Using the old style is still allowed, and will become a warning in
a future release.- [x] Complete
- [ ] Todo
cargo test -- foo bar
will run all tests that match foo
and bar
.std
library on Windows,
allowing you to see std
symbols when debugging.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
RUSTC_BOOTSTRAP
.x86_64-rumprun-netbsd
target.x86_64-sun-solaris
target in favor of x86_64-pc-solaris
.,
,
, and \t
as delimiters for specifying
languages in code blocks.pub_use_of_private_extern_crate
proc-macro-hack
versions. A cargo update
should be sufficient to fix this in all cases.#[derive]
into a regular macro attributestruct
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
, or char
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])
}
}
}
Run-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.aarch64_be-unknown-linux-gnu
,
aarch64-unknown-linux-gnu_ilp32
, and aarch64_be-unknown-linux-gnu_ilp32
targets.i386-unknown-linux-gnu
and i486-unknown-linux-gnu
targets.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.
Box::downcast
is now also implemented for any dyn Any + Send + Sync
object.str
now implements AsMut<str>
.u64
and u128
now implement From<char>
.Error
is now implemented for &T
where T
implements Error
.Poll::{map_ok, map_err}
are now implemented for Poll<Option<Result<T, E>>>
.unsigned_abs
is now implemented for all signed integer types.io::Empty
now implements io::Seek
.rc::Weak<T>
and sync::Weak<T>
’s methods such as as_ptr
are now implemented for
T: ?Sized
types.Div
and Rem
by their NonZero
variant is now implemented for all unsigned integers.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
split-debuginfo
profile option to control the -Csplit-debuginfo
codegen option.resolver
field to Cargo.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 a std
feature in a build scripts and
proc-macros, while using the no-std
feature in the final binary. See the
Cargo book documentation for more information on the feature.Deref
traits.--default-theme
flag which sets the default theme to use for
documentation.Various improvements to intra-doc links:
slice
.Vec<T>
.wasm-bindgen
ABI, and instead use the wasm32 ABI.rustc
no longer promotes division, modulo and indexing operations to const
that
could fail.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 use hint::spin_loop
instead.const
values for x
in [x; N]
array expressions.
This has been technically possible since 1.38.0, as it was unintentionally stabilized.ManuallyDrop<T>
union fields are now considered safe.armv5te-unknown-linux-uclibceabi
target.aarch64-apple-ios-macabi
target.x86_64-unknown-freebsd
is now built with the full toolset.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
proc_macro::Punct
now implements PartialEq<char>
.ops::{Index, IndexMut}
are now implemented for fixed sized arrays of any length.std::fs::File
type now has a “niche” of -1
.
This value cannot be a valid file descriptor, and now means Option<File>
takes
up the same amount of space as File
.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.[build.rustc-workspace-wrapper]
option.
This option sets a wrapper to execute instead of rustc
, for workspace members only.cargo:rerun-if-changed
will now, if provided a directory, scan the entire
contents of that directory for changes.--workspace
flag to the cargo update
command.compare_and_swap
method on atomics has been deprecated. It’s
recommended to use the compare_exchange
and compare_exchange_weak
methods instead.TokenStream
s are checked have fixed some cases where you could write
unhygenic macro_rules!
macros.#![test]
as an inner attribute is now considered unstable like other inner macro
attributes, and reports an error by default through the soft_unstable
lint.forbid
lint at the same level that it was set is now a hard error.panic!
calls by supplying your own macro. It’s
recommended to use the #[panic_handler]
attribute to provide your own implementation.struct Foo {};
) now produce a warning.Drop
, and you can now have a field in a union
with ManuallyDrop<T>
.#[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);
Runaarch64-unknown-linux-gnu
.aarch64-apple-darwin
.aarch64-pc-windows-msvc
.mipsel-unknown-none
.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
RangeInclusive
now checks for exhaustion when calling contains
and indexing.ToString::to_string
now no longer shrinks the internal buffer in the default implementation.The following previously stable methods are now const
.
cargo-package
should now be independently reproducible.cargo-tree
now marks proc-macro crates.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.i686-unknown-freebsd
from host tier 2 to target tier 2 support.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
initial-exec
Thread
Local Storage model.system
to the llvm-libunwind
bootstrap config option.--color
for configuring terminal color support to bootstrap.unsafe
keyword is now syntactically permitted on modules. This
is still rejected semantically, but can now be parsed by procedural macros.-C link-self-contained=<yes|no>
compiler flag. This tells
rustc
whether to link its own C runtime and libraries or to rely on a external
linker to find them. (Supported only on windows-gnu
, linux-musl
, and wasi
platforms.)-C target-feature=+crt-static
on linux-gnu
targets.
Note: If you’re using cargo you must explicitly pass the --target
flag.aarch64-unknown-linux-musl
.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
io::Write
is now implemented for &ChildStdin
&Sink
, &Stdout
,
and &Stderr
.TryFrom<Vec<T>>
.matches!
macro now supports having a trailing comma.Vec<A>
now implements PartialEq<[B]>
where A: PartialEq<B>
.RefCell::{replace, replace_with, clone}
methods now all use #[track_caller]
.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
rustdoc
using the intra-doc link
syntax. E.g. /// Uses [`std::future`]
will automatically generate
a link to std::future
’s documentation. See “Linking to items by
name” for more information.#[doc(alias = "<alias>")]
on items to add search aliases
when searching through rustdoc
’s UI.'static
lifetime inside const fn
now follows the
same rules as inside a fn
body. In particular, &foo()
will not be
promoted to 'static
lifetime any more inside const fn
s.&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._mm256_extract_epi8
and _mm256_extract_epi16
signatures in
arch::{x86, x86_64}
to return i32
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.catch_unwind
and will cause an abort.
Note: This behaviour is not guaranteed and is still considered undefined behaviour,
see the catch_unwind
documentation for further information.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
rustc
from source now uses ninja
by default over make
.
You can continue building with make
by setting ninja=false
in
your config.toml
.fewer_names
in uncached_llvm_type
ensure_sufficient_stack()
non-generic-C control-flow-guard
codegen option, which enables
Control Flow Guard for Windows platforms, and is ignored on other
platforms.thumbv4t-none-eabi
target.RUST_BACKTRACE
’s output is now more compact.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
CStr
now implements Index<RangeFrom<usize>>
.std
/core
are now implemented for arrays of any length, not just
those of length less than 33.ops::RangeFull
and ops::Range
now implement Default.panic::Location
now implements Copy
, Clone
, Eq
, Hash
, Ord
,
PartialEq
, and PartialOrd
.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.
new
method for all NonZero
integers.checked_add
,checked_sub
,checked_mul
,checked_neg
, checked_shl
,
checked_shr
, saturating_add
, saturating_sub
, and saturating_mul
methods for all integers.checked_abs
, saturating_abs
, saturating_neg
, and signum
for all
signed integers.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
, and
is_ascii_control
methods for char
and u8
.build-dependencies
are now built with opt-level 0 by default.
You can override this by setting the following in your Cargo.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 a test
field indicating if a target has
tests enabled.workspace.default-members
now respects workspace.exclude
.cargo-publish
will now use an alternative registry by default if it’s the
only registry specified in package.publish
.{} && false
in tail expressions.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 handle
Delimiter::None
.linux-gnu
targets now require minimum kernel 2.6.32 and glibc 2.11.rustc-docs
component. This allows you to install
and read the documentation for the compiler internal APIs. (Currently only
available for x86_64-unknown-linux-gnu
.)x.py
. You can read details about this change in the “Changes to x.py
defaults” post on the Inside Rust blog.if
, match
, and loop
expressions can now be used in const functions.&[T]
) in
const functions.#[track_caller]
attribute can now be added to functions to use the
function’s caller’s location information for panic messages.x.0.0
over (x.0).0
.mem::transmute
can now be used in statics and constants. Note
You currently can’t use mem::transmute
in constant functions.cdylib
target on Apple iOS and tvOS platforms.x86_64-unknown-linux-musl
.mem::forget
is now a const fn
.String
now implements From<char>
.leading_ones
, and trailing_ones
methods have been stabilised for all
integer types.vec::IntoIter<T>
now implements AsRef<[T]>
.NonZeroU8
) now implement TryFrom
for their
zero-able equivalent (e.g. TryFrom<u8>
).&[T]
and &mut [T]
now implement PartialEq<Vec<T>>
.(String, u16)
now implements ToSocketAddrs
.vec::Drain<'_, T>
now implements AsRef<[T]>
.Added a number of new environment variables that are now available when compiling your crate.
CARGO_BIN_NAME
and CARGO_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.abi_blacklist
has been renamed
to unsupported_abis
. The old name will still continue to work.Drop
.
This was previously accepted but will become a hard error in a future release.#[repr(i128)]
or #[repr(u128)]
. This representation is currently only
allowed on enum
s.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.{f32, f64}::asinh
now returns the correct values for negative numbers.rustc
would erroneously allow
you to pass a shorter lifetime than expected.libz
(also called zlib
) on Linux.
The library will need to be installed for rustc
to work, even though we
expect it to be already available on most systems.#[should_panic]
are broken on ARMv7 while running
under QEMU.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 uses T
’s discriminant type instead of always
using u64
.macro_rules!
) macro.target-feature
flag. E.g. -C target-feature=+avx2 -C target-feature=+fma
is now
equivalent to -C target-feature=+avx2,+fma
.force-unwind-tables
flag. This option allows
rustc to always generate unwind tables regardless of panic strategy.embed-bitcode
flag. This codegen flag allows rustc
to include LLVM bitcode into generated rlib
s (this is on by default).tiny
value to the code-model
codegen flag.mipsel-sony-psp
target.thumbv7a-uwp-windows-msvc
target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
net::{SocketAddr, SocketAddrV4, SocketAddrV6}
now implements PartialOrd
and Ord
.proc_macro::TokenStream
now implements Default
.char
with
ops::{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"
RunOsString
now implements FromStr
.saturating_neg
method has been added to all signed integer primitive
types, and the saturating_abs
method has been added for all integer
primitive types.Arc<T>
, Rc<T>
now implement From<Cow<'_, T>>
, and Box
now
implements From<Cow>
when T
is [T: Copy]
, str
, CStr
, OsStr
,
or Path
.Box<[T]>
now implements From<[T; N]>
.BitOr
and BitOrAssign
are implemented for all NonZero
integer types.fetch_min
, and fetch_max
methods have been added to all atomic
integer types.fetch_update
method has been added to all atomic integer types.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
~~outdated information~~
becomes “{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.lto
flag is incompatible with the new embed-bitcode=no
.
This may cause issues if LTO is enabled through RUSTFLAGS
or cargo rustc
flags while cargo is adding embed-bitcode
itself. The recommended way to
control LTO is with Cargo profiles, either in Cargo.toml
or .cargo/config
,
or by setting CARGO_PROFILE_<name>_LTO
in the environment.Syntax-only changes
#[cfg(FALSE)]
mod foo {
mod bar {
mod baz; // `foo/bar/baz.rs` doesn't exist, but no error!
}
}
RunThese are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
-C codegen-units
flag in incremental mode.
Additionally when in incremental mode rustc defaults to 256 codegen units.catch_unwind
to have zero-cost, unless unwinding is enabled and
a panic is thrown.aarch64-unknown-none
and
aarch64-unknown-none-softfloat
targets.arm64-apple-tvos
and
x86_64-apple-tvos
targets.vec![]
to map directly to Vec::new()
. This allows
vec![]
to be able to be used in const
contexts.convert::Infallible
now implements Hash
.OsString
now implements DerefMut
and IndexMut
returning
a &mut OsStr
.String
now implements From<&mut str>
.IoSlice
now implements Copy
.Vec<T>
now implements From<[T; N]>
. Where N
is at most 32.proc_macro::LexError
now implements fmt::Display
and Error
.from_le_bytes
, to_le_bytes
, from_be_bytes
, to_be_bytes
,
from_ne_bytes
, and to_ne_bytes
methods are now const
for all
integer types.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 tree
command which will print a tree graph of
your dependencies. E.g.
mdbook 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
...
Runcargo tree -d
(short for cargo tree --duplicates
)..a
extension, rather than the previous .lib
.-C no_integrated_as
flag from rustc.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.mem::{zeroed, uninitialised}
will now panic when used with types that do
not allow zero initialization such as NonZeroU8
. This was
previously a warning.f64
to u32
using the as
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.These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
cargo package --list
not working with unpublished dependencies.&{number}
(e.g. &1.0
) not having
the type inferred correctly.#[cfg()]
can now be used on if
expressions.Syntax only changes
type Foo: Ord
syntactically.self
in all fn
contexts.fn
syntax + cleanup item parsing.item
macro fragments can be interpolated into trait
s, impl
s, and extern
blocks.
For example, you may now write:
macro_rules! mac_trait {
($i:item) => {
trait T { $i }
}
}
mac_trait! {
fn foo() {}
}
RunThese are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
rustc -D unused -A unused-variables
denies
everything in the unused
lint group except unused-variables
which
is explicitly allowed. However, passing rustc -A unused-variables -D unused
denies
everything in the unused
lint group including unused-variables
since
the allow flag is specified before the deny flag (and therefore overridden).windows-gnu
.Arc<[T; N]>
, Box<[T; N]>
, and Rc<[T; N]>
, now implement
TryFrom<Arc<[T]>>
,TryFrom<Box<[T]>>
, and TryFrom<Rc<[T]>>
respectively. Note These conversions are only available when N
is 0..=32
.u32::MAX
or
f32::NAN
with no imports.u8::is_ascii
is now const
.String
now implements AsMut<str>
.primitive
module to std
and core
. This module
reexports Rust’s primitive types. This is mainly useful in macros
where you want avoid these types being shadowed.HashMap
and HashSet
.string::FromUtf8Error
now implements Clone + Eq
.[profile]
s in your .cargo/config
, or through
your environment.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 named my-program
you would use env!("CARGO_BIN_EXE_my-program")
.const_err
lint were deemed unrelated to const
evaluation, and have been moved to the unconditional_panic
and
arithmetic_overflow
lints.assert!
macro is now a hard error. This
has been a warning since 1.36.0.Self
not having the correctly inferred type. This incorrectly
led to some instances being accepted, and now correctly emits a hard error.These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc
and
related tools.
opt-level=3
instead of 2
.#[inline]
-ing certain hot functions.Drop
terminators for enum variants without drop glueYou 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),
}
}
RunYou can now use #[repr(transparent)]
on univariant enum
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 in trait
definitions.impl
s (i.e. const
s, type
s, and fn
s) may syntactically
leave out their bodies in favor of ;
.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.
armv7a-none-eabi
.riscv64gc-unknown-linux-gnu
.Option::{expect,unwrap}
and
Result::{expect, expect_err, unwrap, unwrap_err}
now produce panic messages
pointing to the location where they were called, rather than
core
’s internals. * Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
iter::Empty<T>
now implements Send
and Sync
for any T
.Pin::{map_unchecked, map_unchecked_mut}
no longer require the return type
to implement Sized
.io::Cursor
now derives PartialEq
and Eq
.Layout::new
is now const
.riscv64gc-unknown-linux-gnu
.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
Error::description
has been deprecated, and its use will now produce a
warning. It’s recommended to use Display
/to_string
instead.Copy
implsLayout::repeat
impl<T> From<Foo> for Vec<T> {}
.self
position. E.g. you can
now write fn foo(self: Box<Box<Self>>) {}
. Previously only Self
, &Self
,
&mut Self
, Arc<Self>
, Rc<Self>
, and Box<Self>
were allowed.format_args
macro.
Previously identifiers starting with an underscore were not allowed.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.extern "C"
function with Box<T>
and use T*
as the corresponding
type on the C side. Please see the documentation for more information,
including the important caveat about preferring to avoid Box<T>
in Rust signatures for functions defined in C.'label
s.i686-unknown-dragonfly
target.riscv64gc-unknown-linux-gnu
target.@path
syntax
to rustc. Note that the format differs somewhat from what is
found in other tooling; please see the documentation for
more information.--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.
core::panic
module is now stable. It was already stable
through std
.NonZero*
numerics now implement From<NonZero*>
if it’s a smaller integer
width. E.g. NonZeroU16
now implements From<NonZeroU8>
.MaybeUninit<T>
now implements fmt::Debug
.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-install
will now reinstall the package if it detects that it is out
of date.[profile.dev.package.image] opt-level = 2
sets the image
crate’s
optimisation level to 2
for debug builds. You can also use
[profile.<profile>.build-override]
to override build scripts and
their dependencies.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.--theme
, and check the
current theme with --check-theme
.#[cfg(doc)]
to compile an item when building documentation.You can now use tuple struct
s and tuple enum
variant’s constructors in
const
contexts. e.g.
pub struct Point(i32, i32);
const ORIGIN: Point = {
let constructor = Point;
constructor(0, 0)
};
RunYou can now mark struct
s, enum
s, and enum
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-exhaustive enum
. (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 in macro_rules!
now correctly matches the modern
attribute syntax. For example (#[$m:meta])
now matches #[attr]
,
#[attr{tokens}]
, #[attr[tokens]]
, and #[attr(tokens)]
.
thumbv7neon-unknown-linux-musleabihf
target.aarch64-unknown-none-softfloat
target.mips64-unknown-linux-muslabi64
, and
mips64el-unknown-linux-muslabi64
targets.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
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!
--all-features
) passed to a virtual workspace will
now produce an error. Previously these flags were ignored.dev-dependencies
without including
a version
.include!
macro will now warn if it failed to include the
entire file. The include!
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.#[inline]
on function prototypes and consts now emits a warning under
unused_attribute
lint. Using #[inline]
anywhere else inside traits
or extern
blocks now correctly emits a hard error.async
functions and blocks with async fn
, async move {}
, and
async {}
respectively, and you can now call .await
on async expressions.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()
}
Runif
guards
of match
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!(),
}
}
Runi686-unknown-uefi
target.sparc64-unknown-openbsd
target.--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.
Vec::new
and String::new
are now const
functions.LinkedList::new
is now a const
function.str::len
, [T]::len
and str::as_bytes
are now const
functions.abs
, wrapping_abs
, and overflowing_abs
numeric functions are
now const
.version
.--all
flag has been renamed to --workspace
. Using
--all
is now deprecated.rustdoc
now requires rustc
to be installed and in the same directory to
run tests. This should improve performance when running a large
amount of doctests.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
returned 0.0
.#[global_allocator]
attribute can now be used in submodules.#[deprecated]
attribute can now be used on macros.rustc
. This will
improve compilation times in some cases. For further information please refer
to the “Evaluating pipelined rustc compilation” thread.aarch64-uwp-windows-msvc
, i686-uwp-windows-gnu
,
i686-uwp-windows-msvc
, x86_64-uwp-windows-gnu
, and
x86_64-uwp-windows-msvc
targets.armv7-unknown-linux-gnueabi
and
armv7-unknown-linux-musleabi
targets.hexagon-unknown-linux-musl
target.riscv32i-unknown-none-elf
target.* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
ascii::EscapeDefault
now implements Clone
and Display
.Clone
, Debug
, Hash
) are now
available at the same path as the trait. (e.g. The Clone
derive macro
is available at std::clone::Clone
). This also makes all built-in macros
available in std
/core
root. e.g. std::include_bytes!
.str::Chars
now implements Debug
.slice::{concat, connect, join}
now accepts &[T]
in addition to &T
.*const T
and *mut T
now implement marker::Unpin
.Arc<[T]>
and Rc<[T]>
now implement FromIterator<T>
.div_euclid
,
rem_euclid
) to all numeric primitives. Additionally checked
,
overflowing
, and wrapping
versions are available for all
integer primitives.thread::AccessError
now implements Clone
, Copy
, Eq
, Error
, and
PartialEq
.iter::{StepBy, Peekable, Take}
now implement DoubleEndedIterator
.<*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
.--features
option multiple times to enable
multiple features.x86_64-unknown-uefi
platform can not be built with rustc
1.38.0.armv7-unknown-linux-gnueabihf
platform is known to have
issues with certain crates such as libc.#[must_use]
will now warn if the type is contained in a tuple,
Box
, or an array and unused.cfg
and cfg_attr
attributes on
generic parameters.type MyOption = Option<u8>;
fn increment_or_zero(x: MyOption) -> u8 {
match x {
MyOption::Some(y) => y + 1,
MyOption::None => 0,
}
}
Run_
as an identifier for consts. e.g. You can write
const _: u32 = 5;
.#[repr(align(X)]
on enums.?
Kleene macro operator is now available in the
2015 edition.-C profile-generate
and -C profile-use
flags. For more information on how to use profile
guided optimization, please refer to the rustc book.rust-lldb
wrapper script should now work again.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.lock
files are now included by default when publishing executable crates
with executables.default-run="foo"
in [package]
to specify the
default executable to use for cargo run
....
for inclusive range patterns will now warn by default.
Please transition your code to using the ..=
syntax for inclusive
ranges instead.dyn
will now warn by default.
Please transition your code to use dyn Trait
for trait objects instead.dyn Send + fmt::Debug
is now equivalent to
dyn fmt::Debug + Send
, where this was previously not the case.HashMap
’s implementation has been replaced with hashbrown::HashMap
implementation.TryFromSliceError
now implements From<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 implements BorrowMut<str>
.io::Cursor
now implements Default
.NonNull::{dangling, cast}
are now const fns.alloc
crate is now stable. alloc
allows you to use a subset
of std
(e.g. Vec
, Box
, Arc
) in #![no_std]
environments if the
environment has access to heap memory allocation.String
now implements From<&String>
.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.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
--offline
flag to run cargo without accessing the network.You can find further change’s in Cargo’s 1.36.0 release notes.
There have been numerous additions and fixes to clippy, see Clippy’s 1.36.0 release notes for more details.
mem::MaybeUninit
, mem::uninitialized
use is no
longer recommended, and will be deprecated in 1.39.0.FnOnce
, FnMut
, and the Fn
traits are now implemented for Box<FnOnce>
,
Box<FnMut>
, and Box<Fn>
respectively.unsafe fn call_unsafe(func: unsafe fn()) {
func()
}
pub fn main() {
unsafe { call_unsafe(|| {}); }
}
Runarmv6-unknown-freebsd-gnueabihf
and
armv7-unknown-freebsd-gnueabihf
targets.wasm32-unknown-wasi
target.Thread
will now show its ID in Debug
output.StdinLock
, StdoutLock
, and StderrLock
now implement AsRawFd
.alloc::System
now implements Default
.Debug
output ({:#?}
) for structs now has a trailing comma on the
last field.char::{ToLowercase, ToUppercase}
now
implement ExactSizeIterator
.NonZero
numeric types now implement FromStr
.Read
trait bounds
on the BufReader::{get_ref, get_mut, into_inner}
methods.dbg!
macro without any parameters to print the file
and line where it is called.str::make_ascii_lowercase
hash_map::{OccupiedEntry, VacantEntry}
now implement Sync
and Send
.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:rustc-cdylib-link-arg
at build time to pass custom
linker arguments when building a cdylib
. Its usage is highly
platform specific.redundant_closure
Clippy lintmissing_const_for_fn
Clippy lint#[deprecated = "reason"]
as a shorthand for
#[deprecated(note = "reason")]
. This was previously allowed by mistake
but had no effect.#[attr()]
,#[attr[]]
, and
#[attr{}]
procedural macros.extern crate self as foo;
to import your
crate’s root into the extern prelude.riscv64imac-unknown-none-elf
and
riscv64gc-unknown-none-elf
.-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.powerpc64-unknown-freebsd
.HashMap<K, V, S>
’s and
HashSet<T, S>
’s basic methods. Most notably you no longer require
the Hash
trait to create an iterator.Ord
trait bounds have been removed on some of BinaryHeap<T>
’s basic
methods. Most notably you no longer require the Ord
trait to create
an iterator.overflowing_neg
and wrapping_neg
are now const
functions
for all numeric types.str
is now generic over all types that
implement SliceIndex<str>
.str::trim
, str::trim_matches
, str::trim_{start, end}
, and
str::trim_{start, end}_matches
are now #[must_use]
and will
produce a warning if their returning type is unused.checked_pow
, saturating_pow
, wrapping_pow
, and
overflowing_pow
are now available for all numeric types. These are
equivalent to methods such as wrapping_add
for the pow
operation.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
Command::before_exec
is being replaced by the unsafe method
Command::pre_exec
and will be deprecated with Rust 1.37.0.ATOMIC_{BOOL, ISIZE, USIZE}_INIT
is now deprecated as you
can now use const
functions in static
variables.cfg(target_vendor)
attribute. E.g.
#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }
u8
that covers 0..=255
and
you would no longer be required to have a _ => unreachable!()
case.if let
and while let
expressions. You can do this with the same syntax as a match
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);
}
}
Runif let
and while let
patterns. Using
this feature will by default produce a warning as this behaviour can be
unintuitive. E.g. if let _ = 5 {}
let
bindings, assignments, expression statements,
and irrefutable pattern destructuring in const functions.const unsafe fn foo() -> i32 { 5 }
const fn bar() -> i32 {
unsafe { foo() }
}
Runcfg_attr
attribute.
E.g. #[cfg_attr(all(), must_use, optimize)]
#[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._
. 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 {}
RunRc
, Arc
, and Pin
as method receivers.rustc
with the -Clinker-flavor
command line argument.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.thumbv7neon-linux-androideabi
and
thumbv7neon-unknown-linux-gnueabihf
targets.x86_64-unknown-uefi
target.overflowing_{add, sub, mul, shl, shr}
are now const
functions for all numeric types.rotate_left
, rotate_right
, and wrapping_{add, sub, mul, shl, shr}
are now const
functions for all numeric types.is_positive
and is_negative
are now const
functions for
all signed numeric types.get
method for all NonZero
types is now const
.count_ones
, count_zeros
, leading_zeros
, trailing_zeros
,
swap_bytes
, from_be
, from_le
, to_be
, to_le
are now const
for all
numeric types.Ipv4Addr::new
is now a const
functionunix::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 publish --features
or cargo publish --all-features
.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 the str::{trim_start, trim_end, trim_start_matches, trim_end_matches}
methods instead.Error::cause
method has been deprecated in favor of Error::source
which supports
downcasting.--test-threads=1
. It also runs the tests in deterministic order?
operator in macro definitions. The ?
operator allows you to specify zero or one repetitions similar to the *
and
+
operators.super
, self
, or crate
, 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::*;
RunPhantomData<T>
types.literal
specifier. This will match against a literal of any type.
E.g. 1
, 'A'
, "Hello World"
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,
}
}
}
Runenum List<T>
where
Self: PartialOrd<Self> // can write `Self` instead of `List<T>`
{
Nil,
Cons(T, Box<Self>) // likewise here
}
Run#[must_use]
. This provides a warning if
a impl Trait
or dyn Trait
is returned and unused in the program.aarch64-pc-windows-msvc
target.PathBuf
now implements FromStr
.Box<[T]>
now implements FromIterator<T>
.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);
RunThe 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
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 c
as an alias for cargo check
._mm256_stream_si256
, _mm256_stream_pd
, _mm256_stream_ps
have
been changed from *const
to *mut
as the previous implementation
was unsound.powerpc-unknown-netbsd
impl<'a> Reader for BufReader<'a> {}
can now be
impl Reader for BufReader<'_> {}
. Lifetimes are still required to be defined
in structs.const
functions. These are currently
a strict minimal subset of the const fn RFC. Refer to the
language reference for what exactly is available.#[allow(clippy::filter_map)]
.#[no_mangle]
and #[export_name]
attributes can now be located anywhere in
a crate, not just in exported functions.num::NonZero*
types to their raw equivalents using the
From
trait. E.g. u8
now implements From<NonZeroU8>
.&Option<T>
into Option<&T>
and &mut Option<T>
into Option<&mut T>
using the From
trait.*
) a time::Duration
by a u32
.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
package
key in your dependencies.r#
), e.g. let r#for = true;
crate
in paths. This allows you to refer to the
crate root in the path, e.g. use crate::foo;
refers to foo
in src/lib.rs
.::
.
Previously, using a external crate in a module without a use statement
required let json = ::serde_json::from_str(foo);
but can now be written
as let json = serde_json::from_str(foo);
.#[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;
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.pub
, pub(crate)
) in macros
using the vis
specifier.#[attr("true")]
, and you can now
write #[attr(true)]
.#[panic_handler]
attribute.riscv32imc-unknown-none-elf
target.aarch64-unknown-netbsd
targetThe following methods are replacement methods for trim_left
, trim_right
,
trim_left_matches
, and trim_right_matches
, which will be deprecated
in 1.33.0:
cargo run
doesn’t require specifying a package in workspaces.cargo doc
now supports --message-format=json
. This is
equivalent to calling rustdoc --error-format=json
.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.rust-gdbgui
script that invokes gdbgui
with Rust
debug symbols.rustfmt
or clippy
are now
available, e.g. #[rustfmt::skip]
will skip formatting the next item.rls-preview
component on the windows-gnu targets has been restored.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.
powerpc64le-unknown-linux-musl
target.aarch64-unknown-hermit
and x86_64-unknown-hermit
targets.Once::call_once
no longer requires Once
to be 'static
.BuildHasherDefault
now implements PartialEq
and Eq
.Box<CStr>
, Box<OsStr>
, and Box<Path>
now implement Clone
.PartialEq<&str>
for OsString
and PartialEq<OsString>
for &str
.Cell<T>
now allows T
to be unsized.SocketAddr
is now stable on Redox.--locked
to disable this behavior.cargo-install
will now allow you to cross compile an install
using --target
.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.rustdoc
now has the --cap-lints
option which demotes all lints above
the specified level to that level. For example --cap-lints warn
will demote deny
and forbid
lints to warn
.rustc
and rustdoc
will now have the exit code of 1
if compilation
fails and 101
if there is a panic.rustup component add clippy-preview
.str::{slice_unchecked, slice_unchecked_mut}
are now deprecated.
Use str::get_unchecked(begin..end)
instead.std::env::home_dir
is now deprecated for its unintuitive behavior.
Consider using the home_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.#[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.pure
, sizeof
, alignof
, and offsetof
have been unreserved
and can now be used as identifiers.GlobalAlloc
trait and #[global_allocator]
attribute are now
stable. This will allow users to specify a global allocator for
their program.#[test]
attribute can now return
Result<(), E: Debug>
in addition to ()
.lifetime
specifier for macro_rules!
is now stable. This
allows macros to easily target lifetimes.s
and z
optimisation levels are now stable. These optimisations
prioritise making smaller binary sizes. z
is the same as s
with the
exception that it does not vectorise loops, which typically results in an even
smaller binary.--error-format=short
this option will provide a more compressed output of
rust error messages.macro_export
s.Default
for &mut str
.From<bool>
for all integer and unsigned number types.Extend
for ()
.Debug
implementation of time::Duration
should now be more easily
human readable. Previously a Duration
of one second would printed as
Duration { secs: 1, nanos: 0 }
and will now be printed as 1s
.From<&String>
for Cow<str>
, From<&Vec<T>>
for Cow<[T]>
,
From<Cow<CStr>>
for CString
, From<CString>, From<CStr>, From<&CString>
for Cow<CStr>
, From<OsString>, From<OsStr>, From<&OsString>
for
Cow<OsStr>
, From<&PathBuf>
for Cow<Path>
, and From<Cow<Path>>
for PathBuf
.Shl
and Shr
for Wrapping<u128>
and Wrapping<i128>
.DirEntry::metadata
now uses fstatat
instead of lstat
when
possible. This can provide up to a 40% speed increase.format!
.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
src
directory. The src
directory in a crate should be
considered to be immutable.suggestion_applicability
field in rustc
’s json output is now
stable. This will allow dev tools to check whether a code suggestion
would apply to them.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"); }
}
Runrustdoc 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.
proc
to
be used as an identifier.Trait
syntax, and should make it clearer when being used in tandem with
impl Trait
because it is equivalent to the following syntax:
&Trait == &dyn Trait
, &mut Trait == &mut dyn Trait
, and
Box<Trait> == Box<dyn Trait>
.fn foo<#[lifetime_attr] 'a, #[type_attr] T: 'a>() {}
#[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.arch::x86
& arch::x86_64
modules which contain
SIMD intrinsics, a new macro called is_x86_feature_detected!
, the
#[target_feature(enable="")]
attribute, and adding target_feature = ""
to
the cfg
attribute.[u8]
, f32
, and f64
previously only available in
std are now available in core.Rhs
type parameter on ops::{Shl, ShlAssign, Shr}
now defaults
to Self
.std::str::replace
now has the #[must_use]
attribute to clarify
that the operation isn’t done in place.Clone::clone
, Iterator::collect
, and ToOwned::to_owned
now have
the #[must_use]
attribute to warn about unused potentially
expensive allocations.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-metadata
now includes authors
, categories
, keywords
,
readme
, and repository
fields.cargo-metadata
now includes a package’s metadata
table.--target-dir
optional argument. This allows you to specify
a different directory than target
for placing compilation artifacts.[[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_CACHE_RUSTC_INFO=0
in your environment.doc.rust-lang.org
are now searchable.CharExt
or StrExt
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 on atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize}
will only print the inner type. E.g.
print!("{:?}", AtomicBool::new(true))
will print true
,
not AtomicBool(true)
.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..description()
method on the std::error::Error
trait
has been soft-deprecated. It is no longer required to implement it.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.impl Trait
in method arguments.Copy
and/or Clone
if all captured variables
implement either or both traits.for x in 0..=10
is now stable.'_
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>
or
fn open(path: impl AsRef<Path>)
.u128
and i128
are now stable.main
can now return Result<(), E: Debug>
in addition to ()
.let points = [1, 2, 3, 4];
match points {
[1, 2, 3, 4] => println!("All points were sequential."),
_ => println!("Not all points were sequential."),
}
Runwasm32-unknown-unknown
.--remap-path-prefix
option to rustc. Allowing you
to remap path prefixes outputted by the compiler.powerpc-unknown-netbsd
target.From<u16> for usize
& From<{u8, i16}> for isize
.assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]")
Default, Hash
for cmp::Reverse
.str::repeat
being 8x faster in large cases.ascii::escape_default
is now available in libcore.Copy, Clone
for cmp::Reverse
Clone
for char::{ToLowercase, ToUppercase}
.*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
-v
is
passed with --list
Fn
trait as dyn
no longer works. E.g. the following
syntax is now invalid.
use std::ops::Fn as dyn;
fn g(_: Box<dyn(std::fmt::Debug)>) {}
Run'static
.
e.g.
fn main() {
const PAIR: &(i32, i32) = &(0, 1);
let _reversed_pair: &'static _ = &(PAIR.1, PAIR.0); // Doesn't work
}
RunAsciiExt
trait in favor of inherent methods.".e0"
will now no longer parse as 0.0
and will instead cause
an error.#[repr(align(x))]
attribute is now stable. RFC 1358use std::{fs::File, io::Read, path::{Path, PathBuf}};
|
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"),
}
}
Runprocess::Command
on Unix.ParseCharError
.UnsafeCell::into_inner
is now safe.Float::{from_bits, to_bits}
is now available in libcore.AsRef<Path>
for ComponentWrite
for Cursor<&mut Vec<u8>>
Duration
to libcore.The following functions can now be used in a constant expression.
eg. static MINUTE: Duration = Duration::from_secs(60);
cargo new
no longer removes rust
or rs
prefixes/suffixes.cargo new
now defaults to creating a binary crate, instead of a
library crate.net::lookup_host
.rustdoc
has switched to pulldown as the default markdown renderer.#[simd]
.sysv64
ffi is now available.
eg. extern "sysv64" fn foo () {}
codegen-units=1
.armv4t-unknown-linux-gnueabi
target.aarch64-unknown-openbsd
supportstr::find::<char>
now uses memchr. This should lead to a 10x
improvement in performance in the majority of cases.OsStr
’s Debug
implementation is now lossless and consistent
with Windows.time::{SystemTime, Instant}
now implement Hash
.From<bool>
for AtomicBool
From<{CString, &CStr}>
for {Arc<CStr>, Rc<CStr>}
From<{OsString, &OsStr}>
for {Arc<OsStr>, Rc<OsStr>}
From<{PathBuf, &Path}>
for {Arc<Path>, Rc<Path>}
AsciiExt
methods onto char
T: Sized
requirement on ptr::is_null()
From<RecvError>
for {TryRecvError, RecvTimeoutError}
f32::{min, max}
to generate more efficient x86 assembly[u8]::contains
now uses memchr which provides a 3x speed improvementThe 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
workspace.default-members
config that
overrides implied --all
in virtual workspaces.Cargo.toml
and .cargo/config
to disable on a
per-project or global basis respectively.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.Formatter::flags
method is now deprecated. The sign_plus
,
sign_minus
, alternate
, and sign_aware_zero_pad
should be used instead.column!()
macro is one-based instead of zero-basedfmt::Arguments
can no longer be shared across threads#[repr(packed)]
struct fields is now unsafeauto
traits are now permitted in trait objects.TrapUnreachable
in LLVM which should mitigate the impact of
undefined behavior.assert_eq/ne
macroFrom<*mut T>
for AtomicPtr<T>
From<usize/isize>
for AtomicUsize/AtomicIsize
.T: Sync
requirement for RwLock<T>: Send
T: Sized
requirement for {<*const T>, <*mut T>}::as_ref
and <*mut T>::as_mut
Thread::{park, unpark}
implementationSliceExt::binary_search
performance.FromIterator<()>
for ()
AsciiExt
trait methods to primitive types. Use of AsciiExt
is now deprecated.cargo uninstall foo bar
uninstalls foo
and bar
.cargo check
cargo install --version
char::escape_debug
now uses Unicode 10 over 9.non_snake_case
lint now allows extern no-mangle functionsT op= &T
now works for numeric types. eg. let mut x = 2; x += &8;
Drop
are now allowed in const
and static
typesle32-unknown-nacl
armv5te_unknown_linux_gnueabi
Box<Error>
now impls From<Cow<str>>
std::mem::Discriminant
is now guaranteed to be Send + Sync
fs::copy
now returns the length of the main stream on NTFS.Instant += Duration
.Hasher
for {&mut Hasher, Box<Hasher>}
fmt::Debug
for SplitWhitespace
.Option<T>
now impls Try
This allows for using ?
with Option
types.examples
folder that have a main.rs
file.[root]
to [package]
in Cargo.lock
Packages with
the old format will continue to work and can be updated with cargo update
.libbacktrace
is now available on Apple platforms.compile_fail
attribute for code fences in doc-comments.
This now lets you specify that a given code example will fail to compile.4.0
from 2.3
T op= &T
for numeric types has broken some type
inference casesfn main() {
let x: &'static u32 = &0;
}
Run::
before <
is now allowed in all contexts.
Example:
my_macro!(Vec<i32>::new); // Always worked
my_macro!(Vec::<i32>::new); // Now works
RunClone
for all arrays and tuples that
are T: Clone
Stdin
, Stdout
, and Stderr
now implement AsRawFd
.Rc
and Arc
now implement From<&[T]> where T: Clone
, From<str>
,
From<String>
, From<Box<T>> where T: ?Sized
, and From<Vec<T>>
.cargo install
with multiple package names--all
[patch]
section to Cargo.toml
to handle
prepublication dependencies RFC 1969include
& exclude
fields in Cargo.toml
now accept gitignore
like patterns--all-targets
optionrustup component add rls-preview
std::os
documentation for Unix, Linux, and Windows now appears on doc.rust-lang.org
Previously only showed std::os::unix
.CodeMap
struct which
required the unstable library libsyntax
to correctly use.unused_results
lint no longer ignores booleanswasm32-experimental-emscripten
target.msp430-none-elf
target.{HashMap,BTreeMap}::{Keys,Values}
.PartialEq
, Eq
, PartialOrd
, Ord
, Debug
, Hash
for unsized
tuples.fmt::{Display, Debug}
for Ref
, RefMut
, MutexGuard
,
RwLockReadGuard
, RwLockWriteGuard
Clone
for DefaultHasher
.Sync
for SyncSender
.FromStr
for char
{f32, f64}::{is_sign_negative, is_sign_positive}
handles
NaN.unimplemented!()
macro.
ie. unimplemented!("Waiting for 1.21 to be stable")
pub(restricted)
is now supported in the thread_local!
macro.{f32, f64}::{min, max}
in Rust instead of using CMath.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 possibleCStr::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/config
to
~/.cargo/credentials
.main.rs
binaries that are in sub-directories of
src/bin
. ie. Having src/bin/server/main.rs
and
src/bin/client/main.rs
generates target/debug/server
and target/debug/client
cargo install
using --vers
.--no-fail-fast
flag to cargo to run all benchmarks regardless of
failure.'static
in their return types will now not be as usable as
if they were using lifetime parameters instead.{f32, f64}::is_sign_{negative, positive}
now
takes the sign of NaN into account where previously didn’t.struct Point(u32, u32); let x = Point { 0: 7, 1: 0 };
.loop
can now return a value with break
. RFC 1624
For example: let x = loop { break 7; };
union
s are now available. RFC 1444 They can only
contain Copy
types and cannot have a Drop
implementation.
Example: union Foo { bar: u8, baz: usize }
fn
s, RFC 1558
Example: let foo: fn(u8) -> u8 = |v: u8| { v };
arm-linux-androideabi
to correspond to the armeabi
official ABI. If you wish to continue targeting the armeabi-v7a
ABI
you should use --target armv7-linux-androideabi
.aborting due to previous error(s)
instead of
aborting due to N previous errors
This was previously inaccurate and
would only count certain kinds of errors.target-feature=+crt-static
option RFC 1721 Which allows
libraries with C Run-time Libraries(CRT) to be statically linked.String
now implements FromIterator<Cow<'a, str>>
and
Extend<Cow<'a, str>>
Vec
now implements From<&mut [T]>
Box<[u8]>
now implements From<Box<str>>
SplitWhitespace
now implements Clone
[u8]::reverse
is now 5x faster and [u16]::reverse
is now
1.5x fastereprint!
and eprintln!
macros added to prelude. Same as the print!
macros, but for printing to stderr.println!("cargo:rustc-env=FOO=bar");
--all
flag to the cargo bench
subcommand to run benchmarks of all
the members in a given workspace.libssh2-sys
to 0.2.6--exclude
option for excluding certain packages when using the
--all
option--features
option now accepts multiple comma or space
delimited values.rust-windbg.cmd
for loading rust .natvis
files in the
Windows Debugger.#
in rust documentation By adding
additional #
’s ie. ##
is now #
MutexGuard<T>
may only be Sync
if T
is Sync
.-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.-Z
flag change, the cargo-check
plugin no
longer works. Users should migrate to the built-in check
command, which has been available since 1.16.._
is now a hard error.
Example: 42._
.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.PartialEq
& Eq
used
match patterns is now a hard error This was previously a warning.'_
are no longer allowed. This was previously
a warning.#
s are
now visibleVCINSTALLDIR
is set incorrectly, rustc
will try
to use it to find the linker, and the build will fail where it did
not previouslypub
can now accept a module path to
make the item visible to just that module tree. Also accepts the keyword
crate
to make something public to the whole crate but not users of the
library. Example: pub(crate) mod utils;
. RFC 1422.#![windows_subsystem]
attribute conservative exposure of the
/SUBSYSTEM
linker flag on Windows platforms. RFC 1665.ty
in macros can accept
types like Write + Send
, trailing +
are now supported in trait objects,
and better error reporting for trait objects starting with ?Sized
.repr
attribute or with
#[repr(Rust)]
are reordered to minimize padding and produce a smaller
representation in some cases.--emit mir
Vec::from_iter
being passed vec::IntoIter
if the
iterator hasn’t been advanced the original Vec
is reassembled with no actual
iteration or reallocation.AtomicBool::fetch_nand
Child::try_wait
HashMap::retain
HashSet::retain
PeekMut::pop
TcpStream::peek
UdpSocket::peek
UdpSocket::peek_from
cargo new --vcs pijul
--bins
and --tests
flags now you can build all programs
of a certain type, for example cargo build --bins
will build all
binaries.--enable-commonmark
flag#
at the start of filesChanges 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 no repr
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 output
out.asm
and out.ll
instead of only one of the filetypes.
calling a function that returns Self
will no longer work when
the size of Self
cannot be statically determined.
rustc now builds with a “pthreads” flavour of MinGW for Windows GNU this has caused a few regressions namely:
'static
. RFC 1623Self
may be included in the where
clause of impls
. RFC 1647T
and U
when T: Unsize<U>
. For example,
coercing &mut [&'a X; N]
to &mut [&'b X]
requires 'a
be equal to
'b
. Soundness fix.[]
, automatically coerce--emit dep-info
-C relocation-model
more correctly determine whether the linker
creates a position-independent executable-C overflow-checks
to directly control whether integer overflow
panicsSelf
to appear in impl
where
clauses.use
panic=abort
&str + &str
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
BTreeMap
and BTreeSet
can iterate over rangesCell
can store non-Copy
types. RFC 1651String
implements FromIterator<&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
implements Error
and Display
PartialOrd<A> for [A] where A: Ord
slice::sort
ToString
trait specialization for Cow<'a, str>
and String
Box<[T]>
implements From<&[T]> where T: Copy
,
Box<str>
implements From<&str>
IpAddr
implements From
for various arrays. SocketAddr
implements
From<(I, u16)> where I: Into<IpAddr>
format!
estimates the needed capacity before writing a stringPathBuf
implements Default
PartialEq<[A]>
for VecDeque<A>
HashMap
resizes adaptively to guard against DOS attacks
and poor hash functions.cargo check --all
cargo run --package
required_features
build.rs
is a build scriptworkspace_root
link in containing memberrustbook
i128
rustc
is linked statically on Windows MSVC targets, allowing it to
run without installing the MSVC runtime.rustdoc --test
includes file names in test namesstd
for sparc64-unknown-linux-gnu
,
aarch64-unknown-linux-fuchsia
, and x86_64-unknown-linux-fuchsia
.aarch64-unknown-freebsd
i686-unknown-netbsd
TypeId
implements PartialOrd
and Ord
--test-threads=0
produces an errorrustup
installs documentation by defaultT
and U
when T: Unsize<U>
, e.g. coercing
&mut [&'a X; N]
to &mut [&'b X]
requires 'a
be equal to 'b
. Soundness
fix.format!
and Display::to_string
panic if an underlying formatting
implementation returns an error. Previously the error was silently
ignored. It is incorrect for write_fmt
to return an error when writing
to a string.proc_macro_derives
hr_lifetime_in_assoc_type
future-compatibility lint has been in effect since
April of 2016.dead_code
lint now accounts for type aliases.self
in an import listSelf
may appear in impl
headersSelf
may appear in struct expressionsrustc
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.transmute::<T, U>
where T
requires a bigger alignment than
U
rustc
no longer attempts to provide “consider using an explicit
lifetime” suggestions. They were inaccurate.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
[T]::binary_search
and [T]::binary_search_by_key
now take
their argument by Borrow
parameterDebug
IpAddr
implements From<Ipv4Addr>
and From<Ipv6Addr>
Ipv6Addr
implements From<[u16; 8]>
Stdin.read()
when reading from the console on
WindowsLineWriter
&str
slicing errorsTcpListener::set_only_v6
is deprecated. This
functionality cannot be achieved in std currently.writeln!
, like println!
, now accepts a form with no string
or formatting arguments, to just print a newlineiter::Sum
and iter::Product
for Result
std_unicode::tables
char::EscapeDebug
, EscapeDefault
, EscapeUnicode
,
CaseMappingIter
, ToLowercase
, ToUppercase
, implement
Display
Duration
implements Sum
String
implements ToSocketAddrs
cargo check
command does a type check of a project without
building itdebug
, in addition
to true
and false
. These are passed to rustc
as the value to
-C debuginfo
cargo --version --verbose
build --all
doc --all
rustdoc
has a --sysroot
argument that, like rustc
, specifies
the path to the Rust implementationarmv7-linux-androideabi
target no longer enables NEON
extensions, per Google’s ABI guidedead_code
lint now accounts for type aliases.Stdin.read()
when reading from the console on
Windowsself
in an import list#[derive]
, aka “macros 1.1”, are
stable. This allows popular code-generating crates like Serde and Diesel to
work ergonomically. RFC 1681.legacy_imports
lint since 1.14, with no known regressions.macro_rules
, path
fragments can now be parsed as type parameter
bounds?Sized
can be used in where
clauses#![type_size_limit]
crate attribute, similarly to
the #![recursion_limit]
attribute--test
flag works with procedural macro cratesextern "aapcs" fn
ABI-C no-stack-check
flag is deprecated. It does nothing.format!
expander recognizes incorrect printf
and shell-style
formatting directives and suggests the correct format.mk_ty
calls in Ty::super_fold_with
mk_ty
calls in Ty::super_fold_with
UnificationTable::probe
scope_auxiliary
to cut RSS by 10%HirVec<P<T>>
to HirVec<T>
in hir::Expr
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
Iterator::nth
no longer has a Sized
boundExtend<&T>
is specialized for Vec
where T: Copy
to improve
performance.chars().count()
is much faster and so are chars().last()
and char_indices().last()
std::env::args
fmt::Debug
Default
for Duration
mpsc::RecvTimeoutError
implements Error
OUT_DIR
environment variable at build time via env!("OUT_DIR")
. They
should instead check the variable at runtime with std::env
. That the value
was set at build time was a bug, and incorrect when cross-compiling. This
change is known to cause breakage.--all
flag to cargo test
cargo install --vers
to take a semver versionbuild.rustflags
config keybuild.rs
in the same directory as Cargo.toml
is a build script--message-format JSON
when rustc emits non-JSON warnings--test
) now support a --list
argument
that lists the tests it contains--exact
argument that makes the test filter
match exactly, instead of matching only a substring of the test name--playground-url
flag#[should_panic]
errors--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.legacy_imports
lint since 1.14, with no known regressions.OUT_DIR
environment variable at build time via env!("OUT_DIR")
. They
should instead check the variable at runtime with std::env
. That the value
was set at build time was a bug, and incorrect when cross-compiling. This
change is known to cause breakage.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.legacy_directory_ownership
lint, which is a warning in this release, and will become a hard error in the
future.Peekable
peeks a None
it will return that None
without re-querying
the underlying iterator..
matches multiple tuple fields in enum variants, structs
and tuples. RFC 1492.fn
items can be coerced to unsafe fn
pointersuse *
and use ::*
both glob-import from the crate rootVec<Box<Fn()>>
without explicit
dereferencingstatic mut
names are linted like other
statics and consts[u8; m!()]
)x
”--version --verbose
Expr_::ExprInlineAsm
IchHasher
SmallVector
in CombineFields::instantiate
ArrayVec
and AccumulateVec
to reduce heap allocations
during interning of sliceswrite_metadata
CrateConfig
clonesSubsts::super_fold_with
ObligationForest
’s NodeState
handlingplug_leaks
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
the Sum
and Product
iteratorsFrom<Cow<str>> for String
and From<Cow<[T]>> for Vec<T>
fold
performance for chain
, cloned
, map
, and
VecDeque
iteratorsSipHasher
performance on small values.zip()
specialization to .map()
and .cloned()
ReadDir
implements Debug
RefUnwindSafe
for atomic typesVec::extend
to Vec::extend_from_slice
Decoder::read_str
io::Error
implements From<io::ErrorKind>
Debug
for raw pointers to unsized dataHashMap
random seedsHashMap
is more cache-friendly, for
significant improvements in some operationsHashMap
uses less memory on 32-bit architecturesAdd<{str, Cow<str>}>
for Cow<str>
CARGO_HOME
replace
sections from lock filespanic
configuration for test/bench profilesrustup 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
rustup target add
:
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
wasm32-unknown-emscripten
target. This target is known to have major
defects. Please test, report, and fix.rustup component add rust-docs
to install.#[derive(PartialEq, Eq)]
”'_
were erroneously allowed”Ordering
enum may not be matched exhaustively#[no_link]
breaks some obscure cases$crate
macro variable is accepted in fewer locations?
operator. ?
is a simple way to propagate
errors, like the try!
macro, described in RFC 0243.#[derive]
for empty tuple structs/variants-C link-arg
argumentuse self
when such an import resolvesassert_ne!
and debug_assert_ne!
vec_deque::Drain
, hash_map::Drain
, and hash_set::Drain
covariantAsRef<[T]>
for std::slice::Iter
Debug
for std::vec::IntoIter
CString
: avoid excessive growth just to 0-terminateCoerceUnsized
for {Cell, RefCell, UnsafeCell}
Debug
for std::path::{Components,Iter}
char
Debug
for DirEntry
getaddrinfo
returns EAI_SYSTEM
retrieve actual error from
errno
SipHasher
is deprecated. Use DefaultHasher
.std::io::ErrorKind
Vec::extend_from_slice
,
extend_with_element
cargo package
cargo install
CommandExt::exec
for cargo run
on Unix--sysroot
argument!
from macro URLs and titlesSipHasher
is deprecated. Use DefaultHasher
.#[derive]
for empty tuple structs/variants.
Part of RFC 1506.ethcore
crate fails with LLVM errorrustc
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.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 target-list
TypeId
is correct in some cases where it was previously
producing inconsistent resultsmips-unknown-linux-gnu
target uses hardware floating point by defaultrustc
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 argumentsrustc
supports three new MUSL targets on ARM: arm-unknown-linux-musleabi
,
arm-unknown-linux-musleabihf
, and armv7-unknown-linux-musleabihf
.
These targets produce statically-linked binaries. There are no binary release
builds yet though.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.{integer}
or
{float}
instead of _
rustc
emits a clearer error when inner attributes follow a doc commentmacro_rules!
invocations can be made within macro_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 invocationsmacro_rules!
invocationscfg_attr
works on path
attributesCell::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
format!
macro and friends now allow a single argument to be formatted
in multiple styles[T]::binary_search_by
and
[T]::binary_search_by_key
have been adjusted to be more flexibleOption
implements From
for its contained typeCell
, RefCell
and UnsafeCell
implement From
for their contained typeRwLock
panics if the reader count overflowsvec_deque::Drain
, hash_map::Drain
and hash_set::Drain
are covariantvec::Drain
and binary_heap::Drain
are covariantCow<str>
implements FromIterator
for char
, &str
and String
SOCK_CLOEXEC
hash_map::Entry
, hash_map::VacantEntry
and hash_map::OccupiedEntry
implement Debug
btree_map::Entry
, btree_map::VacantEntry
and btree_map::OccupiedEntry
implement Debug
String
implements AddAssign
extern fn
pointers implement the Clone
, PartialEq
, Eq
,
PartialOrd
, Ord
, Hash
, fmt::Pointer
, and fmt::Debug
traitsFileType
implements Debug
Mutex
and RwLock
are unwind-safempsc::sync_channel
Receiver
s return any available message before
reporting a disconnectenv
iterators implement DoubleEndedIterator
opt-level="s"
/ opt-level="z"
in profile overridescargo doc --open --target
work as expected--panic=abort
with plugins-C metadata
to the compiler--lib
flag to cargo new
http.cainfo
for custom certs--features
--jobs
flag to cargo package
--dry-run
to cargo publish
RUSTDOCFLAGS
panic::catch_unwind
is more optimizedpanic::catch_unwind
no longer accesses thread-local storage on entry--test-threads
argument to specify the number
of threads used to run tests, and which acts the same as the
RUST_TEST_THREADS
environment variablerust-lldb
warns about unsupported versions of LLDBrustup component add rust-src
.
The resulting source code can be used by tools and IDES, located in the
sysroot under lib/rustlib/src
.OsStr
s, unpaired surrogate codepoints are escaped
with the lowercase format instead of the uppercaseDebug
impl for strings no longer escapes all non-ASCII characterscfg_attr
attributes#[macro_use]
works properly when it is itself expanded from a macroBinaryHeap::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
thread_local!
macro supports multiple definitions in a single
invocation, and can apply attributesCow
implements Default
Wrapping
implements binary, octal, lower-hex and upper-hex
Display
formattingHash
lookup_host
ignores unknown address typesassert_eq!
accepts a custom error message, like assert!
doesharness = false
on [lib]
sectionslinks
contains a ‘.’-vv
prints warnings for all crates.package.metadata
keys.
This provides room for expansion by arbitrary tools.cargo doc --open
on WindowsHashMap
hasher is SipHash 1-3 instead of SipHash 2-4
This hasher is faster, but is believed to provide sufficient
protection from collision attacks.Ipv4Addr
is 10x fasterconst
s and static
s may not have unsized typesmacro_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.Copy
types are required to have a trivial implementation of Clone
.
RFC 1521.#[repr(..)]
attribute.#[derive(RustcEncodable)]
in the presence of other encode
methods.panic!
can be converted to a runtime abort with the
-C panic=abort
flag.
RFC 1513.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
UnixStream
UnixListener::bind
UnixListener::accept
UnixListener::try_clone
UnixListener::local_addr
UnixListener::set_nonblocking
UnixListener::take_error
UnixListener::incoming
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
UnixDatagram
{BTree,Hash}Map::values_mut
<[_]>::binary_search_by_key
abs_sub
method of floats is deprecated.
The semantics of this minor method are subtle and probably not what
most people want.HashMap
s can’t be initialized with getrandom
they
will fall back to /dev/urandom
temporarily to avoid blocking
during early boot.Clone
for binary_heap::IntoIter
.Display
and Hash
for std::num::Wrapping
.Default
implementation for &CStr
, CString
.From<Vec<T>>
and Into<Vec<T>>
for VecDeque<T>
.Default
for UnsafeCell
, fmt::Error
, Condvar
,
Mutex
, RwLock
.profile.*.panic
option.
This controls the runtime behavior of the panic!
macro
and can be either “unwind” (the default), or “abort”.
RFC 1513.-p
arguments.CARGO_MANIFEST_LINKS
environment
variable that corresponds to the links
field of the manifest.CARGO_HOME
on Windows.net.retry
value in .cargo/config
.--force
flag to cargo install
.flock
on NFS mounts.cargo install
artifacts in temporary directories.
Makes it possible to install multiple crates in parallel.cargo test --doc
.cargo --explain
.-q
is passed.cargo doc --lib
and --bin
.HashMap
s by caching the random keys used
to initialize the hash state.find
implementation for Chain
iterators is 2x faster.#[derive(Copy, Clone)]
to avoid bloat.fn
type.&mut self
to &mut mut self
.std
no longer prints backtraces on platforms where the running
module must be loaded with env::current_exe
, which can’t be relied
on.rust-gdb
and rust-lldb
scripts are distributed on all
Unix platforms.libc::abort
instead of
generating an illegal instruction.AtomicBool
is now bool-sized, not word-sized.target_env
for Linux ARM targets is just gnu
, not
gnueabihf
, gnueabi
, etc.Duration::new
.String::truncate
to panic less.:block
to the follow set for :ty
and :path
.
Affects how macros are parsed.#[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 each fn
names a unique
type. This will break code that transmutes fn
s, so calling
transmute
on a fn
type will generate a warning for a few cycles,
then will be converted to an error.PATTERN_WHITE_SPACE
category to be whitespace.std::panic
std::panic::catch_unwind
(renamed from recover
)std::panic::resume_unwind
(renamed from propagate
)std::panic::AssertUnwindSafe
(renamed from AssertRecoverSafe
)std::panic::UnwindSafe
(renamed from RecoverSafe
)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
std::sync::Once
is poisoned if its initialization function
fails.cell::Ref
and cell::RefMut
can contain unsized types.fmt::Debug
.BufReader
and BufWriter
was
reduced to 8K, from 64K. This is in line with the buffer size
used by other languages.Instant
, SystemTime
and Duration
implement +=
and -=
.
Duration
additionally implements *=
and /=
.Skip
is a DoubleEndedIterator
.From<[u8; 4]>
is implemented for Ipv4Addr
.Chain
implements BufRead
.HashMap
, HashSet
and iterators are covariant.CARGO_PKG_AUTHORS
environment variable.RUSTFLAGS
variable to rustc
on the commandline. rustc
arguments can also be specified
in the build.rustflags
configuration key.ToString
is specialized for str
, giving it the same performance
as to_owned
.Command::output
no longer creates extra
threads.#[derive(PartialEq)]
and #[derive(PartialOrd)]
emit less code
for C-like enums.--quiet
flag to a test runner will produce
much-abbreviated output.mips-unknown-linux-musl
, mipsel-unknown-linux-musl
, and
i586-pc-windows-msvc
targets.std::sync::Once
is poisoned if its initialization function
fails.impl
blocks.fn
item types are zero sized, and each fn
names a unique
type. This will break code that transmutes fn
s, so calling
transmute
on a fn
type will generate a warning for a few cycles,
then will be converted to an error.+=
by implementing the AddAssign
, SubAssign
,
MulAssign
, DivAssign
, RemAssign
, BitAndAssign
,
BitOrAssign
, BitXorAssign
, ShlAssign
, or ShrAssign
traits. RFC 953.struct Foo { }
, in
addition to the non-braced form, struct Foo;
. RFC 218.str::encode_utf16
(renamed from utf16_units
)str::EncodeUtf16
(renamed from Utf16Units
)Ref::map
RefMut::map
ptr::drop_in_place
time::Instant
time::SystemTime
Instant::now
Instant::duration_since
(renamed from duration_from_earlier
)Instant::elapsed
SystemTime::now
SystemTime::duration_since
(renamed from duration_from_earlier
)SystemTime::elapsed
Add
/Sub
impls for Time
and SystemTime
SystemTimeError
SystemTimeError::duration
SystemTimeError
UNIX_EPOCH
AddAssign
, SubAssign
, MulAssign
, DivAssign
,
RemAssign
, BitAndAssign
, BitOrAssign
,
BitXorAssign
, ShlAssign
, ShrAssign
.write!
and writeln!
macros correctly emit errors if any of
their arguments can’t be formatted.raw
modules, which contain a number of
redefined C types are deprecated, including os::raw::unix
,
os::raw::macos
, and os::raw::linux
. These modules defined types
such as ino_t
and dev_t
. The inconsistency of these definitions
across platforms was making it difficult to implement std
correctly. Those that need these definitions should use the libc
crate. RFC 1415.MetadataExt
traits, including
os::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.sync::mpsc
implement fmt::Debug
.--print targets
flag prints a list of supported targets.--print cfg
flag prints the cfg
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 with configure --rustbuild
.match
patterns now list up to 3 missing
variants while also indicating the total number of missing variants
if more than 3.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 init
creates a new Cargo project in the current
directory. It is otherwise like cargo new
.-v
and
--color
. verbose
and color
, respectively, go in the
[term]
section of .cargo/config
.build.jobs
key
can be set via CARGO_BUILD_JOBS
. Environment variables take
precedence over config files.cfg
syntax for
describing targets so that dependencies for multiple
targets can be specified together. RFC 1361.CARGO_TARGET_ROOT
, RUSTC
, and
RUSTDOC
take precedence over the build.target-dir
,
build.rustc
, and build.rustdoc
configuration values.build.target
configuration value sets the target platform,
like --target
.-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.match
on empty enum variants using
the Variant(..)
syntax. This has been a warning since 1.6.MetadataExt
traits, including
os::unix::fs::MetadataExt
, which expose values such as inode
numbers no longer return platform-specific types, but
instead return widened integers. RFC 1415.--cfg
compiler flags are parsed strictly as identifiers.Command::spawn
and its equivalents return an error if any of
its command-line arguments contain interior NUL
s.rustc
emits .lib
files for the staticlib
library
type instead of .a
files. Additionally, for the MSVC
toolchain, rustc
emits import libraries named foo.dll.lib
instead of foo.lib
.Path
Path::strip_prefix
(renamed from relative_from)path::StripPrefixError
(new error type returned from strip_prefix)Ipv4Addr
Ipv6Addr
Vec
String
<[T]>::
clone_from_slice
, which now requires the two slices to
be the same length<[T]>::
sort_by_key
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
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
String
s and str
s
from bytes is faster.LineWriter
(and thus io::stdout
) was
improved by using memchr
to search for newlines.f32::to_degrees
and f32::to_radians
are stable. The
f64
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
, and Range
are
covariant over their contained type.LinkedList
and its iterators, Iter
and IntoIter
are covariant
over their contained type.str::replace
now accepts a Pattern
, like other string
searching methods.Any
is implemented for unsized types.Hash
is implemented for Duration
.--test
, rustdoc will pass --cfg
arguments to the compiler.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
over LD_LIBRARY_PATH
.cargo rustc
accepts a --profile
flag that runs rustc
under
any of the compilation profiles, ‘dev’, ‘bench’, or ‘test’.rerun-if-changed
build script directive no longer causes the
build script to incorrectly run twice in certain scenarios.private_in_public
lint.".".parse::<f32>()
returns Err
, not Ok(0.0)
.#![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.Read::read_exact
,
ErrorKind::UnexpectedEof
(renamed from UnexpectedEOF
),
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 from push_all
),
Mutex::get_mut
, Mutex::into_inner
, RwLock::get_mut
,
RwLock::into_inner
,
Iterator::min_by_key
(renamed from min_by
),
Iterator::max_by_key
(renamed from max_by
).assert_eq!
macro supports arguments that don’t implement
Sized
, such as arrays. In this way it behaves more like
assert!
.Duration
. These
include Condvar::wait_timeout_ms
, thread::sleep_ms
, and
thread::park_timeout_ms
.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 to f32
, nor for 64-bit ints to f32
or f64
. They are also not implemented for isize
and usize
because the implementations would be platform-specific. From
is
also implemented from f32
to f64
.From<&Path>
and From<PathBuf>
are implemented for Cow<Path>
.From<T>
is implemented for Box<T>
, Rc<T>
and Arc<T>
.IntoIterator
is implemented for &PathBuf
and &Path
.BinaryHeap
was refactored for modest performance
improvements.$CARGO_HOME/bin
for subcommands by default.rerun-if-changed
key.cargo clean
accepts a --release
flag to clean the
release folder. A variety of artifacts that Cargo failed to clean
are now correctly deleted.unreachable_code
lint warns when a function call’s argument
diverges.RUST_PATH
environment variable when locating crates. This was a pre-cargo
feature for integrating with the package manager that was
accidentally never removed.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.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
.~/.cargo/bin
with the cargo 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 as cargo foo
.*
) dependencies will emit warnings when
published. In 1.6 it will no longer be possible to publish
crates with wildcard dependencies.AsRef
and AsMut
were added to Box
, Rc
,
and Arc
. Because these smart pointer types implement
Deref
, this causes breakage in cases where the interior type
contains methods of the same name.Self
are not object
safe. Soundness fix.no_default_libraries
setting that controls whether -nodefaultlibs
is passed to the
linker, and in turn the is_like_windows
setting no longer affects
the -nodefaultlibs
flag.#[derive(Show)]
, long-deprecated, has been removed.#[inline]
and #[repr]
attributes can only appear
in valid locations.#[no_debug]
and
#[omit_gdb_pretty_printer_section]
are feature gated.use
statements to import unstable
features.improper_ctypes
lint no longer warns about using isize
and
usize
in FFI.Arc<T>
and Rc<T>
are covariant with respect to T
instead of
invariant.Default
is implemented for mutable slices.FromStr
is implemented for SockAddrV4
and SockAddrV6
.From
conversions between floating point
types where the conversions are lossless.From
conversions between integer types where
the conversions are lossless.fs::Metadata
implements Clone
.parse
method accepts a leading “+” when parsing
integers.AsMut
is implemented for Vec
.clone_from
implementations for String
and BinaryHeap
have
been optimized and no longer rely on the default impl.extern "Rust"
, extern "C"
, unsafe extern "Rust"
and
unsafe extern "C"
function types now implement Clone
,
PartialEq
, Eq
, PartialOrd
, Ord
, Hash
, fmt::Pointer
, and
fmt::Debug
for up to 12 arguments.Vec
s is much faster in unoptimized builds when the
element types don’t implement Drop
.VecDeque
with zero-sized types was resolved.PartialOrd
for slices is faster.str::lines
and BufRead::lines
iterators treat \r\n
as
line breaks in addition to \n
.'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.use
statements that import multiple items can now rename
them, as in use foo::{bar as kitten, baz as puppy}
.pub extern crate
, which does not behave as expected, issues a
warning until a better solution is found.<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
.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
.std::io::copy
allows ?Sized
arguments.Windows
, Chunks
, and ChunksMut
iterators over slices all
override count
, nth
and last
with an O(1)
implementation.Default
is implemented for arrays up to [T; 32]
.IntoRawFd
has been added to the Unix-specific prelude,
IntoRawSocket
and IntoRawHandle
to the Windows-specific
prelude.Extend<String>
and FromIterator<String
are both implemented for
String
.IntoIterator
is implemented for references to Option
and
Result
.HashMap
and HashSet
implement Extend<&T>
where T: Copy
as part of RFC 839. This will cause type inference
breakage in rare situations.BinaryHeap
implements Debug
.Borrow
and BorrowMut
are implemented for fixed-size
arrays.extern fn
s with the “Rust” and “C” ABIs implement common
traits including Eq
, Ord
, Debug
, Hash
.&mut T
where T: std::fmt::Write
also implements
std::fmt::Write
.VecDeque::push_back
and other
capacity-altering methods that caused panics for zero-sized types
was fixed.isize
and
usize
.cargo update
.&'a Box<Trait>
(or &'a Rc<Trait>
, etc) will change from
being interpreted as &'a Box<Trait+'a>
to &'a Box<Trait+'static>
.Duration
API, has been stabilized. This basic unit of
timekeeping is employed by other std APIs, as well as out-of-tree
time crates.#[prelude_import]
attribute, an internal implementation
detail, was accidentally stabilized previously. It has been put
behind the prelude_import
feature gate. This change is
believed to break no existing code.size_of_val
and align_of_val
is
more sane for dynamically sized types. Code that relied on
the previous behavior is thought to be broken.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.size_of_val
and align_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 between Deref
and DerefMut
implementations correctly.dropck
rules, which checks that destructors can’t access
destroyed values, have been updated to match the
RFC.Duration
API, has been stabilized, as well as the
std::time
module, which presently contains only Duration
.Box<str>
and Box<[T]>
both implement Clone
.CString
, implements Borrow
and the
borrowed C string, CStr
, implements ToOwned
. The two of
these allow C strings to be borrowed and cloned in generic code.CStr
implements Debug
.AtomicPtr
implements Debug
.Error
trait objects can be downcast to their concrete types
in many common configurations, using the is
, downcast
,
downcast_ref
and downcast_mut
methods, similarly to the
Any
trait.contains
, find
,
rfind
, split
. starts_with
and
ends_with
are also faster.PartialEq
for slices is much faster.Hash
trait offers the default method, hash_slice
, which
is overridden and optimized by the implementations for scalars.Hasher
trait now has a number of specialized write_*
methods for primitive types, for efficiency.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
of std::error::Error::cause
also delegates to the inner
error.process::Child
gained the id
method, which returns a
u32
representing the platform-specific process identifier.connect
method on slices is deprecated, replaced by the new
join
method (note that both of these are on the unstable
SliceConcatExt
trait, but through the magic of the prelude are
available to stable code anyway).Div
operator is implemented for Wrapping
types.DerefMut
is implemented for String
.HashMap
) is
better for long data.AtomicPtr
implements Send
.read_to_end
implementations for Stdin
and File
are now specialized to use uninitialized buffers for increased
performance.--explain
flag.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.unused_mut
, unconditional_recursion
,
improper_ctypes
, and negate_unsigned
lints are
more strict.-Z no-landing-pads
), panic!
will kill the process instead of leaking.Rc
to contain types without a fixed size, arrays and trait
objects, finally enabling use of Rc<[T]>
and completing the
implementation of DST.-C codegen-units=N
flag to
rustc
.to_uppercase
and to_lowercase
methods on char
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’s
alignof
. mem::min_align_of
is deprecated. This is not known to
break real code.#[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
feature gate. In 1.1 associated type
defaults did not work, but could be mentioned syntactically. As
such this breakage has minimal impact.ref mut
now correctly invoke DerefMut
when
matching against dereferenceable values.Extend
trait, which grows a collection from an iterator, is
implemented over iterators of references, for String
, Vec
,
LinkedList
, VecDeque
, EnumSet
, BinaryHeap
, VecMap
,
BTreeSet
and BTreeMap
. RFC.iter::once
function returns an iterator that yields a single
element, and iter::empty
returns an iterator that yields no
elements.matches
and rmatches
methods on str
return iterators
over substring matches.Cell
and RefCell
both implement Eq
.wrapping_div
, wrapping_rem
,
wrapping_neg
, wrapping_shl
, wrapping_shr
. These are in
addition to the existing wrapping_add
, wrapping_sub
, and
wrapping_mul
methods, and alternatives to the Wrapping
type.. It is illegal for the default arithmetic operations in Rust
to overflow; the desire to wrap must be explicit.{:#?}
formatting specifier displays the alternate,
pretty-printed form of the Debug
formatter. This
feature was actually introduced prior to 1.0 with little
fanfare.fmt::Formatter
implements fmt::Write
, a fmt
-specific trait
for writing data to formatted strings, similar to io::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 of Debug
.str
has new to_uppercase
and to_lowercase
methods that convert case, following Unicode case mapping.PoisonError
type, returned by failing lock operations, exposes into_inner
,
get_ref
, and get_mut
, which all give access to the inner lock
guard, and allow the poisoned lock to continue to operate. The
is_poisoned
method of RwLock
and Mutex
can poll for a
poisoned lock without attempting to take the lock.FromRawFd
trait is implemented for Stdio
, and
AsRawFd
for ChildStdin
, ChildStdout
, ChildStderr
.
On Windows the FromRawHandle
trait is implemented for Stdio
,
and AsRawHandle
for ChildStdin
, ChildStdout
,
ChildStderr
.io::ErrorKind
has a new variant, InvalidData
, which indicates
malformed input.rustc
employs smarter heuristics for guessing at typos.rustc
emits more efficient code for no-op conversions between
unsafe pointers.std::fs
module has been expanded to expand the set of
functionality exposed:
DirEntry
now supports optimizations like file_type
and metadata
which
don’t incur a syscall on some platforms.symlink_metadata
function has been added.fs::Metadata
structure now lowers to its OS counterpart, providing
access to all underlying information.--explain
flag
to read the explanation. Error explanations are also available online.str::split_whitespace
method splits a string on unicode
whitespace boundaries.FromRawFd
and AsRawFd
, on Windows FromRawHandle
and AsRawHandle
. These are implemented for File
, TcpStream
,
TcpListener
, and UpdSocket
. Further implementations for
std::process
will be stabilized later.std::os::unix::symlink
creates symlinks. On
Windows, symlinks can be created with
std::os::windows::symlink_dir
and
std::os::windows::symlink_file
.mpsc::Receiver
type can now be converted into an iterator with
into_iter
on the IntoIterator
trait.Ipv4Addr
can be created from u32
with the From<u32>
implementation of the From
trait.Debug
implementation for RangeFull
creates output that is
more consistent with other implementations.Debug
is implemented for File
.Default
implementation for Arc
no longer requires Sync + Send
.Iterator
methods count
, nth
, and last
have been
overridden for slices to have O(1) performance instead of O(n).AtomicPtr
gained a Default
implementation.abs
now
panics on overflow when debug assertions are enabled.Cloned
iterator, which was accidentally left unstable for
1.0 has been stabilized.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 by
sift_up
or sift_down
panic.split_off
method of LinkedList
no longer corrupts
the list in certain scenarios.target_env
cfg value, which is used for
distinguishing toolchains that are otherwise for the same
platform. Presently this is set to gnu
for common GNU Linux
targets and for MinGW targets, and musl
for MUSL Linux targets.cargo rustc
command invokes a build with custom flags
to rustc.drop_with_repr_extern
lint warns about mixing repr(C)
with Drop
.#[stable]
. It is
no longer possible to use unstable features with a stable build of
the compiler.0b1234
is
now lexed as 0b1234
instead of two tokens, 0b1
and 234
.PhantomFn
and MarkerTrait
lang items, which have been
removed.extern crate "foo" as bar
syntax has been replaced with extern crate foo as bar
, and Cargo now automatically translates “-” in package names
to underscore for the crate name.Send
no longer implies 'static
.MyType::default()
.SliceExt
.Self: Sized
in their where
clause are considered
object-safe, allowing many extension traits like
IteratorExt
to be merged into the traits they extended.where
clause.Send
and Sync
are now library-defined.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.unsafe_destructor
feature is now deprecated in favor of the
new dropck
. This change is a major reduction in unsafe
code.thread_local
module has been renamed to std::thread
.IteratorExt
have been moved to the Iterator
trait itself.AsMut
, AsRef
, From
, and Into
have been
centralized in the std::convert
module.FromError
trait was removed in favor of From
.std::thread::sleep_ms
.splitn
function now takes an n
parameter that represents the
number of items yielded by the returned iterator instead of the
number of ‘splits’.CLOEXEC
by default.PartialOrd
now order enums according
to their explicitly-assigned discriminants.Pattern
s,
implemented presently by &char
, &str
, FnMut(char) -> bool
and
some others.String::from_str
has been deprecated in favor of the From
impl,
String::from
.io::Error
implements Sync
.words
method on &str
has been replaced with
split_whitespace
, to avoid answering the tricky question, ‘what is
a word?’#[stable]
. This
was the major library focus for this cycle..
,
adjusting the tradeoffs in favor of the most common usage.std
were also stabilized
during this cycle; about 75% of the non-deprecated API surface
is now stable.Fn
traits are now related via inheritance
and provide ergonomic blanket implementations.Index
and IndexMut
traits were changed to
take the index by value, enabling code like
hash_map["string"]
to work.Copy
now inherits from Clone
, meaning that all
Copy
data is known to be Clone
as well.--explain
flag to rustc
.~1300 changes, numerous bugfixes
Highlights
io
module remains temporarily
at std::old_io
.#![feature(...)]
attribute. The impact of this change is described on the
forum. RFC.Language
for
loops now operate on the IntoIterator
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 that for foo in bar { }
yields values from a move
iterator, destroying the original collection. RFC.Box<Trait+'static>
when you don’t care about
storing references. RFC.Drop
, lifetimes must outlive the
value. This will soon make it possible to safely
implement Drop
for types where #[unsafe_destructor]
is now
required. Read the gorgeous RFC for details.Deref<U>
now automatically
coerce to references to the dereferenced type U
,
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.|&:|
, |&mut:|
,
|:|
) is obsolete and closure kind is inferred from context.Self
is a keyword.Libraries
Show
and String
formatting traits have been
renamed to Debug
and Display
to more clearly reflect
their related purposes. Automatically getting a string
conversion to use with format!("{:?}", something_to_debug)
is
now written #[derive(Debug)]
.std::ff::{OsString, OsStr}
, provide strings in platform-specific encodings for easier
interop with system APIs. RFC.boxed::into_raw
and Box::from_raw
functions convert
between Box<T>
and *mut T
, a common pattern for
creating raw pointers.Tooling
/usr/local/lib/rustlib/uninstall.sh
.#[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
~2400 changes, numerous bugfixes
Highlights
isize
and
usize
, rather than int
and uint
, for pointer-sized
integers. Guidelines will be rolled out during the alpha cycle.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’.Language
where
clauses provide a more versatile and attractive
syntax for specifying generic bounds, though the previous syntax
remains valid.str
) more deeply into the type system, making it
more consistent.i..j
, i..
, and
..j
that produce range types and which, when combined with the
Index
operator and multidispatch, leads to a convenient slice
notation, [i..j]
.[T; N]
.Copy
trait is no longer implemented automatically. Unsafe
pointers no longer implement Sync
and Send
so types
containing them don’t automatically either. Sync
and Send
are now ‘unsafe traits’ so one can “forcibly” implement them via
unsafe impl
if a type confirms to the requirements for them
even though the internals do not (e.g. structs containing unsafe
pointers like Arc
). These changes are intended to prevent some
footguns and are collectively known as opt-in built-in
traits (though Sync
and Send
will soon become pure
library types unknown to the compiler).String
to be
compared with &str
.if let
and while let
are no longer feature-gated.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.vec![1i32, 2, 3].len()
work as expected.#[derive(...)]
not #[deriving(...)]
for consistency with other naming
conventions.self
instead
of mod
, as in use foo::{self, bar}
box
operator and box
patterns have been feature-gated
pending a redesign. For now unique boxes should be allocated
like other containers, with Box::new
.Libraries
fail!
macro has been renamed to panic!
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.OsRng
prefers the new, more reliable getrandom
syscall when available.Show
formatter, typically implemented with
#[derive(Show)]
is now requested with the {:?}
specifier and is intended for use by all types, for uses
such as println!
debugging. The new String
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
Misc
Option<Vec<T>>
and Option<String>
take up no more
space than the inner types themselves.~1900 changes, numerous bugfixes
Highlights
std
have been reviewed and updated for
consistency with the in-development Rust coding
guidelines. The standard library documentation tracks
stabilization progress.Language
Index
and IndexMut
traits.if let
construct takes a branch only if the let
pattern
matches, currently behind the ‘if_let’ feature gate.[0..4]
) has been introduced behind
the ‘slicing_syntax’ feature gate, and can be overloaded with
the Slice
or SliceMut
traits...
instead of prefix (.e.g. [a, b, c..]
), for
consistency with other uses of ..
and to future-proof
potential additional uses of the syntax.0..3
to 0...4
to be consistent with the exclusive range
syntax for slicing.[a.., b, c]
) has been put behind the ‘advanced_slice_patterns’ feature
gate and may be removed in the future.value.0
syntax, currently behind the tuple_indexing
feature gate.#[crate_id]
attribute is no longer supported; versioning
is handled by the package manager.extern crate foo as bar
instead of extern crate bar = foo
.use foo as bar
instead
of use bar = foo
.let
and match
bindings and argument names in macros are now
hygienic.move
has been added as a keyword, for indicating closures
that capture by value.Share
trait is now called Sync
to free up the term
‘shared’ to refer to ‘shared reference’ (the default reference
type.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 are Sized
, notable exceptions being unsized arrays
([T]
) and trait types.!
, as in || -> !
or proc() -> !
.Gc<T>
which was once
denoted by the @
sigil, has finally been removed. GC will be
revisited in the future.Libraries
std::time::Duration
type has been added for use in I/O
methods that rely on timers, as well as in the ‘time’ crate’s
Timespec
arithmetic.collections::btree
has been rewritten to have a more
idiomatic and efficient design.Tooling
--crate-name
flag can specify the name of the crate
being compiled, like #[crate_name]
.-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.-C codegen-units
flag.Misc
~1700 changes, numerous bugfixes
Language
uint
instead of any integral type.b
.<'a>|A, B|: 'b + K -> T
priv
keyword has been removed from the language.use foo, bar, baz;
syntax has been removed from the language.int
, and floating point
literals no longer default to f64
. Literals must be suffixed with an
appropriate type if inference cannot determine the type of the
literal.Libraries
rev()
on
their forward-iteration counterparts.--cfg ndebug
is passed to the compiler.Tooling
[breaking-change]
to allow for easy
discovery of breaking changes.mod foo;
.pub use
has been greatly improved.~1500 changes, numerous bugfixes
Language
@
-pointers have been removed from the language.~[T]
) have been removed from the
language.~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.~
allocations which contain @
boxes inside the type for
reference counting have been removed.macro_rules!
macros as
well as syntax extensions such as format!
.#[deriving]
with raw pointerslog_syntax!
are now behind feature gates.#[simd]
attribute is now behind a feature gate.extern crate
statements, and
unnecessary visibility (priv
) is no longer allowed on use
statements.do
keyword has been removed, it is now a reserved keyword.extern mod
is now extern crate
Freeze
trait has been removed.Share
trait has been added for types that can be shared among
threads.{}
now.static mut
locations has been tweaked.*
and .
operators are now overloadable through the Deref
and
DerefMut
traits.~Trait
and proc
no longer have Send
bounds by default._
type marker.Unsafe
type was introduced for interior mutability. It is now
considered undefined to transmute from &T
to &mut T
without using the
Unsafe
type.#[foo];
to #![foo]
.Pod
was renamed to Copy
.Libraries
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::condition
has been removed. All I/O errors are now propagated
through the Result
type. In order to assist with error handling, a
try!
macro for unwrapping errors with an early return and a lint for
unused results has been added. See #12039 for more information.vec
module has been renamed to slice
.Vec<T>
, has been added in preparation for DST.
This will become the only growable vector in the future.std::io
now has more public re-exports. Types such as BufferedReader
are now found at std::io::BufferedReader
instead of
std::io::buffered::BufferedReader
.print
and println
are no longer in the prelude, the print!
and
println!
macros are intended to be used instead.Rc
now has a Weak
pointer for breaking cycles, and it no longer
attempts to statically prevent cycles.slice::last()
) now return Option<T>
instead of T
+ failing.fmt::Default
has been renamed to fmt::Show
, and it now has a new
deriving mode: #[deriving(Show)]
.ToStr
is now implemented for all types implementing Show
.&self
instead of &T
invert()
method on iterators has been renamed to rev()
std::num
has seen a reduction in the genericity of its traits,
consolidating functionality into a few core traits.RUST_BACKTRACE
is present.eof()
has been removed from the Reader
trait. Specific types may
still implement the function.assert_approx_eq!
has been removede
and E
formatting specifiers for floats have been added to
print them in exponential notation.Times
trait has been removedstd::kinds::marker
nowhash
has been rewritten, IterBytes
has been removed, and
#[deriving(Hash)]
is now possible.SharedChan
has been removed, Sender
is now cloneable.Chan
and Port
were renamed to Sender
and Receiver
.Chan::new
is now channel()
.select!
macro is now provided for selecting over Receiver
s.hashmap
and trie
have been moved to libcollections
run
has been rolled into io::process
assert_eq!
now uses {}
instead of {:?}
rand
has moved to librand
.to_{lower,upper}case
has been implemented for char
.liblog
.HashMap
has been rewritten for higher performance and less
memory usage.libnative
. If libgreen
is desired,
it can be booted manually. The runtime guide has more information and
examples.libgreen
has been optimized with stack caching
and various trimming of code.libgreen
now have an unmapped guard page.extra::sync
module has been updated to modern rust (and moved
to the sync
library), tweaking and improving various interfaces while
dropping redundant functionality.Barrier
type has been added to the sync
library.base64
module has seen some improvement. It treats
newlines better, has non-string error values, and has seen general
cleanup.fourcc!
macro was introducedhexfloat!
macro was implemented for specifying floats via a
hexadecimal literal.Tooling
rustpkg
has been deprecated and removed from the main repository. Its
replacement, cargo
, is under development.--emit
flag.--crate-type
flag.-C
flag.rustdoc
improvements:
~1800 changes, numerous bugfixes
Language
float
type has been removed. Use f32
or f64
instead.#[feature(foo)]
attribute.#[feature(managed_boxes)]
) in preparation for future removal. Use the
standard library’s Gc
or Rc
types instead.@mut
has been removed. Use std::cell::{Cell, RefCell}
instead.continue
instead of
loop
.r"foo"
syntax or with matched
hash delimiters, as in r###"foo"###
.~fn
is now written proc (args) -> retval { ... }
and may only be
called once.&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
of do
is.#[link(...)]
attribute has been replaced with
#[crate_id = "name#vers"]
.impl
s must be terminated with empty braces and may not be
terminated with a semicolon.self
lifetime
no longer has any special meaning.fmt!
string formatting macro has been removed.printf!
and printfln!
(old-style formatting) removed in favor of
print!
and println!
.mut
works in patterns now, as in let (mut x, y) = (1, 2);
.extern mod foo (name = "bar")
syntax has been removed. Use
extern mod foo = "bar"
instead.alignof
, offsetof
, sizeof
.asm!
macro is feature-gated (#[feature(asm)]
).as
.repr
attribute can be used to override
the discriminant size, as in #[repr(int)]
for integer-sized, and
#[repr(C)]
to match C enums.0o7777
.concat!
syntax extension performs compile-time string concatenation.#[fixed_stack_segment]
and #[rust_stack]
attributes have been
removed as Rust no longer uses segmented stacks.#[feature(non_ascii_idents)]
)...
,
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 via extern "win64"
.rustc
supports the “system” calling convention, which defaults to the
preferred convention for the target platform, “stdcall” on 32-bit Windows,
“C” elsewhere.type_overflow
lint (default: warn) checks literals for overflow.unsafe_block
lint (default: allow) checks for usage of unsafe
.attribute_usage
lint (default: warn) warns about unknown
attributes.unknown_features
lint (default: warn) warns about unknown
feature gates.dead_code
lint (default: warn) checks for dead code.#[link_args]
is behind the link_args
feature gate.#[link(name = "foo")]
#[link(name = "foo", kind = "static")]
).#[link(name = "foo", kind = "framework")]
).#[thread_local]
attribute creates thread-local (not task-local)
variables. Currently behind the thread_local
feature gate.return
keyword may be used in closures.Pod
kind.cfg
attribute can now be used on struct fields and enum variants.Libraries
option
and result
API’s have been overhauled to make them
simpler, more consistent, and more composable.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.io::util
contains a number of useful implementations of
Reader
and Writer
, including NullReader
, NullWriter
,
ZeroReader
, TeeReader
.extra::rc
moved into std.Gc
type in the gc
module will replace @
(it is currently
just a wrapper around it).Either
type has been removed.fmt::Default
can be implemented for any type to provide default
formatting to the format!
macro, as in format!("{}", myfoo)
.rand
API continues to be tweaked.rust_begin_unwind
function, useful for inserting breakpoints
on failure in gdb, is now named rust_fail
.each_key
and each_value
methods on HashMap
have been
replaced by the keys
and values
iterators.sys
module to the mem
module.path
module was written and API changed.str::from_utf8
has been changed to cast instead of allocate.starts_with
and ends_with
methods added to vectors via the
ImmutableEqVector
trait, which is in the prelude.get_opt
method, which returns None
if the index is out of bounds.Any
type can be used for dynamic typing.~Any
can be passed to the fail!
macro and retrieved via
task::try
._iter
suffix now.cell::Cell
and cell::RefCell
can be used to introduce mutability
roots (mutable fields, etc.). Use instead of e.g. @mut
.util::ignore
renamed to prelude::drop
.sort
and sort_by
methods via the MutableVector
trait.vec::raw
has seen a lot of cleanup and API changes.comm
module has been rewritten to be much faster, have a
simpler, more consistent API, and to work for both native and green
threading.flatpipes
module had bitrotted and was removed.c_vec
has been modernized.sort
module has been removed. Use the sort
method on
mutable slices.Tooling
rust
and rusti
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.rustc
adds a --dep-info
flag for communicating dependencies to
build tools.~2200 changes, numerous bugfixes
Language
for
loop syntax has changed to work with the Iterator
trait.copy
is no longer a keyword. It has been replaced by the Clone
trait.debug!
macro if it is passed
--cfg ndebug
mod foo;
, rustc will now look
for foo.rs, then foo/mod.rs, and will generate an error when both are
present.std::c_str
module
provides new mechanisms for converting to C strings.extern "C" fn
instead of `*u8’.#[fixed_stack_segment]
attribute.externfn!
macro can be used to declare both a foreign function and
a #[fixed_stack_segment]
wrapper at once.pub
and priv
modifiers on extern
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.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.extern mod foo = "url";
.enum E { V = 0u }
static foo: [u8, .. 100]: [0, .. 100];
.static foo: Foo = Foo { a: 5, .. bar };
.cfg!
can be used to conditionally execute code based on the crate
configuration, similarly to #[cfg(...)]
.unnecessary_qualification
lint detects unneeded module
prefixes (default: allow).std::unstable::simd
.format!
implements a completely new, extensible, and higher-performance
string formatting system. It will replace fmt!
.print!
and println!
write formatted strings (using the format!
extension) to stdout.write!
and writeln!
write formatted strings (using the format!
extension) to the new Writers in std::rt::io
.#[link_section = "..."]
.proto!
syntax extension for defining bounded message protocols
was removed.macro_rules!
is hygienic for let
declarations.#[export_name]
attribute specifies the name of a symbol.unreachable!
can be used to indicate unreachable code, and fails
if executed.Libraries
rt::io
, based on the new
runtime.range
function was added to the prelude, replacing
uint::range
and friends.range_rev
no longer exists. Since range is an iterator it can be
reversed with range(lo, hi).invert()
.chain
method on option renamed to and_then
; unwrap_or_default
renamed to unwrap_or
.iterator
module was renamed to iter
.checked_add
, checked_sub
, and
checked_mul
operations for detecting overflow.str
, vec
, option,
result` were renamed for
consistency.to_foo
for copying, into_foo
for moving, as_foo
for temporary
and cheap casts.CString
type in c_str
provides new ways to convert to and
from C strings.DoubleEndedIterator
can yield elements in two directions.mut_split
method on vectors partitions an &mut [T]
into
two splices.str::from_bytes
renamed to str::from_utf8
.pop_opt
and shift_opt
methods added to vectors.swap_unwrap
method of Option
renamed to take_unwrap
.SharedPort
to comm
.Eq
has a default method for ne
; only eq
is required
in implementations.Ord
has default methods for le
, gt
and ge
; only lt
is required in implementations.is_utf8
performance is improved, impacting many string functions.os::MemoryMap
provides cross-platform mmap.ptr::offset
is now unsafe, but also more optimized. Offsets that
are not ‘in-bounds’ are considered undefined.vec
removed in favor of methods.FromIterator
so can be created by the
collect
method.unstable::atomics
.comm::PortSet
removed.Set
and Map
traits have been moved into
the MutableSet
and MutableMap
traits. Container::is_empty
,
Map::contains_key
, MutableMap::insert
, and MutableMap::remove
have
default implementations.from_str
functions were removed in favor of a generic
from_str
which is available in the prelude.util::unreachable
removed in favor of the unreachable!
macro.dlist
, the doubly-linked list was modernized.hex
module with ToHex
and FromHex
traits.glob
module, replacing std::os::glob
.rope
was removed.deque
was renamed to ringbuf
. RingBuf
implements Deque
.net
, and timer
were removed. The experimental replacements
are std::rt::io::net
and std::rt::io::timer
.SmallIntMap
.Bitv
and BitvSet
.SmallIntSet
removed. Use BitvSet
.semver
updated to SemVer 2.0.0.term
handles more terminals correctly.dbg
module removed.par
module removed.future
was cleaned up, with some method renames.getopts
were converted to methods.Other
-Z debug-info
) is greatly improved.--target-cpu
to compile to a specific CPU architecture,
similarly to gcc’s --march
flag.--test
now support the -h
and --help
flags.rustdoc
command.~2000 changes, numerous bugfixes
Language
impl
s no longer accept a visibility qualifier. Put them on methods
instead.self
parameter no longer implicitly means &'self self
,
and can be explicitly marked with a lifetime.+=
, etc.) have been temporarily
removed due to bugs.for
loop protocol now requires for
-iterators to return bool
so they compose better.Durable
trait is replaced with the 'static
bounds.#[packed]
attribute have byte alignment and
no padding between fields.Copy
must now be copied explicitly with
the copy
keyword.Option<~T>
is now represented as a nullable pointer.@mut
does dynamic borrow checks correctly.main
function is only detected at the topmost level of the crate.
The #[main]
attribute is still valid anywhere.#[no_send]
attribute makes a type that would otherwise be
Send
, not.#[no_freeze]
attribute makes a type that would otherwise be
Freeze
, not.RUST_MAX_STACK
environment variable (default: 1GB).vecs_implicitly_copyable
lint mode has been removed. Vectors
are never implicitly copyable.#[static_assert]
makes compile-time assertions about static bools.use mod
statement no longer exists.Syntax extensions
fail!
and assert!
accept ~str
, &'static str
or fmt!
-style
argument list.Encodable
, Decodable
, Ord
, TotalOrd
, TotalEq
, DeepClone
,
Rand
, Zero
and ToStr
can all be automatically derived with
#[deriving(...)]
.bytes!
macro returns a vector of bytes for string, u8, char,
and unsuffixed integer literals.Libraries
core
crate was renamed to std
.std
crate was renamed to extra
.iterator
module for external iterator objects.Iterator
.any
, all
. removed.finalize
method of Drop
renamed to drop
.drop
method now takes &mut self
instead of &self
.print
, println
, FromStr
, ApproxEq
, Equiv
,
Iterator
, IteratorUtil
, many numeric traits, many tuple traits.Fractional
, Real
, RealExt
, Integer
, Ratio
,
Algebraic
, Trigonometric
, Exponential
, Primitive
.(0, 1, 2).n2()
or (0, 1, 2).n2_ref()
.Clone
.path
type renamed to Path
.mut
module and Mut
type removed.vec
, str
. In the future methods will also work as functions.reinterpret_cast
removed. Use transmute
.std::ascii
.Rand
is implemented for ~/@.run
module for spawning processes overhauled.unstable::atomic
.Zero
.LinearMap
and LinearSet
renamed to HashMap
and HashSet
.ptr
to borrow
.os::mkdir_recursive
.os::glob
function performs filesystems globs.FuzzyEq
renamed to ApproxEq
.Map
now defines pop
and swap
methods.Cell
constructors converted to static methods.rc
module adds the reference counted pointers, Rc
and RcMut
.flate
module moved from std
to extra
.fileinput
module for iterating over a series of files.Complex
number type and complex
module.Rational
number type and rational
module.BigInt
, BigUint
implement numeric and comparison traits.term
uses terminfo now, is more correct.arc
functions converted to methods.Tooling
unused_variables
lint mode for unused variables (default: warn).unused_unsafe
lint mode for detecting unnecessary unsafe
blocks
(default: warn).unused_mut
lint mode for identifying unused mut
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).rusti
command has been rewritten and a number of bugs addressed.--link-args
flag to pass arguments to the linker.-Z print-link-args
flag for debugging linkage.-g
will make the binary record information about
dynamic borrowcheck failures for debugging.~2100 changes, numerous bugfixes
Syntax changes
Self
self
parameter in trait and impl methods must now be explicitly
named (for example: fn f(&self) { }
). Implicit self is deprecated.static
keyword and instead
are distinguished by the lack of a self
parameterDurable
trait with the 'static
lifetimesuper
is a keyword, and may be prefixed to paths+
instead of whitespaceimpl Trait for Type
instead of impl Type: Trait
&'l foo
instead of &l/foo
export
keyword has finally been removedmove
keyword has been removed (see “Semantic changes”)[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. Use fail!()
assert
is no longer a keyword. Use assert!()
log
is no longer a keyword. use debug!
, etc.(T,)
mut
. Use inherited mutability,
@mut T
, core::mut
or core::cell
extern mod { ... }
is no longer valid syntax for foreign
function modules. Use extern blocks: extern { ... }
const
renamed to static
to correspond to lifetime name,
and make room for future static mut
unsafe mutable globals.#[deriving_eq]
with #[deriving(Eq)]
, etc.Clone
implementations can be automatically generated with
#[deriving(Clone)]
@foo as @Bar
instead of foo as Bar
.[int, .. 3]
instead of [int * 3]
.[int, .. GL_BUFFER_SIZE - 2]
)Semantic changes
move
keyworduse
statements may no longer be “chained” - they cannot import
identifiers imported by previous use
statementsuse
statements are crate relative, importing from the “top”
of the crate by default. Paths may be prefixed with super::
or self::
to change the search behavior.Libraries
std::bigint
core::oldcomm
modulecore::comm
modulecore::num
vec::slice
finally returns a slicedebug!
and friends don’t require a format string, e.g. debug!(Foo)
core::container
core::dvec
removed, ~[T]
is a drop-in replacementcore::send_map
renamed to core::hashmap
std::map
removed; replaced with core::hashmap
std::treemap
reimplemented as an owned balanced treestd::deque
and std::smallintmap
reimplemented as owned containerscore::trie
added as a fast ordered map for integer keyscore::hashmap
, core::trie
and std::treemap
Ord
split into Ord
and TotalOrd
. Ord
is still used to
overload the comparison operators, whereas TotalOrd
is used
by certain container typesOther
rustc --test
now supports benchmarks with the #[bench]
attribute~900 changes, numerous bugfixes
Syntax changes
<-
move operator#fmt
extension syntax to fmt!
[T]/N
quote_tokens!
, quote_expr!
, etc.a.b()
is always parsed as a method call, never as a field projectionEq
and IterBytes
implementations can be automatically generated
with #[deriving_eq]
and #[deriving_iter_bytes]
respectively.rc
filesSemantic changes
&
and ~
pointers may point to objectsstruct Foo(Bar, Baz)
. Will replace newtype enums.move
explicitly&T
may now be coerced to *T
let
statements as well as function callsuse
statements now take crate-relative pathsImproved support for language features
self
, &self
@self
, and ~self
all generally work as expectedLibraries
core::condition
std::sort
std::priority_queue
getopts
definitionsstd
core::comm
renamed to oldcomm
. Still deprecatedrustdoc
and cargo
are libraries nowMisc
rusti
~2000 changes, numerous bugfixes
Syntax
ret
became return
and alt
became match
import
is now use
; use is now
extern mod`extern mod { ... }
is now extern { ... }
use mod
is the recommended way to import modulespub
and priv
replace deprecated export listsmatch
pattern arms now uses fat arrow (=>)main
no longer accepts an args vector; use os::args
insteadSemantics
Libraries
std::net::url
for representing URLscore::send_map
Concurrency
core::pipes
std::arc
, an atomically reference counted, immutable, shared memory
typestd::sync
, various exotic synchronization tools based on arcs and pipesOther
~1900 changes, numerous bugfixes
New coding conveniences
Semantic cleanup
Experimental new language features
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
New library code
Tool improvements
1500 changes, numerous bugfixes
New docs and doc tooling
New port: FreeBSD x86_64
Compilation model enhancements
Scheduling, stack and threading fixes
Experimental new language features
Various language extensions
New library code
Most language features work, including:
Compiler works with the following configurations:
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.