mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
bug: transmute::<*const T, Option<Box<T>>>(..)
This commit is contained in:
committed by
Oliver 'ker' Schneider
parent
feca81307f
commit
5ea57ccbcd
@@ -0,0 +1,13 @@
|
||||
#![feature(custom_attribute)]
|
||||
#![allow(dead_code, unused_attributes)]
|
||||
|
||||
#[miri_run]
|
||||
fn option_box_deref() -> i32 {
|
||||
let val = Some(Box::new(42));
|
||||
unsafe {
|
||||
let ptr: *const i32 = std::mem::transmute(val); //~ ERROR: pointer offset outside bounds of allocation
|
||||
*ptr
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Reference in New Issue
Block a user