public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miguel Ojeda <ojeda@kernel.org>
To: gary@kernel.org
Cc: a.hindborg@kernel.org, aliceryhl@google.com,
	bjorn3_gh@protonmail.com, boqun@kernel.org, dakr@kernel.org,
	gary@garyguo.net, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, lossin@kernel.org,
	nathan@kernel.org, nsc@kernel.org, ojeda@kernel.org,
	rust-for-linux@vger.kernel.org, tmgross@umich.edu
Subject: Re: [PATCH v4 2/3] rust: ptr: add projection infrastructure
Date: Tue,  3 Mar 2026 22:11:28 +0100	[thread overview]
Message-ID: <20260303211128.107943-1-ojeda@kernel.org> (raw)
In-Reply-To: <20260302164239.284084-3-gary@kernel.org>

On Mon, 02 Mar 2026 16:42:35 +0000 Gary Guo <gary@kernel.org> wrote:
>
> Add a generic infrastructure for performing field and index projections on
> raw pointers. This will form the basis of performing I/O projections.

A few nits below for patch apply time.

> +/// A helper trait to perform index projection.
> +///
> +/// This is similar to `core::slice::SliceIndex`, but operate on raw pointers safely and fallibly.

Intra-doc link.

> +/// The implementation of `index` and `get` (if `Some` is returned) must ensure that, if provided

Intra-doc link.

> +// Forward array impl to slice impl.

`//` empty line between this and the next one.

> +// SAFETY: safety requirement guaranteed by the forwarded impl.

Capitalization (several similar ones, plus a `NOTE:` one, a "vacuously" one and
a "the provided" one).

> +/// implement `Deref`. This will cause an ambiguity error and thus block `Deref` types being used

Intra-doc links.

> +// currently support that as we need to obtain a valid allocation that `&raw const` can operate on.
> +// SAFETY: `proj` invokes `f` with valid allocation.

Probably `//` empty line between them.

> +/// It is not allowed to project into types that implement custom `Deref` or `Index`.

Intra-doc links.

> +/// `OutOfBound` error is raised via `?` if the index is out of bounds.

Intra-doc link.

> +/// Field projections are performed with `.field_name`:
> +/// ```

`//` emtpy line between paragraphs and examples (several more below).

> +///     // This will fail the build.

"would" may be clearer, unless we add "... if uncommented.".

Perhaps even:

  // The following invocation would fail the build.

And maybe similarly in the next one.

> +#   - Stable since Rust 1.79.0: `feature(slice_ptr_len)`.
> +#   - Stable since Rust 1.84.0: `feature(strict_provenance)`.

Added both (plus `feature(exposed_provenance)`, which Andreas asked
about privately in our Zulip) to our usual lists:

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

linking to the PRs and to this thread etc.

I hope that helps!

Cheers,
Miguel

  parent reply	other threads:[~2026-03-03 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260302164239.284084-1-gary@kernel.org>
2026-03-02 16:42 ` [PATCH v4 1/3] rust: ptr: add `KnownSize` trait to support DST size info extraction Gary Guo
2026-03-02 18:56   ` Benno Lossin
2026-03-02 18:57   ` Benno Lossin
2026-03-02 19:42     ` Gary Guo
2026-03-02 21:52       ` Benno Lossin
2026-03-02 16:42 ` [PATCH v4 2/3] rust: ptr: add projection infrastructure Gary Guo
2026-03-02 19:02   ` Benno Lossin
2026-03-03 21:11   ` Miguel Ojeda [this message]
2026-03-02 16:42 ` [PATCH v4 3/3] rust: dma: use pointer projection infra for `dma_{read,write}` macro Gary Guo

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=20260303211128.107943-1-ojeda@kernel.org \
    --to=ojeda@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gary@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --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