The implementation impl Follow for bool is defined here and ends up calling read_scalar_at::<bool>(...). read_scalar_at (defined here) is for all intents and purposes a transmute and therefore given a byte that is not exactly 0 or 1 will produce a value of bool that has an invalid underlying bit pattern. That is UB in Rust. Invoking it is as easy as
or something along the lines.
The implementation
impl Follow for boolis defined here and ends up callingread_scalar_at::<bool>(...).read_scalar_at(defined here) is for all intents and purposes atransmuteand therefore given a byte that is not exactly0or1will produce a value ofboolthat has an invalid underlying bit pattern. That is UB in Rust. Invoking it is as easy asor something along the lines.