Merge remote-tracking branch 'origin/master' into rustup
This commit is contained in:
commit
233516b54d
9
tests/compile-fail/ptr_offset_int_plus_ptr.rs
Normal file
9
tests/compile-fail/ptr_offset_int_plus_ptr.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// error-pattern: pointer value as raw bytes
|
||||
|
||||
fn main() {
|
||||
let ptr = Box::into_raw(Box::new(0u32));
|
||||
// Can't start with an integer pointer and get to something usable
|
||||
unsafe {
|
||||
let _ = (1 as *mut u8).offset(ptr as isize);
|
||||
}
|
||||
}
|
8
tests/compile-fail/ptr_wrapping_offset_int_plus_ptr.rs
Normal file
8
tests/compile-fail/ptr_wrapping_offset_int_plus_ptr.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// error-pattern: pointer value as raw bytes
|
||||
|
||||
fn main() {
|
||||
let ptr = Box::into_raw(Box::new(0u32));
|
||||
// Can't start with an integer pointer and get to something usable
|
||||
let ptr = (1 as *mut u8).wrapping_offset(ptr as isize);
|
||||
let _ = unsafe { *ptr };
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user