Skip to content

Commit c8e0a90

Browse files
committed
tests: cases where we now do the right thing but did not before
Fixes rust-lang#33684
1 parent d3c96ff commit c8e0a90

19 files changed

+137
-137
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
error[E0308]: mismatched types
1+
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
22
--> $DIR/hr-subtype.rs:39:26
33
|
44
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
5+
| ^^^^^^^^^^^
66
...
77
LL | / check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32,
88
LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) }
99
| |_________________________________________________________________________________________- in this macro invocation
1010
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>`
12-
found type `std::option::Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>`
11+
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:26), 'b) })...
12+
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:25), 'a) })...
13+
= note: ...so that the expression is assignable:
14+
expected std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>
15+
found std::option::Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>
1316

1417
error: aborting due to previous error
1518

16-
For more information about this error, try `rustc --explain E0308`.
19+
For more information about this error, try `rustc --explain E0495`.
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/hr-subtype.rs:39:26
1+
error: compilation successful
2+
--> $DIR/hr-subtype.rs:96:1
33
|
4-
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
6-
...
7-
LL | / check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32),
8-
LL | | for<'a> fn(&'a u32, &'a u32)) }
9-
| |__________________________________________________________________- in this macro invocation
10-
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32)>`
12-
found type `std::option::Option<for<'a> fn(&'a u32, &'a u32)>`
4+
LL | / fn main() {
5+
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
6+
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
7+
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
10+
LL | | }
11+
| |_^
1312

1413
error: aborting due to previous error
1514

16-
For more information about this error, try `rustc --explain E0308`.

src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: compilation successful
2-
--> $DIR/hr-subtype.rs:100:1
2+
--> $DIR/hr-subtype.rs:96:1
33
|
44
LL | / fn main() {
55
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
66
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
77
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8-
LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
9-
LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
1010
LL | | }
1111
| |_^
1212

src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: compilation successful
2-
--> $DIR/hr-subtype.rs:100:1
2+
--> $DIR/hr-subtype.rs:96:1
33
|
44
LL | / fn main() {
55
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
66
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
77
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8-
LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
9-
LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
1010
LL | | }
1111
| |_^
1212

src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@ error[E0308]: mismatched types
22
--> $DIR/hr-subtype.rs:39:26
33
|
44
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
5+
| ^^^^^^^^^^^ lifetime mismatch
66
...
77
LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32),
88
LL | | fn(&'x u32)) }
99
| |___________________________________________- in this macro invocation
1010
|
1111
= note: expected type `std::option::Option<for<'a> fn(&'a u32)>`
1212
found type `std::option::Option<fn(&'x u32)>`
13+
= note: lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:23), 'a) })...
14+
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 48:22
15+
--> $DIR/hr-subtype.rs:48:22
16+
|
17+
LL | fn supertype<'x,'y:'x,'z:'y>() {
18+
| ^^
19+
...
20+
LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32),
21+
LL | | fn(&'x u32)) }
22+
| |___________________________________________- in this macro invocation
1323

1424
error: aborting due to previous error
1525

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/hr-subtype.rs:39:26
1+
error: compilation successful
2+
--> $DIR/hr-subtype.rs:96:1
33
|
4-
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
6-
...
7-
LL | / check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>),
8-
LL | | for<'a> fn(Co<'a>, Co<'a>)) }
9-
| |______________________________________________________________________- in this macro invocation
10-
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>)>`
12-
found type `std::option::Option<for<'a> fn(Co<'a>, Co<'a>)>`
4+
LL | / fn main() {
5+
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
6+
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
7+
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
10+
LL | | }
11+
| |_^
1312

1413
error: aborting due to previous error
1514

16-
For more information about this error, try `rustc --explain E0308`.
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/hr-subtype.rs:39:26
1+
error: compilation successful
2+
--> $DIR/hr-subtype.rs:96:1
33
|
4-
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
6-
...
7-
LL | / check! { bound_co_a_co_b_ret_contra_a: (for<'a,'b> fn(Co<'a>, Co<'b>) -> Contra<'a>,
8-
LL | | for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>) }
9-
| |______________________________________________________________________________________- in this macro invocation
10-
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>) -> Contra<'a>>`
12-
found type `std::option::Option<for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>>`
4+
LL | / fn main() {
5+
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
6+
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
7+
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
10+
LL | | }
11+
| |_^
1312

1413
error: aborting due to previous error
1514

16-
For more information about this error, try `rustc --explain E0308`.

src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: compilation successful
2-
--> $DIR/hr-subtype.rs:100:1
2+
--> $DIR/hr-subtype.rs:96:1
33
|
44
LL | / fn main() {
55
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
66
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
77
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8-
LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
9-
LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
1010
LL | | }
1111
| |_^
1212

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/hr-subtype.rs:39:26
1+
error: compilation successful
2+
--> $DIR/hr-subtype.rs:96:1
33
|
4-
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
6-
...
7-
LL | / check! { bound_contra_a_contra_b_ret_co_a: (for<'a,'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>,
8-
LL | | for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>) }
9-
| |______________________________________________________________________________________________- in this macro invocation
10-
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>>`
12-
found type `std::option::Option<for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>>`
4+
LL | / fn main() {
5+
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
6+
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
7+
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
8+
... |
9+
LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful
10+
LL | | }
11+
| |_^
1312

1413
error: aborting due to previous error
1514

16-
For more information about this error, try `rustc --explain E0308`.
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
error[E0308]: mismatched types
1+
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
22
--> $DIR/hr-subtype.rs:39:26
33
|
44
LL | gimme::<$t1>(None::<$t2>);
5-
| ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
5+
| ^^^^^^^^^^^
66
...
77
LL | / check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>),
88
LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
99
| |__________________________________________________________________________- in this macro invocation
1010
|
11-
= note: expected type `std::option::Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
12-
found type `std::option::Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
11+
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:25), 'a) })...
12+
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:26), 'b) })...
13+
= note: ...so that the expression is assignable:
14+
expected std::option::Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>
15+
found std::option::Option<for<'a> fn(Inv<'a>, Inv<'a>)>
1316

1417
error: aborting due to previous error
1518

16-
For more information about this error, try `rustc --explain E0308`.
19+
For more information about this error, try `rustc --explain E0495`.

0 commit comments

Comments
 (0)