Skip to content

Commit 7efe03f

Browse files
committed
we now handle higher-ranked subtyping correctly
Fixes rust-lang#33684
1 parent fc98001 commit 7efe03f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/test/compile-fail/hr-subtype.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ macro_rules! check {
5252
//[bound_inv_a_b_vs_bound_inv_a]~^^^ ERROR mismatched types
5353
//[bound_a_b_ret_a_vs_bound_a_ret_a]~^^^^ ERROR mismatched types
5454
//[free_inv_x_vs_free_inv_y]~^^^^^ ERROR mismatched types
55-
//[bound_a_b_vs_bound_a]~^^^^^^ ERROR mismatched types
56-
//[bound_co_a_b_vs_bound_co_a]~^^^^^^^ ERROR mismatched types
57-
//[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^ ERROR mismatched types
58-
//[bound_co_a_co_b_ret_contra_a]~^^^^^^^^^ ERROR mismatched types
5955
}
6056
}
6157
}
@@ -113,4 +109,8 @@ fn main() {
113109
//[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
114110
//[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
115111
//[free_x_vs_free_x]~^^^^^ ERROR compilation successful
112+
//[bound_a_b_vs_bound_a]~^^^^^^ ERROR compilation successful
113+
//[bound_co_a_b_vs_bound_co_a]~^^^^^^^ ERROR compilation successful
114+
//[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^ ERROR compilation successful
115+
//[bound_co_a_co_b_ret_contra_a]~^^^^^^^^^ ERROR compilation successful
116116
}

src/test/compile-fail/regions-fn-subtyping-return-static.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ fn baz(x: &S) -> &S {
4747
fn supply_F() {
4848
want_F(foo);
4949

50-
// FIXME(#33684) -- this should be a subtype, but current alg. rejects it incorrectly
51-
want_F(bar); //~ ERROR E0308
50+
want_F(bar);
5251

5352
want_F(baz);
5453
}
@@ -58,9 +57,6 @@ fn supply_G() {
5857
want_G(bar);
5958
want_G(baz);
6059
//~^ ERROR mismatched types
61-
//~| expected type `for<'cx> fn(&'cx S) -> &'static S`
62-
//~| found type `for<'r> fn(&'r S) -> &'r S {baz}`
63-
//~| expected concrete lifetime, found bound lifetime parameter 'cx
6460
}
6561

6662
pub fn main() {

0 commit comments

Comments
 (0)