summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/relate_tys/universe-violation.rs
blob: c5f9d4406e204153d49c65055937deb3255a39cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Test that the NLL `relate_tys` code correctly deduces that a
// function returning either argument CANNOT be upcast to one
// that returns always its first argument.
//
// compile-flags:-Zno-leak-check

fn make_it() -> fn(&'static u32) -> &'static u32 {
    panic!()
}

fn main() {
    let a: fn(_) -> _ = make_it();
    let b: fn(&u32) -> &u32 = a; //~ ERROR mismatched types [E0308]
    drop(a);
}