]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs
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 fn foo(x
: for<'a
, 'b
> fn(&'a
u8, &'b
u8) -> &'a
u8, y
: for<'a
> fn(&'a
u8, &'a
u8) -> &'a
u8) {
6 // The two types above are not equivalent. With the older LUB/GLB
7 // algorithm, this may have worked (I don't remember), but now it
8 // doesn't because we require equality.
11 _
=> y
, //~ ERROR `match` arms have incompatible types
15 fn foo_cast(x
: for<'a
, 'b
> fn(&'a
u8, &'b
u8) -> &'a
u8, y
: for<'a
> fn(&'a
u8, &'a
u8) -> &'a
u8) {
16 // But we can *upcast* explicitly the type of `x` and figure
19 0 => x
as for<'a
> fn(&'a
u8, &'a
u8) -> &'a
u8,