make sure that 'identity casting' works

This commit is contained in:
Ralf Jung 2017-06-22 22:56:49 -07:00
parent b1acc130bb
commit fbc00ddc95

View file

@ -13,7 +13,7 @@ fn main() {
{ // ptr-int-ptr
let x = 13;
let mut y = &x as *const _ as usize;
let mut y = &x as &_ as *const _ as usize;
y += 13;
y -= 13;
let y = y as *const _;
@ -22,7 +22,7 @@ fn main() {
{ // fnptr-int-fnptr
let x : fn() -> i32 = f;
let y : *mut u8 = unsafe { mem::transmute(x) };
let y : *mut u8 = unsafe { mem::transmute(x as fn() -> i32) };
let mut y = y as usize;
y += 13;
y -= 13;