Robbepop / modular-bitfield

Macro to generate bitfields for structs that allow for modular use of enums.
Apache License 2.0
155 stars 40 forks source link

#[bitfield] on empty struct causes compilation error #104

Open chabapok opened 5 months ago

chabapok commented 5 months ago

Some other macros may produce empty structs. Thus, having a #[bitfield] above an empty struct should not be considered as error. So, let's look to the next code:

#[bitfield]
struct Foo {

}

And next error:

error[E0080]: evaluation of constant value failed
 --> src/main.rs:4:1
  |
4 | struct Foo {
  | ^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow