惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
L
LangChain Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
D
Docker
B
Blog
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
G
Google Developers Blog
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42

Rust Blog

Security Advisory for Cargo (CVE-2026-5223) | Rust Blog Security Advisory for Cargo (CVE-2026-5222) | Rust Blog Project goals update — April 2026 (end of 2025H2) | Rust Blog Rust is participating in Outreachy | Rust Blog Raising the baseline for the `nvptx64-nvidia-cuda` target | Rust Blog Announcing Google Summer of Code 2026 selected projects | Rust Blog Announcing Rust 1.95.0 | Rust Blog docs.rs: building fewer targets by default | Rust Blog Changes to WebAssembly targets and handling undefined symbols | Rust Blog Announcing Rust 1.94.1 | Rust Blog Security advisory for Cargo | Rust Blog What we heard about Rust's challenges | Rust Blog Call for Testing: Build Dir Layout v2 | Rust Blog Announcing rustup 1.29.0 | Rust Blog Announcing Rust 1.94.0 | Rust Blog 2025 State of Rust Survey Results | Rust Blog Rust debugging survey 2026 | Rust Blog Update on the October 15, 2018 incident on crates.io Announcing Rust 1.29.2 Announcing Rust 1.29 Announcing Rust 1.28 What is Rust 2018? Announcing Rust 1.27.2 Announcing Rust 1.27.1 Security Advisory for rustdoc Announcing Rust 1.27 Announcing Rust 1.26.2 Announcing Rust 1.26.1 Rust turns three Announcing Rust 1.26
Announcing Rust 1.46.0
The Rust Release Team · 2020-08-27 · via Rust Blog

The Rust team is happy to announce a new version of Rust, 1.46.0. Rust is a programming language that is empowering everyone to build 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 have it already, you can get rustup from the appropriate page on our website, and check out the detailed release notes for 1.46.0 on GitHub.

What's in 1.46.0 stable

This release enables quite a lot of new things to appear in const fn, two new standard library APIs, and one feature useful for library authors. See the detailed release notes to learn about other changes not covered by this post.

const fn improvements

There are several core language features you can now use in a const fn:

  • if, if let, and match
  • while, while let, and loop
  • the && and || operators

You can also cast to a slice:

const fn foo() {
  let x = [1, 2, 3, 4, 5];

  // cast the array to a slice
  let y: &[_] = &x;
}

While these features may not feel new, given that you could use them all outside of const fn, they add a lot of compile-time computation power! As an example, the const-sha1 crate can let you compute SHA-1 hashes at compile time. This led to a 40x performance improvement in Microsoft's WinRT bindings for Rust.

#[track_caller]

Back in March, the release of Rust 1.42 introduced better error messages when unwrap and related functions would panic. At the time, we mentioned that the way this was implemented was not yet stable. Rust 1.46 stabilizes this feature.

This attribute is called #[track_caller], which was originally proposed in RFC 2091 way back in July of 2017! If you're writing a function like unwrap that may panic, you can put this annotation on your functions, and the default panic formatter will use its caller as the location in its error message. For example, here is unwrap previously:

pub fn unwrap(self) -> T {
    match self {
        Some(val) => val,
        None => panic!("called `Option::unwrap()` on a `None` value"),
    }
}

It now looks like this:

#[track_caller]
pub fn unwrap(self) -> T {
    match self {
        Some(val) => val,
        None => panic!("called `Option::unwrap()` on a `None` value"),
    }
}

That's it!

If you are implementing a panic hook yourself, you can use the caller method on std::panic::Location to get access to this information.

Library changes

Keeping with the theme of const fn improvements, std::mem::forget is now a const fn. Additionally, two new APIs were stabilized this release:

See the detailed release notes for more.

Other changes

There are other changes in the Rust 1.46.0 release: check out what changed in Rust, Cargo, and Clippy.

Contributors to 1.46.0

Many people came together to create Rust 1.46.0. We couldn't have done it without all of you. Thanks!