]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lub-glb/old-lub-glb-object.rs
partially revert 904a0bde93f0348f69914ee90b1f8b6e4e0d7cbc
[rust.git] / src / test / ui / lub-glb / old-lub-glb-object.rs
1 // Test that we give a note when the old LUB/GLB algorithm would have
2 // succeeded but the new code (which is stricter) gives an error.
3
4 trait Foo<T, U> { }
5
6 fn foo(
7     x: &for<'a, 'b> Foo<&'a u8, &'b u8>,
8     y: &for<'a> Foo<&'a u8, &'a u8>,
9 ) {
10     let z = match 22 {
11         0 => x,
12         _ => y, //~ ERROR match arms have incompatible types
13     };
14 }
15
16 fn bar(
17     x: &for<'a, 'b> Foo<&'a u8, &'b u8>,
18     y: &for<'a> Foo<&'a u8, &'a u8>,
19 ) {
20     // Accepted with explicit case:
21     let z = match 22 {
22         0 => x as &for<'a> Foo<&'a u8, &'a u8>,
23         _ => y,
24     };
25 }
26
27 fn main() {
28 }