Rust 团队于近日发布了 Rust 1.67.0 新版本,1.67.0 稳定版中的主要更新内容如下:
#[must_use] 对 async fn 有效
带有 #[must_use] 注释的 async 函数现在将该属性应用于返回的 impl Future 的输出。Future 特性本身已经带有 #[must_use] 注释,所以所有实现 Future 的类型都自动 #[must_use]。
在 1.67 版本中,如果输出没有以某种方式使用,编译器现在会发出警告。
#[must_use]
async fn bar() -> u32 { 0 }
async fn caller() {
bar().await;
}
warning: unused output of future returned by `bar` that must be used
--> src/lib.rs:5:5
|
5 | bar().await;
| ^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
std::sync::mpsc 实现更新
Rust 的标准库从 1.0 之前就有一个多生产者、单消费者的通道,但在这个版本中,实现被换成了基于 crossbeam-channel。这个版本不包含 API 的变化,但新的实现修复了一些错误,提高了实现的性能和可维护性。
从这个版本开始,用户不应该注意到行为上的任何显著变化。
稳定的 API
[{integer}::checked_ilog]()[{integer}::checked_ilog2]()[{integer}::checked_ilog10]()[{integer}::ilog]()[{integer}::ilog2]()[{integer}::ilog10]()[NonZeroU*::ilog2]()[NonZeroU*::ilog10]()[NonZero*::BITS]()
这些 API 现在在 const 中是稳定的:
[char::from_u32]()[char::from_digit]()[char::to_digit]()[core::char::from_u32]()[core::char::from_digit]()
更多详情可查看:https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html
为您推荐与 rust 相关的帖子:
- Rust 1.73.0 发布
- Rust 1.93.0 稳定版发布
- Rust 1.91.0 稳定版发布
- Rust 1.89.0 稳定版发布
- Rust 1.80.0 发布
- Rust 1.77.0 发布
- Rust 1.75.0 发布
- Rust 1.74.0 发布
- Rust Analyzer 更新 #204,修复问题
- Rust 1.64.0 发布
- Rust 1.72.0 发布,未来支持版本最低为 Windows 10
- Rust 1.71.0 稳定版发布
- Rust 1.70.0 正式发布
- Rust 1.69.0 稳定版已发布
- Rust 1.68.1 发布
- Rust 1.68.0 现已发布
- Rust 1.67.1 发布
- Rust 1.66.1 发布
暂无回复。
