acpi icon indicating copy to clipboard operation
acpi copied to clipboard

Does not compile on 32-bit systems

Open jackpot51 opened this issue 2 years ago • 7 comments

error[E0599]: the method `view_bits_mut` exists for type `u64`, but its trait bounds were not satisfied
   --> aml/src/value.rs:525:23
    |
525 |                 value.view_bits_mut::<bitvec::order::Lsb0>()[0..length].clone_from_bitslice(bits);
    |                       ^^^^^^^^^^^^^ method cannot be called on `u64` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `u64: BitStore`
            which is required by `u64: BitView`

jackpot51 avatar Feb 07 '23 17:02 jackpot51

From BitStore in the docs: BitStore is the simpler of the two parameters. It refers to the integer type used to hold bits. It must be one of the Rust unsigned integer fundamentals: u8, u16, u32, usize, and on 64-bit systems only, u64.

rw-vanc avatar Feb 07 '23 22:02 rw-vanc

Hm, yeah weird. Not sure I understand why BitStore can't be implemented for u64 regardless of the platform's pointer size, but I must be missing something.

  1. We should definitely be testing a 32-bit platform on CI if you guys are interested in it compiling
  2. We need a different crate / workaround to handle the functionality bitvec is doing for us but on 32-bit too

IsaacWoods avatar Feb 09 '23 23:02 IsaacWoods

We definitely need to support 32 bit, i686 is one of Redox's supported architectures. It looks to me like the use of BitStore is just an optimization, although I did not confirm that. I was able to use conditional compilation to avoid the compilation error, (only use the bitvec optimization for fields of 32 bits or less when on x86) but I don't have a good way of testing that my implementation functions correctly.

rw-vanc avatar Feb 09 '23 23:02 rw-vanc

Please prioritize this if you can, we are trying to port to v86 in-browser boot, and it requires a 32-bit executable.

rw-vanc avatar Mar 02 '23 19:03 rw-vanc

Temporary hack is now merged and published as aml v0.16.3 - this will be fixed more elegantly in the future but hopefully this should allow you to move forward in the meantime.

Leaving this open to track.

IsaacWoods avatar Mar 03 '23 12:03 IsaacWoods

I can confirm it is fixed, if you want to leave it open I will

jackpot51 avatar Mar 05 '23 15:03 jackpot51