Skip to content

Commit 143e4b4

Browse files
authored
Rollup merge of #161199 - lsunsi:issue155802, r=ShoyuVanilla
Add regression test for non lifetime binders Closes #155802. I was able to reduce the code to generate the ICE even without the `#![feature(non_lifetime_binders)]` (using treereduce). I left it there as is on the issue because I thought it might change the example too much from it's origin. Question for reviewer, is it better to have a really really minimal example in this case? I could update the PR if it's needed.
2 parents d6998e2 + fd01bab commit 143e4b4

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/155802>.
2+
//@ check-fail
3+
4+
#![feature(non_lifetime_binders)]
5+
trait E<'e> {
6+
type As;
7+
}
8+
9+
trait F<'a>: for<F> E<'a> + for<'e> E<'e> {}
10+
//~^ ERROR type annotations needed: cannot satisfy `Self: E<'a>` [E0283]
11+
12+
struct G<'a, T>
13+
where
14+
T: F<'a, As: E<'a>>,
15+
//~^ ERROR type annotations needed: cannot satisfy `T: E<'a>` [E0283]
16+
//~| ERROR ambiguous associated type `As` in bounds of `F` [E0221]
17+
{
18+
x: &'a T,
19+
}
20+
21+
fn main() {}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
error[E0283]: type annotations needed: cannot satisfy `Self: E<'a>`
2+
--> $DIR/expected-region-found-kind.rs:9:14
3+
|
4+
LL | trait F<'a>: for<F> E<'a> + for<'e> E<'e> {}
5+
| ^^^^^^^^^^^^
6+
|
7+
note: multiple `impl`s or `where` clauses satisfying `Self: E<'a>` found
8+
--> $DIR/expected-region-found-kind.rs:9:14
9+
|
10+
LL | trait F<'a>: for<F> E<'a> + for<'e> E<'e> {}
11+
| ^^^^^^^^^^^^ ^^^^^^^^^^^^^
12+
13+
error[E0221]: ambiguous associated type `As` in bounds of `F`
14+
--> $DIR/expected-region-found-kind.rs:14:14
15+
|
16+
LL | type As;
17+
| -------
18+
| |
19+
| ambiguous `As` from `for<'e> E<'e>`
20+
| ambiguous `As` from `E<'a>`
21+
...
22+
LL | T: F<'a, As: E<'a>>,
23+
| ^^^^^^^^^ ambiguous associated type `As`
24+
25+
error[E0283]: type annotations needed: cannot satisfy `T: E<'a>`
26+
--> $DIR/expected-region-found-kind.rs:14:8
27+
|
28+
LL | T: F<'a, As: E<'a>>,
29+
| ^^^^^^^^^^^^^^^^
30+
|
31+
note: multiple `impl`s or `where` clauses satisfying `T: E<'a>` found
32+
--> $DIR/expected-region-found-kind.rs:14:8
33+
|
34+
LL | T: F<'a, As: E<'a>>,
35+
| ^^^^^^^^^^^^^^^^
36+
note: required by a bound in `F`
37+
--> $DIR/expected-region-found-kind.rs:9:14
38+
|
39+
LL | trait F<'a>: for<F> E<'a> + for<'e> E<'e> {}
40+
| ^^^^^^^^^^^^ required by this bound in `F`
41+
42+
error: aborting due to 3 previous errors
43+
44+
Some errors have detailed explanations: E0221, E0283.
45+
For more information about an error, try `rustc --explain E0221`.

0 commit comments

Comments
 (0)