]> git.proxmox.com Git - rustc.git/blame - src/test/ui/lub-glb/old-lub-glb-hr.rs
New upstream version 1.45.0+dfsg1
[rustc.git] / src / test / ui / lub-glb / old-lub-glb-hr.rs
CommitLineData
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//
7// Whoops -- now that we reinstituted the leak-check, we get an error
8// again.
abe05a73
XL
9
10fn foo(
11 x: fn(&u8, &u8),
12 y: for<'a> fn(&'a u8, &'a u8),
13) {
9fa01778 14 let z = match 22 {
abe05a73 15 0 => x,
dfeec247 16 _ => y, //~ ERROR `match` arms have incompatible types
abe05a73
XL
17 };
18}
19
20fn 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 };
ea8adc8c 29}
abe05a73 30
223e47cc
LB
31fn main() {
32}