On Thu, Jan 22, 2026 at 08:42:02AM +0000, Alice Ryhl wrote:
> On Wed, Jan 21, 2026 at 04:37:46PM -0800, Deborah Brouwer wrote:
> > Currently these warnings, as errors, are preventing Tyr driver
> > from building:
> > 
> > error: field `device` is never read
> >   --> drivers/gpu/drm/tyr/driver.rs:37:5
> >    |
> > 36 | pub(crate) struct TyrDriver {
> >    |                   --------- field in this struct
> > 37 |     device: ARef<TyrDevice>,
> >    |     ^^^^^^
> >    |
> >    = note: `-D dead-code` implied by `-D warnings`
> >    = help: to override `-D warnings` add `#[allow(dead_code)]`
> > 
> > error: fields `mali` and `sram` are never read
> >    --> drivers/gpu/drm/tyr/driver.rs:196:5
> >     |
> > 195 | struct Regulators {
> >     |        ---------- fields in this struct
> > 196 |     mali: Regulator<regulator::Enabled>,
> >     |     ^^^^
> > 197 |     sram: Regulator<regulator::Enabled>,
> >     |     ^^^^
> > 
> > error: aborting due to 2 previous errors
> > 
> > Suppress these errors so that the Tyr driver will build.
> > 
> > Signed-off-by: Deborah Brouwer <[email protected]>
> 
> I still don't understand why I couldn't reproduce it myself, but
> assuming it's not just an 1.80.0 issue, below is my review:

I think the problem is not actually the rust compiler version, but commit
"0242623384c7 rust: driver: let probe() return impl PinInit<Self, Error>"

Tyr probe() used to return a fully initialized Pin<KBox<Self>>, so the
fields existed in an allocated struct which I suppose counted as
“reading” the fields. But now Tyr probe() returns just a PinInit
closure which doesn’t count as reading these fields.

> 
> >  drivers/gpu/drm/tyr/driver.rs | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> > index 2a45d0288825..04c865cb4397 100644
> > --- a/drivers/gpu/drm/tyr/driver.rs
> > +++ b/drivers/gpu/drm/tyr/driver.rs
> > @@ -34,6 +34,7 @@
> >  
> >  #[pin_data(PinnedDrop)]
> >  pub(crate) struct TyrDriver {
> > +    #[allow(dead_code)]
> >      device: ARef<TyrDevice>,
> 
> Let's use #[expect(dead_code)] so we remember to remove this when a user
> is added.

Using #[expect(dead_code)] also fails with 'unfulfilled lint expectation'.
So I could keep #[allow(dead_code)] or maybe just use an underscore
_driver too with a comment to explain the issue. What do you think?

> 
> >  }
> >  
> > @@ -193,6 +194,8 @@ struct Clocks {
> >  
> >  #[pin_data]
> >  struct Regulators {
> > +    #[allow(dead_code)]
> >      mali: Regulator<regulator::Enabled>,
> > +    #[allow(dead_code)]
> >      sram: Regulator<regulator::Enabled>,
> 
> I don't think we intend to ever use these fields - they exist only for
> their destructor. In that case, please prefix them with an underscore
> instead:
> 
> #[pin_data]
> struct Regulators {
>     _mali: Regulator<regulator::Enabled>,
>     _sram: Regulator<regulator::Enabled>,
> }
> 
> Alice

Reply via email to