summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lub-glb/old-lub-glb-hr-eq.rs
blob: fbf4aee02045d5d0c442390c0cd1234f31fb74b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Test that we give a note when the old LUB/GLB algorithm would have
// succeeded but the new code (which requires equality) gives an
// error. However, now that we handle subtyping correctly, we no
// longer get an error, because we recognize these two types as
// equivalent!
//
// check-pass

fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) {
    // The two types above are actually equivalent. With the older
    // leak check, though, we didn't consider them as equivalent, and
    // hence we gave errors. But now we've fixed that.
    let z = match 22 {
        0 => x,
        _ => y,
    };
}

fn foo_cast(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) {
    let z = match 22 {
        // No error with an explicit cast:
        0 => x as for<'a> fn(&'a u8, &'a u8),
        _ => y,
    };
}

fn main() {}