remove memory leak from run-pass test

This commit is contained in:
Oliver Schneider
2017-02-14 16:55:30 +01:00
parent 529efc51e8
commit c4c9ff8d3f
+4 -1
View File
@@ -3,7 +3,10 @@ fn option_box_deref() -> i32 {
let val = Some(Box::new(42));
unsafe {
let ptr: *const i32 = std::mem::transmute::<Option<Box<i32>>, *const i32>(val);
*ptr
let ret = *ptr;
// unleak memory
std::mem::transmute::<*const i32, Option<Box<i32>>>(ptr);
ret
}
}