]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lub-glb/old-lub-glb-hr.rs
bc7b787cd65ac3bff77e4b354bd08839731e2f3b
[rust.git] / src / test / ui / lub-glb / old-lub-glb-hr.rs
1 // Test that we give a note when the old LUB/GLB algorithm would have
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 //
7 // Whoops -- now that we reinstituted the leak-check, we get an error
8 // again.
9
10 fn foo(
11     x: fn(&u8, &u8),
12     y: for<'a> fn(&'a u8, &'a u8),
13 ) {
14     let z = match 22 {
15         0 => x,
16         _ => y, //~ ERROR `match` arms have incompatible types
17     };
18 }
19
20 fn bar(
21     x: fn(&u8, &u8),
22     y: for<'a> fn(&'a u8, &'a u8),
23 ) {
24     let z = match 22 {
25         // No error with an explicit cast:
26         0 => x as for<'a> fn(&'a u8, &'a u8),
27         _ => y,
28     };
29 }
30
31 fn main() {
32 }