Linux 6.2 获得一批新的 Rust 基础设施代码

Linux 6.1 合并了最初的 Rust 基础设施,但如今 Linux 6.1 已作为稳定版发布,其 Rust 支持仍处于初级阶段,没有任何面向最终用户的 Rust 功能。

Linux 6.2 仍在补充 Rust 代码,据外媒 Phoronix 报道,负责 Rust For Linux 部分的内核开发者 Miguel Ojeda 已经向 Linux 6.2 合并窗口发出了一个新 PR,提供一批新的 Rust 基础代码。

与 Linux 6.1 中的 Rust 支持类似,Linux 6.2 的 Rust 代码继续对 Rust 的内核构建提供更多功能,尚未引入任何新的 Rust 编写的硬件驱动程序,因此它对内核开发人员更有用。最新的 Rust for Linux 6.2 的补丁包括以下内容:

  • 字符串和格式:新类型 `CString`、`CStr`、`BStr` 和 `Formatter`;新宏“c_str!”、“b_str!” 和 “fmt!”。
  • 错误:来自 errno-base.h 的其余错误代码,以及 Error 类型的一些 From 特性实现。
  • Printing:其余的 pr_*! 级别和后续的 pr_cont!,以及一个新样本。
  • `alloc` crate::RawVecVec 的新构造函数 try_with_capacity()try_with_capacity_in()
  • 程序宏:新宏 #[vtable]concat_idents!,以及为 module! 用户提供更好的人体工程学。
  • 断言:新宏 static_assert!build_error!build_assert!,以及支持它们的新 crate build_error
  • Vocabulary 类型:新类型 OpaqueEither
  • 调试:新宏 dbg!

有关 Rust 补丁的完整细节,请参阅内核中的 Rust PR 邮件。

猜你喜欢

转载自www.oschina.net/news/221181/linux-6-2-first-rust-patch