More Rust Code Sent In For Linux 6.2 To Implement More Functionality

Written by Michael Larabel in Programming on 11 December 2022 at 06:27 AM EST. 8 Comments
PROGRAMMING
While Linux 6.1 merged the initial Rust infrastructure, in this kernel version set to be released as stable today there isn't any Rust-based functionality for end-users. With v6.1 it's just some of the initial code for building up the Rust programming language support and it's continuing that way for Linux 6.2. The pull request of more Rust enablement has already been sent out for the Linux 6.2 merge window.

Miguel Ojeda has already sent out the pull request of new Rust code for Linux 6.2. The Rust code for Linux 6.2 continues building up more functionality in this programming language so it can be more useful to kernel developers. This pull is just infrastructure work and not yet introducing any new Rust-written hardware drivers or the like.


The Rust changes summed up by Ojeda for Linux 6.2 include:
- String and formatting: new types `CString`, `CStr`, `BStr` and `Formatter`; new macros `c_str!`, `b_str!` and `fmt!`.

- Errors: the rest of the error codes from `errno-base.h`, as well as some `From` trait implementations for the `Error` type.

- Printing: the rest of the `pr_*!` levels and the continuation one `pr_cont!`, as well as a new sample.

- `alloc` crate: new constructors `try_with_capacity()` and `try_with_capacity_in()` for `RawVec` and `Vec`.

- Procedural macros: new macros `#[vtable]` and `concat_idents!`, as well as better ergonomics for `module!` users.

- Asserting: new macros `static_assert!`, `build_error!` and `build_assert!`, as well as a new crate `build_error` to support them.

- Vocabulary types: new types `Opaque` and `Either`.

- Debugging: new macro `dbg!`.

See the Rust pull request for the full list of Rust patches targeting the Linux 6.2 merge window.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week