mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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: ab844cf320 ("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>
This commit is contained in:
@@ -206,7 +206,7 @@ pub extern "C" fn {kunit_name}(__kunit_test: *mut ::kernel::bindings::kunit) {{
|
||||
|
||||
/// The anchor where the test code body starts.
|
||||
#[allow(unused)]
|
||||
static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 1;
|
||||
static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 2;
|
||||
{{
|
||||
#![allow(unreachable_pub, clippy::disallowed_names)]
|
||||
{body}
|
||||
|
||||
Reference in New Issue
Block a user