error[E0080]: evaluation panicked:
cannot pun: a byte that the target requires to be initialized is padding in the source.
This is at byte 1 of the target.
--> src/lib.rs
|
| const BY_VALUE: () = Self::require(Self::check(Need::VALUE));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `puns::Plan::<Direct, [u8; 4]>::BY_VALUE` failed inside this call
|
note: inside `puns::Plan::<Direct, [u8; 4]>::require`
--> src/lib.rs
|
| message.panic();
| ^^^^^^^^^^^^^^^
note: inside `puns::Message::panic`
--> $RUST/core/src/panic.rs
|
= note: the failure occurred here
|
::: src/lib.rs
|
| panic!("{}", unsafe { core::str::from_utf8_unchecked(this.bytes.split_at(this.len).0) })
| ---------------------------------------------------------------------------------------- in this macro invocation
note: erroneous constant encountered
--> src/lib.rs
|
| const { Plan::<S, D>::BY_VALUE };
| ^^^^^^^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> src/lib.rs
|
| const { Plan::<S, D>::BY_VALUE };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn pun::<Direct, [u8; 4]>`
--> tests/compile-fail/rust_enum_padding.rs:9:20
|
9 | let _: [u8; 4] = puns::pun(Direct::B(1));
| ^^^^^^^^^^^^^^^^^^^^^^^