]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
Rollup merge of #106570 - Xaeroxe:div-duration-tests, r=JohnTitor
[rust.git] / tests / ui / borrowck / borrowck-local-borrow-with-panic-outlives-fn.rs
1 fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
2     let mut z = (0, 0);
3     *x = Some(&mut z.1);
4     //~^ ERROR `z.1` does not live long enough [E0597]
5     panic!("catch me for a dangling pointer!")
6 }
7
8 fn main() {
9     cplusplus_mode_exceptionally_unsafe(&mut None);
10 }