make sure that 'identity casting' works
This commit is contained in:
parent
b1acc130bb
commit
fbc00ddc95
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue