rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <ojeda@kernel.org>
To: Alexandre Courbot <acourbot@nvidia.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev
Subject: [PATCH] rust: slice: fix broken intra-doc links
Date: Wed, 19 Nov 2025 19:51:25 +0100	[thread overview]
Message-ID: <20251119185125.1411151-1-ojeda@kernel.org> (raw)

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")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
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(-)

diff --git a/rust/kernel/slice.rs b/rust/kernel/slice.rs
index 6ca91a4fd1f2..ca2cde135061 100644
--- a/rust/kernel/slice.rs
+++ b/rust/kernel/slice.rs
@@ -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

             reply	other threads:[~2025-11-19 18:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 18:51 Miguel Ojeda [this message]
2025-11-19 18:52 ` [PATCH] rust: slice: fix broken intra-doc links Alice Ryhl
2025-11-20  1:56 ` Alexandre Courbot
2025-11-20  9:59   ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251119185125.1411151-1-ojeda@kernel.org \
    --to=ojeda@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).