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 1
1
#![ allow( invalid_value) ]
2
2
3
3
fn 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
5
5
}
Original file line number Diff line number Diff line change @@ -62,9 +62,10 @@ fn main() {
62
62
// Any non-null value is okay for function pointers.
63
63
unsafe {
64
64
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 ;
67
67
drop ( b) ;
68
68
let _x: fn ( ) = mem:: transmute ( ptr) ;
69
+ let _x: fn ( ) = mem:: transmute ( ptr. wrapping_offset ( 1 ) ) ;
69
70
}
70
71
}
You can’t perform that action at this time.
0 commit comments