Closes #50.
Taking @pickx example to explain this again, but slightly different:
#[bitsize(1)]
#[derive(Default, FromBits)]
enum HasDefault {
A,
#[default]
B
}
#[bitsize(1)]
#[derive(Default, FromBits)]
struct Foo {
has_def: HasDefault
}
Here, HasDefault::default() would be 1.
But Foo is expanded like this:
#[derive(Default)]
struct Foo { value: u1 };
which will generate Foo { value: 0 } as the default, which is wrong.
Since it is completely wrong, we will now just silently change Default to be DefaultBits.
I feel like DebugBits should do the same. Or not abort.
You either want deep debugging with DebugBits or just want some number telling you the internal state, which Debug would still do.
Closes #50. Taking @pickx example to explain this again, but slightly different:
Here,
HasDefault::default()
would be 1. ButFoo
is expanded like this:which will generate
Foo { value: 0 }
as the default, which is wrong. Since it is completely wrong, we will now just silently changeDefault
to beDefaultBits
.I feel like
DebugBits
should do the same. Or notabort
. You either want deep debugging withDebugBits
or just want some number telling you the internal state, whichDebug
would still do.