]>
Commit | Line | Data |
---|---|---|
abe05a73 | 1 | // Test that we give a note when the old LUB/GLB algorithm would have |
0731742a XL |
2 | // succeeded but the new code (which requires equality) gives an |
3 | // error. However, now that we handle subtyping correctly, we no | |
4 | // longer get an error, because we recognize these two types as | |
5 | // equivalent! | |
6 | // | |
f035d41b | 7 | // check-pass |
abe05a73 | 8 | |
f035d41b XL |
9 | fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { |
10 | // The two types above are actually equivalent. With the older | |
11 | // leak check, though, we didn't consider them as equivalent, and | |
12 | // hence we gave errors. But now we've fixed that. | |
9fa01778 | 13 | let z = match 22 { |
abe05a73 | 14 | 0 => x, |
f035d41b | 15 | _ => y, |
abe05a73 XL |
16 | }; |
17 | } | |
18 | ||
f035d41b | 19 | fn foo_cast(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { |
abe05a73 XL |
20 | let z = match 22 { |
21 | // No error with an explicit cast: | |
22 | 0 => x as for<'a> fn(&'a u8, &'a u8), | |
23 | _ => y, | |
24 | }; | |
ea8adc8c | 25 | } |
abe05a73 | 26 | |
f035d41b | 27 | fn main() {} |