error[E0080]: evaluation panicked:
cannot pun: the source or the target holds a self-relative pointer, which a `&mut` would let safe code overwrite, swap or move: a pointer is only read.
Edit the value where it is, with what the crate that declares the pointer gives.
--> src/lib.rs
|
| Message::new(Self::NOT_MUTABLE).panic();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `puns::Plan::<relative::Opt<u32>, [u8; 4]>::BY_MUT` failed inside this call
|
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_MUT };
| ^^^^^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> src/lib.rs
|
| const { Plan::<S, D>::BY_MUT };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn pun_mut::<Opt<u32>, [u8; 4]>`
--> tests/compile-fail/mut_pointer_to_bytes.rs:9:29
|
9 | let bytes: &mut [u8; 4] = puns::pun_mut(&mut none);
| ^^^^^^^^^^^^^^^^^^^^^^^^