mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
982b49494e
This is to make the diff when stabilizing it easier to review.
29 lines
464 B
Rust
29 lines
464 B
Rust
// Verify that unreachable code undergoes unsafety checks.
|
|
|
|
fn main() {
|
|
return;
|
|
*(1 as *mut u32) = 42;
|
|
//~^ ERROR dereference of raw pointer is unsafe
|
|
}
|
|
|
|
fn panic() -> ! {
|
|
panic!();
|
|
}
|
|
|
|
fn f(a: *mut u32) {
|
|
panic();
|
|
*a = 1;
|
|
//~^ ERROR dereference of raw pointer is unsafe
|
|
}
|
|
|
|
enum Void {}
|
|
|
|
fn uninhabited() -> Void {
|
|
panic!();
|
|
}
|
|
|
|
fn g(b: *mut u32) {
|
|
uninhabited();
|
|
*b = 1;
|
|
//~^ ERROR dereference of raw pointer is unsafe
|
|
}
|