Open spernsteiner opened 1 year ago
use c2rust_bitfields::BitfieldStruct; #[derive(BitfieldStruct)] pub struct Foo { pub x: &'static i32, #[bitfield(name = "flags", ty = "u32", bits = "0..=7")] pub flags: [u8; 1], } #[derive(BitfieldStruct)] pub struct Bar<'a> { pub x: &'a i32, #[bitfield(name = "flags", ty = "u32", bits = "0..=7")] pub flags: [u8; 1], }
struct Foo works, struct Bar doesn't:
struct Foo
struct Bar
error[E0726]: implicit elided lifetime not allowed here --> src/main.rs:11:12 | 11 | pub struct Bar<'a> { | ^^^ expected lifetime parameter | = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | 11 | pub struct Bar<'_><'a> { | ++++
Presumably the weird error reporting is due to the Bar token being reused somewhere in the derive(BitfieldStruct) output (without the necessary lifetime arguments) while keeping its original span.
Bar
derive(BitfieldStruct)
struct Foo
works,struct Bar
doesn't:Presumably the weird error reporting is due to the
Bar
token being reused somewhere in thederive(BitfieldStruct)
output (without the necessary lifetime arguments) while keeping its original span.