modular-bitfield icon indicating copy to clipboard operation
modular-bitfield copied to clipboard

#[bitfield] on empty struct causes compilation error

Open chabapok opened this issue 1 year ago • 0 comments

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

chabapok avatar Jan 16 '24 15:01 chabapok