Re: [PATCH RESEND] rust: doctest: trim function name for reproducbility

From: Miguel Ojeda

Date: Wed Sep 30 2026 - 17:31:06 EST


On Thu, Sep 24, 2026 at 2:51 AM Gary Guo <gary@xxxxxxxxxx> wrote:
>
> From: Gary Guo <gary@xxxxxxxxxxx>
>
> Currently rustdoc will generate function names like
> "_doctest_main__home_gary_Projects_linux_rust_kernel_io_rs_824_0" for a
> doctest located at rust/kernel/io.rs:824, when building with separate
> outdir using `O=`. This creates overlong symbol names and is also not
> reproducible.
>
> Fix it by doing a custom remapping to trim it to something like
> `_doctest_main_rust_kernel_io_rs_824_0`.
>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>

Applied to `rust-next` -- thanks!

[ `rustdoc` already remaps these paths when we use Rust >= 1.95, thus
this fix is needed for older toolchains. - Miguel ]

[ Added `TODO` comment about the minimum version bump. Reworded title
and comment for typos. - Miguel ]

Cheers,
Miguel