1 // Test taking the LUB of two function types that are not equatable but where one is more
2 // general than the other. Test the case where the more general type (`x`) is the first
3 // match arm specifically.
5 // revisions: leak noleak
6 //[noleak] compile-flags:-Zno-leak-check
8 fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) {
9 // The two types above are not equivalent. With the older LUB/GLB
10 // algorithm, this may have worked (I don't remember), but now it
11 // doesn't because we require equality.
15 //[leak]~^ ERROR `match` arms have incompatible types
16 //[noleak]~^^ ERROR mismatched types
20 fn foo_cast(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) {
21 // But we can *upcast* explicitly the type of `x` and figure
24 0 => x as for<'a> fn(&'a u8, &'a u8) -> &'a u8,