Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
13
third-party/vendor/bytemuck/tests/wrapper_forgets.rs
vendored
Normal file
13
third-party/vendor/bytemuck/tests/wrapper_forgets.rs
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use bytemuck::TransparentWrapper;
|
||||
|
||||
#[repr(transparent)]
|
||||
struct Wrap(Box<u32>);
|
||||
|
||||
// SAFETY: it's #[repr(transparent)]
|
||||
unsafe impl TransparentWrapper<Box<u32>> for Wrap {}
|
||||
|
||||
fn main() {
|
||||
let value = Box::new(5);
|
||||
// This used to duplicate the wrapped value, creating a double free :(
|
||||
Wrap::wrap(value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue