Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: fix off-by-one line number in rustdoc tests

When the `#![allow]` line was added, the doctest line number anchor
isn't updated which causes the line number printed in kunit test to be
off-by-one.

Fixes: ab844cf32058 ("rust: allow `unreachable_pub` for doctests")
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: David Gow <davidgow@google.com>
Link: https://patch.msgid.link/20251211182208.2791025-1-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Gary Guo and committed by
Miguel Ojeda
946c5efe f6b8d4b7

+1 -1
+1 -1
scripts/rustdoc_test_gen.rs
··· 206 206 207 207 /// The anchor where the test code body starts. 208 208 #[allow(unused)] 209 - static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 1; 209 + static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 2; 210 210 {{ 211 211 #![allow(unreachable_pub, clippy::disallowed_names)] 212 212 {body}