rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rust: allow `unreachable_pub` for doctests
@ 2025-11-10 11:35 Miguel Ojeda
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-10 11:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, David Gow, Miguel Ojeda, Alex Gaynor
  Cc: Rae Moar, linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, linux-kernel, patches

Examples (i.e. doctests) may want to show public items such as structs,
thus the `unreachable_pub` warning is not very helpful.

Thus allow it for all doctests.

In addition, remove it from the existing `expect`s we have in a couple
doctests.

Suggested-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 rust/kernel/init.rs         | 2 +-
 rust/kernel/types.rs        | 2 +-
 scripts/rustdoc_test_gen.rs | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 4949047af8d7..e476d81c1a27 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -67,7 +67,7 @@
 //! ```
 //!
 //! ```rust
-//! # #![expect(unreachable_pub, clippy::disallowed_names)]
+//! # #![expect(clippy::disallowed_names)]
 //! use kernel::{prelude::*, types::Opaque};
 //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
 //! # mod bindings {
diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
index dc0a02f5c3cf..835824788506 100644
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@ -289,7 +289,7 @@ fn drop(&mut self) {
 /// # Examples
 ///
 /// ```
-/// # #![expect(unreachable_pub, clippy::disallowed_names)]
+/// # #![expect(clippy::disallowed_names)]
 /// use kernel::types::Opaque;
 /// # // Emulate a C struct binding which is from C, maybe uninitialized or not, only the C side
 /// # // knows.
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index c8f9dc2ab976..0e6a0542d1bd 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -208,6 +208,7 @@ macro_rules! assert_eq {{
     #[allow(unused)]
     static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 1;
     {{
+        #![allow(unreachable_pub)]
         {body}
         main();
     }}

base-commit: e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] rust: device: make example buildable
  2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
@ 2025-11-10 11:35 ` Miguel Ojeda
  2025-11-10 11:54   ` Alice Ryhl
                     ` (2 more replies)
  2025-11-10 11:53 ` [PATCH 1/2] rust: allow `unreachable_pub` for doctests Alice Ryhl
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-10 11:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, David Gow, Miguel Ojeda, Alex Gaynor
  Cc: Rae Moar, linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, linux-kernel, patches

This example can easily be made buildable, thus do so.

It would have triggered an `unreachable_pub` warning without the previous
commit.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 rust/kernel/device.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
index a849b7dde2fd..d00f4af507db 100644
--- a/rust/kernel/device.rs
+++ b/rust/kernel/device.rs
@@ -67,7 +67,16 @@
 ///
 /// A bus specific device should be defined as follows.
 ///
-/// ```ignore
+/// ```
+/// # use core::marker::PhantomData;
+/// # use kernel::{
+/// #     device,
+/// #     types::Opaque, //
+/// # };
+/// # mod bindings {
+/// #     #[expect(non_camel_case_types)]
+/// #     pub struct bus_device_type;
+/// # }
 /// #[repr(transparent)]
 /// pub struct Device<Ctx: device::DeviceContext = device::Normal>(
 ///     Opaque<bindings::bus_device_type>,
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
@ 2025-11-10 11:53 ` Alice Ryhl
  2025-11-10 12:04   ` Miguel Ojeda
  2025-11-10 13:38   ` Gary Guo
  2025-11-10 14:39 ` Benno Lossin
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Alice Ryhl @ 2025-11-10 11:53 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, David Gow, Alex Gaynor, Rae Moar,
	linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, Nov 10, 2025 at 12:35:27PM +0100, Miguel Ojeda wrote:
> Examples (i.e. doctests) may want to show public items such as structs,
> thus the `unreachable_pub` warning is not very helpful.
> 
> Thus allow it for all doctests.
> 
> In addition, remove it from the existing `expect`s we have in a couple
> doctests.
> 
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

>  rust/kernel/init.rs         | 2 +-
>  rust/kernel/types.rs        | 2 +-
>  scripts/rustdoc_test_gen.rs | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
> index 4949047af8d7..e476d81c1a27 100644
> --- a/rust/kernel/init.rs
> +++ b/rust/kernel/init.rs
> @@ -67,7 +67,7 @@
>  //! ```
>  //!
>  //! ```rust
> -//! # #![expect(unreachable_pub, clippy::disallowed_names)]
> +//! # #![expect(clippy::disallowed_names)]

Maybe we should also allow disallowed_names in doc tests?

Alice

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rust: device: make example buildable
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
@ 2025-11-10 11:54   ` Alice Ryhl
  2025-11-14  3:14   ` David Gow
  2025-11-17  7:46   ` Miguel Ojeda
  2 siblings, 0 replies; 13+ messages in thread
From: Alice Ryhl @ 2025-11-10 11:54 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, David Gow, Alex Gaynor, Rae Moar,
	linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, Nov 10, 2025 at 12:35:28PM +0100, Miguel Ojeda wrote:
> This example can easily be made buildable, thus do so.
> 
> It would have triggered an `unreachable_pub` warning without the previous
> commit.
> 
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

>  rust/kernel/device.rs | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
> index a849b7dde2fd..d00f4af507db 100644
> --- a/rust/kernel/device.rs
> +++ b/rust/kernel/device.rs
> @@ -67,7 +67,16 @@
>  ///
>  /// A bus specific device should be defined as follows.
>  ///
> -/// ```ignore
> +/// ```
> +/// # use core::marker::PhantomData;
> +/// # use kernel::{
> +/// #     device,
> +/// #     types::Opaque, //
> +/// # };
> +/// # mod bindings {
> +/// #     #[expect(non_camel_case_types)]
> +/// #     pub struct bus_device_type;
> +/// # }
>  /// #[repr(transparent)]
>  /// pub struct Device<Ctx: device::DeviceContext = device::Normal>(
>  ///     Opaque<bindings::bus_device_type>,
> -- 
> 2.51.2
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:53 ` [PATCH 1/2] rust: allow `unreachable_pub` for doctests Alice Ryhl
@ 2025-11-10 12:04   ` Miguel Ojeda
  2025-11-10 13:38   ` Gary Guo
  1 sibling, 0 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-10 12:04 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Brendan Higgins, David Gow, Alex Gaynor,
	Rae Moar, linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, Nov 10, 2025 at 12:53 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> Maybe we should also allow disallowed_names in doc tests?

Not sure -- I thought it may point people to try to come up with
better names in examples. On the other hand, for abstract facilities,
it is true that there may not be good names anyway.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:53 ` [PATCH 1/2] rust: allow `unreachable_pub` for doctests Alice Ryhl
  2025-11-10 12:04   ` Miguel Ojeda
@ 2025-11-10 13:38   ` Gary Guo
  2025-11-10 19:55     ` John Hubbard
  2025-11-17  7:47     ` Miguel Ojeda
  1 sibling, 2 replies; 13+ messages in thread
From: Gary Guo @ 2025-11-10 13:38 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Brendan Higgins, David Gow, Alex Gaynor,
	Rae Moar, linux-kselftest, kunit-dev, Boqun Feng,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, 10 Nov 2025 11:53:16 +0000
Alice Ryhl <aliceryhl@google.com> wrote:

> On Mon, Nov 10, 2025 at 12:35:27PM +0100, Miguel Ojeda wrote:
> > Examples (i.e. doctests) may want to show public items such as structs,
> > thus the `unreachable_pub` warning is not very helpful.
> > 
> > Thus allow it for all doctests.
> > 
> > In addition, remove it from the existing `expect`s we have in a couple
> > doctests.
> > 
> > Suggested-by: Alice Ryhl <aliceryhl@google.com>
> > Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
> > Signed-off-by: Miguel Ojeda <ojeda@kernel.org>  
> 
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> 
> >  rust/kernel/init.rs         | 2 +-
> >  rust/kernel/types.rs        | 2 +-
> >  scripts/rustdoc_test_gen.rs | 1 +
> >  3 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
> > index 4949047af8d7..e476d81c1a27 100644
> > --- a/rust/kernel/init.rs
> > +++ b/rust/kernel/init.rs
> > @@ -67,7 +67,7 @@
> >  //! ```
> >  //!
> >  //! ```rust
> > -//! # #![expect(unreachable_pub, clippy::disallowed_names)]
> > +//! # #![expect(clippy::disallowed_names)]  
> 
> Maybe we should also allow disallowed_names in doc tests?
> 
> Alice

+1 on allowing disallowed_names. I think for doc tests we should try
to reduce false positives to make it easier to write them. We shouldn't
try to enable all clippy lints on doc tests, especially that clippy
doesn't run today on rustdocs at all.

Best,
Gary

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
  2025-11-10 11:53 ` [PATCH 1/2] rust: allow `unreachable_pub` for doctests Alice Ryhl
@ 2025-11-10 14:39 ` Benno Lossin
  2025-11-14  3:14 ` David Gow
  2025-11-17 21:02 ` Miguel Ojeda
  4 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2025-11-10 14:39 UTC (permalink / raw)
  To: Miguel Ojeda, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Brendan Higgins, David Gow, Alex Gaynor
  Cc: Rae Moar, linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, linux-kernel, patches

On Mon Nov 10, 2025 at 12:35 PM CET, Miguel Ojeda wrote:
> Examples (i.e. doctests) may want to show public items such as structs,
> thus the `unreachable_pub` warning is not very helpful.
>
> Thus allow it for all doctests.
>
> In addition, remove it from the existing `expect`s we have in a couple
> doctests.
>
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Acked-by: Benno Lossin <lossin@kernel.org>

Cheers,
Benno

> ---
>  rust/kernel/init.rs         | 2 +-
>  rust/kernel/types.rs        | 2 +-
>  scripts/rustdoc_test_gen.rs | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 13:38   ` Gary Guo
@ 2025-11-10 19:55     ` John Hubbard
  2025-11-17  7:47     ` Miguel Ojeda
  1 sibling, 0 replies; 13+ messages in thread
From: John Hubbard @ 2025-11-10 19:55 UTC (permalink / raw)
  To: Gary Guo, Alice Ryhl
  Cc: Miguel Ojeda, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Brendan Higgins, David Gow, Alex Gaynor,
	Rae Moar, linux-kselftest, kunit-dev, Boqun Feng,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On 11/10/25 5:38 AM, Gary Guo wrote:
> On Mon, 10 Nov 2025 11:53:16 +0000
> Alice Ryhl <aliceryhl@google.com> wrote:
...
>>> -//! # #![expect(unreachable_pub, clippy::disallowed_names)]
>>> +//! # #![expect(clippy::disallowed_names)]  
>>
>> Maybe we should also allow disallowed_names in doc tests?
>>
>> Alice
> 
> +1 on allowing disallowed_names. I think for doc tests we should try
> to reduce false positives to make it easier to write them. We shouldn't
> try to enable all clippy lints on doc tests, especially that clippy
> doesn't run today on rustdocs at all.
> 
> Best,
> Gary
> 

After learning about disallowed_names ("foo", "bar" and others that are
in fact classical documentation favorites), I also think it would be
very nice to allow those in documentation.


thanks,
-- 
John Hubbard


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
                   ` (2 preceding siblings ...)
  2025-11-10 14:39 ` Benno Lossin
@ 2025-11-14  3:14 ` David Gow
  2025-11-17 21:02 ` Miguel Ojeda
  4 siblings, 0 replies; 13+ messages in thread
From: David Gow @ 2025-11-14  3:14 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, Alex Gaynor, Rae Moar, linux-kselftest,
	kunit-dev, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

On Mon, 10 Nov 2025 at 19:35, Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Examples (i.e. doctests) may want to show public items such as structs,
> thus the `unreachable_pub` warning is not very helpful.
>
> Thus allow it for all doctests.
>
> In addition, remove it from the existing `expect`s we have in a couple
> doctests.
>
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---

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

Cheers,
-- David

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5281 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rust: device: make example buildable
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
  2025-11-10 11:54   ` Alice Ryhl
@ 2025-11-14  3:14   ` David Gow
  2025-11-17  7:46   ` Miguel Ojeda
  2 siblings, 0 replies; 13+ messages in thread
From: David Gow @ 2025-11-14  3:14 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, Alex Gaynor, Rae Moar, linux-kselftest,
	kunit-dev, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

On Mon, 10 Nov 2025 at 19:35, Miguel Ojeda <ojeda@kernel.org> wrote:
>
> This example can easily be made buildable, thus do so.
>
> It would have triggered an `unreachable_pub` warning without the previous
> commit.
>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---

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

Cheers,
-- David

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5281 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rust: device: make example buildable
  2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
  2025-11-10 11:54   ` Alice Ryhl
  2025-11-14  3:14   ` David Gow
@ 2025-11-17  7:46   ` Miguel Ojeda
  2 siblings, 0 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-17  7:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: Brendan Higgins, David Gow, Alex Gaynor, Rae Moar,
	linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, linux-kernel, patches, Miguel Ojeda

On Mon, Nov 10, 2025 at 12:35 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> This example can easily be made buildable, thus do so.
>
> It would have triggered an `unreachable_pub` warning without the previous
> commit.
>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Greg et al.: a quick Acked-by would be appreciated.

I can also pick the first patch without this one if preferred.

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 13:38   ` Gary Guo
  2025-11-10 19:55     ` John Hubbard
@ 2025-11-17  7:47     ` Miguel Ojeda
  1 sibling, 0 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-17  7:47 UTC (permalink / raw)
  To: Gary Guo
  Cc: Alice Ryhl, Miguel Ojeda, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Brendan Higgins, David Gow, Alex Gaynor,
	Rae Moar, linux-kselftest, kunit-dev, Boqun Feng,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, Nov 10, 2025 at 2:38 PM Gary Guo <gary@garyguo.net> wrote:
>
> We shouldn't
> try to enable all clippy lints on doc tests, especially that clippy
> doesn't run today on rustdocs at all.

You mean on Cargo / userspace projects, right?

Yeah, I think they want to change that -- it is a part of the kernel
build that works better than the usual Rust project, in the sense that
Clippy is quite important to have in order to enforce things like `//
SAFETY: ...` comments.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] rust: allow `unreachable_pub` for doctests
  2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
                   ` (3 preceding siblings ...)
  2025-11-14  3:14 ` David Gow
@ 2025-11-17 21:02 ` Miguel Ojeda
  4 siblings, 0 replies; 13+ messages in thread
From: Miguel Ojeda @ 2025-11-17 21:02 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Brendan Higgins, David Gow, Alex Gaynor, Rae Moar,
	linux-kselftest, kunit-dev, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, rust-for-linux, linux-kernel, patches

On Mon, Nov 10, 2025 at 12:35 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Examples (i.e. doctests) may want to show public items such as structs,
> thus the `unreachable_pub` warning is not very helpful.
>
> Thus allow it for all doctests.
>
> In addition, remove it from the existing `expect`s we have in a couple
> doctests.
>
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Link: https://lore.kernel.org/rust-for-linux/aRG9VjsaCjsvAwUn@google.com/
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Applied (this one only) to `rust-next` -- thanks everyone!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-11-17 21:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 11:35 [PATCH 1/2] rust: allow `unreachable_pub` for doctests Miguel Ojeda
2025-11-10 11:35 ` [PATCH 2/2] rust: device: make example buildable Miguel Ojeda
2025-11-10 11:54   ` Alice Ryhl
2025-11-14  3:14   ` David Gow
2025-11-17  7:46   ` Miguel Ojeda
2025-11-10 11:53 ` [PATCH 1/2] rust: allow `unreachable_pub` for doctests Alice Ryhl
2025-11-10 12:04   ` Miguel Ojeda
2025-11-10 13:38   ` Gary Guo
2025-11-10 19:55     ` John Hubbard
2025-11-17  7:47     ` Miguel Ojeda
2025-11-10 14:39 ` Benno Lossin
2025-11-14  3:14 ` David Gow
2025-11-17 21:02 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).