Commit 946c5efe authored by Gary Guo's avatar Gary Guo Committed by Miguel Ojeda
Browse files

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: ab844cf3 ("rust: allow `unreachable_pub` for doctests")
Signed-off-by: default avatarGary Guo <gary@garyguo.net>
Reviewed-by: default avatarDavid Gow <davidgow@google.com>
Link: https://patch.msgid.link/20251211182208.2791025-1-gary@kernel.org


Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent f6b8d4b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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}