summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
blob: ffb2da280232f872def5ea98152e09a9ed72d773 (plain)
1
2
3
4
5
6
7
8
9
10
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);
}