rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Benno Lossin" <lossin@kernel.org>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>
Cc: <rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 4/7] rust: str: make `from_bytes_with_nul_unchecked_mut` const
Date: Thu, 19 Jun 2025 11:32:39 +0900	[thread overview]
Message-ID: <DAQ5P0NPCHP4.1FJ30U8EW3JZ2@nvidia.com> (raw)
In-Reply-To: <DAPYYWSUVMGN.L3ICDJAIJ2PO@kernel.org>

On Thu Jun 19, 2025 at 6:16 AM JST, Benno Lossin wrote:
> On Mon Jun 16, 2025 at 5:34 AM CEST, Alexandre Courbot wrote:
>> This method was probably kept non-const due to the absence of the
>> `const_mut_refs` feature, but it has been enabled since the introduction
>> of this code (and stabilized with Rust 1.83). Thus, make it const to
>> match its non-const counterpart.
>>
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>
> Ah on second thought, this and the next two patches are a bit redundant,
> since Tamir has a series [1] removing our `CStr` and using the one from
> `core`.
>
> If you need this *now* and can't wait for Tamir's series to land, then
> we can do this and the other two changes, but othrwise I'd just use
> `CStr` from `core`.
>
> It does seem like you need `&mut CStr`, which the one in `core` doesn't
> seem to provide... But our `CStr` also doesn't have `IndexMut`, so...
> how are you using it? Giving it to a C API?
>
> In that case I don't know what we should do about [1]... @Miguel?
>
> [1]: https://lore.kernel.org/all/20250530-cstr-core-v11-0-cd9c0cbcb902@gmail.com

Let's drop this part (patches 4..=7) for now to avoid interfering with
Tamir's work - the CString implementation was more of a drive-by, the
container types are more important to support. I will revisit after
Tamir's series lands, if needed.

As Danilo took patches 1 and 3, this just leaves patch 2 to be picked
up if it looks ok.

  reply	other threads:[~2025-06-19  2:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16  3:34 [PATCH v4 0/7] rust: a few common Borrow/BorrowMut implementations Alexandre Courbot
2025-06-16  3:34 ` [PATCH v4 1/7] rust: alloc: implement `Borrow` and `BorrowMut` for `Vec` Alexandre Courbot
2025-06-18 21:45   ` Danilo Krummrich
2025-06-16  3:34 ` [PATCH v4 2/7] rust: sync: implement `Borrow` and `BorrowMut` for `Arc` types Alexandre Courbot
2025-06-29 19:31   ` Miguel Ojeda
2025-06-16  3:34 ` [PATCH v4 3/7] rust: alloc: implement `Borrow` and `BorrowMut` for `KBox` Alexandre Courbot
2025-06-18 21:46   ` Danilo Krummrich
2025-06-16  3:34 ` [PATCH v4 4/7] rust: str: make `from_bytes_with_nul_unchecked_mut` const Alexandre Courbot
2025-06-18 21:08   ` Benno Lossin
2025-06-18 21:16   ` Benno Lossin
2025-06-19  2:32     ` Alexandre Courbot [this message]
2025-06-16  3:34 ` [PATCH v4 5/7] rust: str: use transmute in `from_bytes_with_nul_unchecked_mut` Alexandre Courbot
2025-06-16  3:34 ` [PATCH v4 6/7] rust: str: implement `from_bytes_with_nul_mut` Alexandre Courbot
2025-06-16  3:34 ` [PATCH v4 7/7] rust: str: implement `Borrow` and `BorrowMut` for `CString` Alexandre Courbot

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=DAQ5P0NPCHP4.1FJ30U8EW3JZ2@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --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=ojeda@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;
as well as URLs for NNTP newsgroup(s).