]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/mir_check_cast_unsafe_fn.rs
fix merge conflicts
[rust.git] / src / test / ui / nll / mir_check_cast_unsafe_fn.rs
1 // compile-flags: -Zborrowck=mir
2
3 #![allow(dead_code)]
4
5 fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
6     // Here the NLL checker must relate the types in `f` to the types
7     // in `g`. These are related via the `UnsafeFnPointer` cast.
8     let g: unsafe fn(_) -> _ = f;
9     unsafe { g(input) }
10     //~^ ERROR lifetime may not live long enough
11 }
12
13 fn main() {}