lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSmHcC1dZwVNvAyQKrAcJMkL-aVpwzSM_QqQFsr2KNH-mQ@mail.gmail.com>
Date: Fri, 19 Dec 2025 18:38:05 +0800
From: David Gow <davidgow@...gle.com>
To: Gary Guo <gary@...yguo.net>
Cc: Brendan Higgins <brendan.higgins@...ux.dev>, Rae Moar <raemoar63@...il.com>, 
	Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, 
	Danilo Krummrich <dakr@...nel.org>, linux-kselftest@...r.kernel.org, 
	kunit-dev@...glegroups.com, rust-for-linux@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: fix off-by-one line number in rustdoc tests

On Fri, 12 Dec 2025 at 02:22, Gary Guo <gary@...nel.org> wrote:
>
> From: Gary Guo <gary@...yguo.net>
>
> 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@...yguo.net>
> ---

Nice catch!

Reviewed-by: David Gow <davidgow@...gle.com>

Cheers,
-- David

>  scripts/rustdoc_test_gen.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
> index be05610496605..6fd9f5c84e2e4 100644
> --- a/scripts/rustdoc_test_gen.rs
> +++ b/scripts/rustdoc_test_gen.rs
> @@ -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
>

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5281 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ