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