2016-04-22 08:04:12 -05:00
|
|
|
#![feature(custom_attribute)]
|
|
|
|
#![allow(dead_code, unused_attributes)]
|
|
|
|
|
2016-04-30 02:04:17 -05:00
|
|
|
// This tests that the size of Option<Box<i32>> is the same as *const i32.
|
|
|
|
|
2016-04-22 08:04:12 -05:00
|
|
|
#[miri_run]
|
|
|
|
fn option_box_deref() -> i32 {
|
|
|
|
let val = Some(Box::new(42));
|
|
|
|
unsafe {
|
2016-04-30 02:04:17 -05:00
|
|
|
let ptr: *const i32 = std::mem::transmute::<Option<Box<i32>>, *const i32>(val);
|
2016-04-22 08:04:12 -05:00
|
|
|
*ptr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|