rust: fix off-by-one line number in rustdoc tests
PATCH 1/1 rust: fix off-by-one line number in rustdoc tests
From: Gary Guo <[email protected]>
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.
--- scripts/rustdoc_test_gen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/rustdoc_test_gen.rs +1 -1
@@ -206,7 +206,7 @@ macro_rules! assert_eq {{/// 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}
base-commit: 559e608c46553c107dbba19dae0854af7b219400
Signature · 1 line
2.51.2
Quoted 10 lines · Gary Guo
From: Gary Guo <[email protected]>
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 <[email protected]>---
Nice catch!
Cheers,
-- David
Quoted 21 lines
scripts/rustdoc_test_gen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/rustdoc_test_gen.rs +1
-1@@ -206,7 +206,7 @@ macro_rules! assert_eq {{/// 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}base-commit:
559e608c46553c107dbba19dae0854af7b219400--
2.51.2
Miguel Ojeda
AppliedQuoted 9 lines · Gary Guo
From: Gary Guo <[email protected]>
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 <[email protected]>
Applied to rust-fixes -- thanks everyone!
Cheers,
Miguel