Re: [PATCH 1/3] rust: pin-init: internal: init: allow reborrow of `Pin<&mut T>` bindings

From: Danilo Krummrich

Date: Tue Sep 29 2026 - 15:17:47 EST


On 9/28/26 7:32 PM, 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@xxxxxxxxxx>
> Closes: https://lore.kernel.org/nova-gpu/DLQXWXRP3P1J.28SLFOJJQ2EDK@xxxxxxxxxx/
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
Tested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Reviewed-by: Danilo Krummrich <dakr@xxxxxxxxxx>