]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/mir_check_cast_unsafe_fn.rs
New upstream version 1.63.0+dfsg1
[rustc.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() {}