Merge tag 'rust-fixes-7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux

Pull rust fixes from Miguel Ojeda:
 "Toolchain and infrastructure:

   - Work around a 'rustc' bug by setting the 'frame-pointer' LLVM
     module flag under 'CONFIG_FRAME_POINTER'.

     The upcoming Rust 1.98.0 is fixed.

   - Doctests: fix incorrect replacement pattern.

  'kernel' crate:

   - Mark 'Debug' impl as '#[inline]'"

* tag 'rust-fixes-7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux:
  rust: Kbuild: set frame-pointer llvm module flag for CONFIG_FRAME_POINTER
  rust: doctest: fix incorrect pattern in replacement
  rust: bitfield: mark `Debug` impl as `#[inline]`
This commit is contained in:
Linus Torvalds
2026-06-24 15:06:56 -07:00
3 changed files with 14 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ fn main() {
//
// ```
// fn main() { #[allow(non_snake_case)] fn _doctest_main_rust_kernel_file_rs_28_0() {
// fn main() { #[allow(non_snake_case)] fn _doctest_main_rust_kernel_file_rs_37_0() -> Result<(), impl ::core::fmt::Debug> {
// fn main() { #[allow(non_snake_case)] fn _doctest_main_rust_kernel_file_rs_37_0() -> Result<(), impl core::fmt::Debug> {
// ```
//
// It should be unlikely that doctest code matches such lines (when code is formatted properly).
@@ -47,12 +47,16 @@ fn main() {
})
.expect("No test function found in `rustdoc`'s output.");
// Qualify `Result` to avoid the collision with our own `Result` coming from the prelude.
// Replicate `rustdoc` 1.87+ behaviour [1] by fully qualifying `Result` to avoid the collision
// with our own `Result` coming from the prelude.
//
// [1]: https://github.com/rust-lang/rust/pull/137807
//
// TODO: Remove this when MSRV is bumped above 1.87.
let body = body.replace(
&format!("{rustdoc_function_name}() -> Result<(), impl ::core::fmt::Debug> {{"),
&format!(
"{rustdoc_function_name}() -> ::core::result::Result<(), impl ::core::fmt::Debug> {{"
),
&format!("{rustdoc_function_name}() -> Result<(), impl core::fmt::Debug> {{"),
// This intentionally does not use absolute paths to match `rustdoc` 1.87 behaviour.
&format!("{rustdoc_function_name}() -> core::result::Result<(), impl core::fmt::Debug> {{"),
);
// For tests that get generated with `Result`, like above, `rustdoc` generates an `unwrap()` on