来源:OSCHINA 时间:2023-01-29 08:30:43
【资料图】
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 的变化,但新的实现修复了一些错误,提高了实现的性能和可维护性。
从这个版本开始,用户不应该注意到行为上的任何显著变化。
[{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
Bitwarden 收购开源创业公司 Passwordless.dev 通讯
Twitter 开源替代品 Mastodon 热度渐退,活跃用户下降三成
天天即时:Kodi v20 "Nexus" 正式发布,开源跨平台媒体播放器
Java 之父偏爱函数式编程,称自己的代码风格被队友批评|焦点消息