rust/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
297 B
Rust
Raw Normal View History

2017-11-29 22:39:01 +00:00
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]
2017-11-29 22:39:01 +00:00
panic!("catch me for a dangling pointer!")
}
fn main() {
cplusplus_mode_exceptionally_unsafe(&mut None);
}