File tree Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#![ allow( invalid_value) ]
22
33fn main ( ) {
4- let _b: fn ( ) = unsafe { std:: mem:: transmute ( 0usize ) } ; //~ ERROR encountered a potentially null function pointer
4+ let _b: fn ( ) = unsafe { std:: mem:: transmute ( 0usize ) } ; //~ ERROR encountered a null function pointer
55}
Original file line number Diff line number Diff line change @@ -62,9 +62,10 @@ fn main() {
6262 // Any non-null value is okay for function pointers.
6363 unsafe {
6464 let _x: fn ( ) = mem:: transmute ( 1usize ) ;
65- let mut b = Box :: new ( 42 ) ;
66- let ptr = & mut * b as * mut _ ;
65+ let mut b = Box :: new ( 42u8 ) ;
66+ let ptr = & mut * b as * mut u8 ;
6767 drop ( b) ;
6868 let _x: fn ( ) = mem:: transmute ( ptr) ;
69+ let _x: fn ( ) = mem:: transmute ( ptr. wrapping_offset ( 1 ) ) ;
6970 }
7071}
You can’t perform that action at this time.
0 commit comments