From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Gary Guo" <gary@garyguo.net>
Cc: "Benno Lossin" <lossin@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Onur Özkan" <work@onurozkan.dev>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] rust: pin-init: internal: init: allow reborrow of `Pin<&mut T>` bindings
Date: Wed, 30 Sep 2026 09:33:35 +0900 [thread overview]
Message-ID: <DLS88T4UM8Z6.C388FEY1VTRW@nvidia.com> (raw)
In-Reply-To: <20260928-dev-pin-init-sync-v1-1-e591c8e9cf0e@garyguo.net>
On Tue Sep 29, 2026 at 2:32 AM JST, Gary Guo wrote:
> Use `let mut` for created bindings of initialized field, so `Pin<&mut T>`
> bindings may be reborrowed in subsequent initializers or code blocks.
>
> Without `let mut`, attempt to reborrow can produce error (and also a
> confusing fix):
>
> error[E0596]: cannot borrow `gpu` as mutable, as it is not declared as mutable
> --> drivers/gpu/nova-core/driver.rs:129:17
> |
> 129 | gpu.as_mut().run_selftests(pdev);
> | ^^^ cannot borrow as mutable
> |
> help: consider changing this to be mutable |
> 119 | mut gpu <- Gpu::new(
> | +++
>
> error: aborting due to 1 previous error
>
> Reported-by: Danilo Krummrich <dakr@kernel.org>
> Closes: https://lore.kernel.org/nova-gpu/DLQXWXRP3P1J.28SLFOJJQ2EDK@kernel.org/
> Signed-off-by: Gary Guo <gary@garyguo.net>
I've hit this issue a couple of times already, so it's a very welcome
change!
FWIW,
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
next prev parent reply other threads:[~2026-09-30 0:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 17:32 [PATCH 0/3] rust: pin-init: upstream synchronization for 7.4 Gary Guo
2026-09-28 17:32 ` [PATCH 1/3] rust: pin-init: internal: init: allow reborrow of `Pin<&mut T>` bindings Gary Guo
2026-09-29 19:17 ` Danilo Krummrich
2026-09-30 0:33 ` Alexandre Courbot [this message]
2026-09-28 17:32 ` [PATCH 2/3] rust: pin-init: internal: init: improve diagnostics from field checks Gary Guo
2026-09-28 17:32 ` [PATCH 3/3] rust: pin-init: internal: init: use span of `<-` or `:` for the init/write call Gary Guo
2026-09-30 15:38 ` [PATCH 0/3] rust: pin-init: upstream synchronization for 7.4 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=DLS88T4UM8Z6.C388FEY1VTRW@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--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=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.