1.48.0
版本发布时间: 2020-11-19 22:39:08
rust-lang/rust最新发布版本:1.82.0(2024-10-18 00:44:34)
Language
-
The
unsafe
keyword is now syntactically permitted on modules. This is still rejected semantically, but can now be parsed by procedural macros.
Compiler
-
Stabilised the
-C link-self-contained=<yes|no>
compiler flag. This tellsrustc
whether to link its own C runtime and libraries or to rely on a external linker to find them. (Supported only onwindows-gnu
,linux-musl
, andwasi
platforms.) -
You can now use
-C target-feature=+crt-static
onlinux-gnu
targets. Note: If you're using cargo you must explicitly pass the--target
flag. -
Added tier 2* support for
aarch64-unknown-linux-musl
.
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
-
io::Write
is now implemented for&ChildStdin
&Sink
,&Stdout
, and&Stderr
. -
All arrays of any length now implement
TryFrom<Vec<T>>
. -
The
matches!
macro now supports having a trailing comma. -
Vec<A>
now implementsPartialEq<[B]>
whereA: PartialEq<B>
. -
The
RefCell::{replace, replace_with, clone}
methods now all use#[track_caller]
.
Stabilized APIs
The following previously stable methods are now const fn
's:
-
Option::is_some
-
Option::is_none
-
Option::as_ref
-
Result::is_ok
-
Result::is_err
-
Result::as_ref
-
Ordering::reverse
-
Ordering::then
Cargo
Rustdoc
-
You can now link to items in
rustdoc
using the intra-doc link syntax. E.g./// Uses [`std::future`]
will automatically generate a link tostd::future
's documentation. See "Linking to items by name" for more information. -
You can now specify
#[doc(alias = "<alias>")]
on items to add search aliases when searching throughrustdoc
's UI.
Compatibility Notes
-
Promotion of references to
'static
lifetime insideconst fn
now follows the same rules as inside afn
body. In particular,&foo()
will not be promoted to'static
lifetime any more insideconst fn
s. - Associated type bindings on trait objects are now verified to meet the bounds declared on the trait when checking that they implement the trait.
- When trait bounds on associated types or opaque types are ambiguous, the compiler no longer makes an arbitrary choice on which bound to use.
- Fixed recursive nonterminals not being expanded in macros during pretty-print/reparse check. This may cause errors if your macro wasn't correctly handling recursive nonterminal tokens.
-
&mut
references to non zero-sized types are no longer promoted. -
rustc
will now warn if you use attributes like#[link_name]
or#[cold]
in places where they have no effect. -
Updated
_mm256_extract_epi8
and_mm256_extract_epi16
signatures inarch::{x86, x86_64}
to returni32
to match the vendor signatures. -
mem::uninitialized
will now panic if any inner types inside a struct or enum disallow zero-initialization. -
#[target_feature]
will now error if used in a place where it has no effect. -
Foreign exceptions are now caught by
catch_unwind
and will cause an abort. Note: This behaviour is not guaranteed and is still considered undefined behaviour, see thecatch_unwind
documentation for further information.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
-
Building
rustc
from source now usesninja
by default overmake
. You can continue building withmake
by settingninja=false
in yourconfig.toml
. -
cg_llvm:
fewer_names
inuncached_llvm_type
-
Made
ensure_sufficient_stack()
non-generic