The Rust team is pleased to announce the new version of Rust 1.46.0. Rust is a programming language that allows anyone to create reliable and efficient software.
If you have a previous version of Rust installed via rustup, getting Rust 1.46.0 is as easy as:
rustup update stable
If you don't already have it rustup
, you can install it from the appropriate page on our website and check out the detailed 1.46.0 release notes on GitHub.
What's included in stable version 1.46.0
This release is fairly small, with improvements const fn
, stabilization of two new APIs in the standard library and one option for library authors. See the detailed release notes for other changes not covered in this announcement.
#[track_caller]
Back in March, when Rust 1.42 was released, , unwrap
features like this were causing panic . We mentioned then that the implementation is not stable yet. In Rust 1.46, we stabilized it.
#[track_caller]
RFC 2091 2017! , unwrap
, , , . , unwrap
:
pub fn unwrap(self) -> T {
match self {
Some(val) => val,
None => panic!(" `Option::unwrap()` `None`"),
}
}
:
#[track_caller]
pub fn unwrap(self) -> T {
match self {
Some(val) => val,
None => panic!(" `Option::unwrap()` `None`"),
}
}
!
const fn
if
,if let
match
while
,while let
loop
-
&&
||
const fn foo() {
let x = [1, 2, 3, 4, 5];
//
let y: &[_] = &x;
}
, , const fn
, ! , , const-sha1
SHA1 . 40- Microsoft WinRT Rust.
const fn
, std::mem::forget
const fn
. API:
1.46.0
Rust - . , .
opencollective: https://opencollective.com/rust-lang-ru.