Closed dtolnay closed 3 years ago
@evgenykuzyakov Seems to be caused by the same fact of poor communication around safety of is_u8
as in https://github.com/near/borsh-rs/issues/18#issuecomment-799599593
Yeah, reimplementing is_u8
has to be marked unsafe.
Ideally we would not even export it, but I'm not sure how to implement it. Basically, is_u8
only for u8
type, but Rust is not very flexible.
I think that fix is still wrong. :frowning_face: I filed https://github.com/near/borsh-rs/issues/24 to follow up. A function/method marked unsafe exclusively means that it is unsafe to call, not unsafe to implement.
The following safe code exhibits UB by reading and dumping out uninitialized memory.