Skip to contentSkip to conversation

rust: slice: fix broken intra-doc links

PATCH In review Miguel Ojeda 3 participants 4 messages Nov 19, 2025 – Nov 20, 2025 Rust

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: slice: fix broken intra-doc links

In older versions of Rust, the compiler doesn't know about the newer as_flattened* methods, thus rustdoc complains about the intra-doc links, e.g.

error: unresolved link to slice::as_flattened
--> rust/kernel/slice.rs:19:23
|
19 | /// [as_flattened]: slice::as_flattened
| ^^^^^^^^^^^^^^^^^^^ the primitive type slice has no associated item named as_flattened
|
= note: -D rustdoc::broken-intra-doc-links implied by -D warnings = help: to override -D warnings add #[allow(rustdoc::broken_intra_doc_links)]

Thus fix them by using an URL instead.

Fixes 88622323dde3 ("rust: enable slice_flatten feature and provide it through an extension trait")

---
I have seen this in -next -- please feel free to take it or rebase if preferred etc., of course. Thanks!

 rust/kernel/slice.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
rust/kernel/slice.rs +4 -4
index 6ca91a4fd1f2..ca2cde135061 100644
@@ -16,22 +16,22 @@
 ///
 /// This trait can be removed once the MSRV passes 1.80.
 ///
-/// [`as_flattened`]: slice::as_flattened
-/// [`as_flattened_mut`]: slice::as_flattened_mut
+/// [`as_flattened`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_flattened
+/// [`as_flattened_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_flattened_mut
 #[cfg(not(CONFIG_RUSTC_HAS_SLICE_AS_FLATTENED))]
 pub trait AsFlattened<T> {
     /// Takes a `&[[T; N]]` and flattens it to a `&[T]`.
     ///
     /// This is an portable layer on top of [`as_flattened`]; see its documentation for details.
     ///
-    /// [`as_flattened`]: slice::as_flattened
+    /// [`as_flattened`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_flattened
     fn as_flattened(&self) -> &[T];
 
     /// Takes a `&mut [[T; N]]` and flattens it to a `&mut [T]`.
     ///
     /// This is an portable layer on top of [`as_flattened_mut`]; see its documentation for details.
     ///
-    /// [`as_flattened_mut`]: slice::as_flattened_mut
+    /// [`as_flattened_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_flattened_mut
     fn as_flattened_mut(&mut self) -> &mut [T];
 }
 

--
2.52.0

reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Miguel Ojeda

In older versions of Rust, the compiler doesn't know about the newer as_flattened* methods, thus rustdoc complains about the intra-doc links, e.g.

error: unresolved link to slice::as_flattened
--> rust/kernel/slice.rs:19:23
|
19 | /// [as_flattened]: slice::as_flattened
| ^^^^^^^^^^^^^^^^^^^ the primitive type slice has no associated item named as_flattened
|
= note: -D rustdoc::broken-intra-doc-links implied by -D warnings = help: to override -D warnings add #[allow(rustdoc::broken_intra_doc_links)]

Quoted 4 lines

Thus fix them by using an URL instead.

Fixes 88622323dde3 ("rust: enable slice_flatten feature and provide it through an extension trait")
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Miguel Ojeda
Quoted 13 lines · Miguel Ojeda

In older versions of Rust, the compiler doesn't know about the newer as_flattened* methods, thus rustdoc complains about the intra-doc links, e.g.

error: unresolved link to slice::as_flattened
--> rust/kernel/slice.rs:19:23
|
19 | /// [as_flattened]: slice::as_flattened
| ^^^^^^^^^^^^^^^^^^^ the primitive type slice has no associated item named as_flattened
|
= note: -D rustdoc::broken-intra-doc-links implied by -D warnings = help: to override -D warnings add #[allow(rustdoc::broken_intra_doc_links)]

Quoted 7 lines

Thus fix them by using an URL instead.

Fixes 88622323dde3 ("rust: enable slice_flatten feature and provide it through an extension trait")

---
I have seen this in -next -- please feel free to take it or rebase if preferred etc., of course. Thanks!

Alice, I guess we will want to take this into drm-rust-next or drm-rust-fixes since that's where the patch introducing this originates from?

reviewer
#3 lore raw
Quoted 22 lines · Alexandre Courbot
Quoted 13 lines · Miguel Ojeda

In older versions of Rust, the compiler doesn't know about the newer as_flattened* methods, thus rustdoc complains about the intra-doc links, e.g.

error: unresolved link to slice::as_flattened
--> rust/kernel/slice.rs:19:23
|
19 | /// [as_flattened]: slice::as_flattened
| ^^^^^^^^^^^^^^^^^^^ the primitive type slice has no associated item named as_flattened
|
= note: -D rustdoc::broken-intra-doc-links implied by -D warnings = help: to override -D warnings add #[allow(rustdoc::broken_intra_doc_links)]

Quoted 7 lines

Thus fix them by using an URL instead.

Fixes 88622323dde3 ("rust: enable slice_flatten feature and provide it through an extension trait")

---
I have seen this in -next -- please feel free to take it or rebase if preferred etc., of course. Thanks!

Quoted 5 lines

Alice, I guess we will want to take this into drm-rust-next or drm-rust-fixes since that's where the patch introducing this originates from?

Yes, it goes in drm-rust-next:

After -rc6, the branch is open for fixing bugs introduced by patches queued up in drm-rust-next for the upcoming merge window only.

I will take the patch.

Alice