On Thu, Aug 07, 2025 at 03:52:37PM +0200, Paolo Bonzini wrote:
> Date: Thu, 7 Aug 2025 15:52:37 +0200
> From: Paolo Bonzini <pbonz...@redhat.com>
> Subject: Re: [RFC 01/26] rust/hpet: Fix the error caused by vm-memory
> 
> On 8/7/25 14:30, Zhao Liu wrote:
> > error[E0283]: type annotations needed
> >     --> hw/timer/hpet/src/device.rs:884:55
> >      |
> > 884 |         self.num_timers == self.num_timers_save.get().into()
> >      |                         --                            ^^^^
> >      |                         |
> >      |                         type must be known at this point
> >      |
> >      = note: multiple `impl`s satisfying `usize: PartialEq<_>` found in the 
> > following crates: `core`, `vm_memory`:
> >              - impl PartialEq<vm_memory::endian::BeSize> for usize;
> >              - impl PartialEq<vm_memory::endian::LeSize> for usize;
> >              - impl<host> PartialEq for usize
> >                where the constant `host` has type `bool`;
> > help: try using a fully qualified path to specify the expected types
> >      |
> > 884 |         self.num_timers == <u8 as 
> > Into<T>>::into(self.num_timers_save.get())
> >      |                            ++++++++++++++++++++++                    
> >       ~
> 
> Oh, interesting.  In this case, you can write:
> 
>     usize::from(self.num_timers_save.get())

Ah, yes, this way is simpler! Thanks.

-Zhao



Reply via email to