Skip to contentSkip to conversation

rust: doc: mark `Io` as notable trait

PATCH Applied Gary Guo 3 participants 4 messages Oct 19 – Nov 21

Subsystems (3)
lore
Share & tools
lore

Gary Guo

author
#0 lore raw

PATCH 1/1 rust: doc: mark `Io` as notable trait

From: Gary Guo <[email protected]>

Io trait is the primary way of interacting with a bunch of types, e.g. Mmio and Coherent. It is hidden in "blanket impl" section which is not very discoverable.

Use nightly feature to mark Io as a notable trait, so it is highlighted at the top of the rustdoc page.

---
 rust/kernel/io.rs  | 1 +
 rust/kernel/lib.rs | 3 +++
 2 files changed, 4 insertions(+)
rust/kernel/io.rs +1 -0
index a877df11a03e..377c95dda04b 100644
@@ -486,6 +486,7 @@ pub trait IoBase<'a>: Copy {
 /// - Fallible (runtime checked) accessors for different data widths
 ///
 /// Which I/O methods are available depends on the associated [`IoBackend`] implementation.
+#[doc(notable_trait)]
 pub trait Io<'a>: IoBase<'a> {
     /// Returns the size of this I/O region.
     #[inline]
rust/kernel/lib.rs +3 -0
index 1ab41129d557..f7f720b9888a 100644
@@ -29,6 +29,9 @@
 // To be determined.
 #![feature(used_with_arg)]
 //
+// For documentation purpose only.
+#![feature(doc_notable_trait)]
+//
 // `feature(file_with_nul)` is stable since Rust 1.92.0. Before Rust 1.89.0, it did not exist, so
 // enable it conditionally.
 #![cfg_attr(CONFIG_RUSTC_HAS_FILE_WITH_NUL, feature(file_with_nul))]

base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038

Signature · 1 line
2.54.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Gary Guo

From: Gary Guo <[email protected]>

Io trait is the primary way of interacting with a bunch of types, e.g. Mmio and Coherent. It is hidden in "blanket impl" section which is not very discoverable.

Use nightly feature to mark Io as a notable trait, so it is highlighted at the top of the rustdoc page.

The attribute has been there under that name since 1.53, so it should be fine, and we can always rename it or remove it.

Having said that, let's mention it in this week's call with upstream Rust. Cc'ing Guillaume so that he is aware too.

Unless they say they really want us to not use it at all:

Cheers,
Miguel

#2 lore raw
Quoted 10 lines · Miguel Ojeda

The attribute has been there under that name since 1.53, so it should be fine, and we can always rename it or remove it.

Having said that, let's mention it in this week's call with upstream Rust. Cc'ing Guillaume so that he is aware too.

Unless they say they really want us to not use it at all:

I added it to our usual live list in the "Nice to have" section:

https://github.com/Rust-for-Linux/linux/issues/2

By the way, for the commit:

Cheers,
Miguel

Quoted 26 lines · Miguel Ojeda
Quoted 11 lines · Gary Guo

From: Gary Guo <[email protected]>

Io trait is the primary way of interacting with a bunch of types, e.g. Mmio and Coherent. It is hidden in "blanket impl" section which is not very discoverable.

Use nightly feature to mark Io as a notable trait, so it is highlighted at the top of the rustdoc page.

The attribute has been there under that name since 1.53, so it should be fine, and we can always rename it or remove it.

Having said that, let's mention it in this week's call with upstream Rust. Cc'ing Guillaume so that he is aware too.

Unless they say they really want us to not use it at all:

Cheers,
Miguel

Signature · 2 lines
Cheers,
Miguel
maintainer Applied
#3 lore raw
In reply to Gary Guo
Quoted 1 line · Gary Guo

[PATCH] rust: doc: mark Io as notable trait

Applied, thanks!

Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/1] rust: doc: mark Io as notable trait

      commit: 4abd139a3f1f

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is in the driver-core-testing branch and will be promoted to driver-core-next after validation.