]> git.lizzy.rs Git - rust.git/blob - tests/ui/lub-glb/old-lub-glb-object.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / 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(x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, y: &dyn for<'a> Foo<&'a u8, &'a u8>) {
7     let z = match 22 {
8         0 => x,
9         _ => y,
10         //~^ ERROR mismatched types
11         //~| ERROR mismatched types
12     };
13 }
14
15 fn bar(x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, y: &dyn for<'a> Foo<&'a u8, &'a u8>) {
16     // Accepted with explicit case:
17     let z = match 22 {
18         0 => x as &dyn for<'a> Foo<&'a u8, &'a u8>,
19         _ => y,
20     };
21 }
22
23 fn main() {}