1.46.0
版本发布时间: 2020-09-10 13:52:58
rust-lang/rust最新发布版本:1.82.0(2024-10-18 00:44:34)
Language
-
if
,match
, andloop
expressions can now be used in const functions. -
Additionally you are now also able to coerce and cast to slices (
&[T]
) in const functions. -
The
#[track_caller]
attribute can now be added to functions to use the function's caller's location information for panic messages. -
Recursively indexing into tuples no longer needs parentheses. E.g.
x.0.0
over(x.0).0
. -
mem::transmute
can now be used in statics and constants. Note You currently can't usemem::transmute
in constant functions.
Compiler
-
You can now use the
cdylib
target on Apple iOS and tvOS platforms. -
Enabled static "Position Independent Executables" by default for
x86_64-unknown-linux-musl
.
Libraries
-
mem::forget
is now aconst fn
. -
String
now implementsFrom<char>
. -
The
leading_ones
, andtrailing_ones
methods have been stabilised for all integer types. -
vec::IntoIter<T>
now implementsAsRef<[T]>
. -
All non-zero integer types (
NonZeroU8
) now implementTryFrom
for their zero-able equivalent (e.g.TryFrom<u8>
). -
&[T]
and&mut [T]
now implementPartialEq<Vec<T>>
. -
(String, u16)
now implementsToSocketAddrs
. -
vec::Drain<'_, T>
now implementsAsRef<[T]>
.
Stabilized APIs
Cargo
Added a number of new environment variables that are now available when compiling your crate.
-
CARGO_BIN_NAME
andCARGO_CRATE_NAME
Providing the name of the specific binary being compiled and the name of the crate. -
CARGO_PKG_LICENSE
The license from the manifest of the package. -
CARGO_PKG_LICENSE_FILE
The path to the license file.
Compatibility Notes
-
The target configuration option
abi_blacklist
has been renamed tounsupported_abis
. The old name will still continue to work. -
Rustc will now warn if you cast a C-like enum that implements
Drop
. This was previously accepted but will become a hard error in a future release. -
Rustc will fail to compile if you have a struct with
#[repr(i128)]
or#[repr(u128)]
. This representation is currently only allowed onenum
s. -
Tokens passed to
macro_rules!
are now always captured. This helps ensure that spans have the correct information, and may cause breakage if you were relying on receiving spans with dummy information. - The InnoSetup installer for Windows is no longer available. This was a legacy installer that was replaced by a MSI installer a few years ago but was still being built.
-
{f32, f64}::asinh
now returns the correct values for negative numbers. - Rustc will no longer accept overlapping trait implementations that only differ in how the lifetime was bound.
-
Rustc now correctly relates the lifetime of an existential associated type. This fixes some edge cases where
rustc
would erroneously allow you to pass a shorter lifetime than expected. -
Rustc now dynamically links to
libz
(also calledzlib
) on Linux. The library will need to be installed forrustc
to work, even though we expect it to be already available on most systems. -
Tests annotated with
#[should_panic]
are broken on ARMv7 while running under QEMU. - Pretty printing of some tokens in procedural macros changed. The exact output returned by rustc's pretty printing is an unstable implementation detail: we recommend any macro relying on it to switch to a more robust parsing system.