Closed daym closed 1 year ago
If I try to make it const fn
, I get
error[E0015]: cannot call non-const fn `<usize as std::convert::TryInto<u8>>::try_into` in constant functions
--> /home/dannym/src/Oxide/config/amd-apcb/src/ondisk.rs:4564:65
|
4564 | ... (size_of::<$struct_>() - 2).try_into().unwrap()
| ^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `impl_EntryCompatible` which comes from the expansion of the macro `crate::struct_variants_enum::collect_EntryCompatible_impl_into_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: cannot call non-const fn `std::result::Result::<u8, TryFromIntError>::unwrap` in constant functions
--> /home/dannym/src/Oxide/config/amd-apcb/src/ondisk.rs:4564:76
|
4564 | ... (size_of::<$struct_>() - 2).try_into().unwrap()
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `impl_EntryCompatible` which comes from the expansion of the macro `crate::struct_variants_enum::collect_EntryCompatible_impl_into_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
That's too bad.
Fixes https://github.com/oxidecomputer/amd-apcb/issues/82.