mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
11 lines
297 B
Rust
11 lines
297 B
Rust
fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
|
|
let mut z = (0, 0);
|
|
*x = Some(&mut z.1);
|
|
//~^ ERROR `z.1` does not live long enough [E0597]
|
|
panic!("catch me for a dangling pointer!")
|
|
}
|
|
|
|
fn main() {
|
|
cplusplus_mode_exceptionally_unsafe(&mut None);
|
|
}
|