1 use bytemuck::TransparentWrapper;
2 
3 #[repr(transparent)]
4 struct Wrap(Box<u32>);
5 
6 // SAFETY: it's #[repr(transparent)]
7 unsafe impl TransparentWrapper<Box<u32>> for Wrap {}
8 
main()9 fn main() {
10   let value = Box::new(5);
11   // This used to duplicate the wrapped value, creating a double free :(
12   Wrap::wrap(value);
13 }
14