Skip to content

Commit 8f41de5

Browse files
committed
Add test for issue #83017
1 parent 9a35232 commit 8f41de5

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#![feature(associated_type_bounds)]
2+
3+
trait TraitA<'a> {
4+
type AsA;
5+
}
6+
7+
trait TraitB<'a, 'b> {
8+
type AsB;
9+
}
10+
11+
trait TraitC<'a, 'b, 'c> {}
12+
13+
struct X;
14+
15+
impl<'a, 'b, 'c> TraitC<'a, 'b, 'c> for X {}
16+
17+
struct Y;
18+
19+
impl<'a, 'b> TraitB<'a, 'b> for Y {
20+
type AsB = X;
21+
}
22+
23+
struct Z;
24+
25+
impl<'a> TraitA<'a> for Z {
26+
type AsA = Y;
27+
}
28+
29+
fn foo<T>()
30+
where
31+
for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
32+
{
33+
}
34+
35+
fn main() {
36+
foo::<Z>();
37+
//~^ ERROR: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied
38+
//~| ERROR: the trait bound `for<'a, 'b, 'c> <<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB: TraitC<'a, 'b, 'c>` is not satisfied
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0277]: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied
2+
--> $DIR/issue-83017.rs:36:5
3+
|
4+
LL | fn foo<T>()
5+
| --- required by a bound in this
6+
LL | where
7+
LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
8+
| ------------------------------------------------------- required by this bound in `foo`
9+
...
10+
LL | foo::<Z>();
11+
| ^^^^^^^^ the trait `for<'a, 'b> TraitB<'a, 'b>` is not implemented for `<Z as TraitA<'a>>::AsA`
12+
13+
error[E0277]: the trait bound `for<'a, 'b, 'c> <<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB: TraitC<'a, 'b, 'c>` is not satisfied
14+
--> $DIR/issue-83017.rs:36:5
15+
|
16+
LL | fn foo<T>()
17+
| --- required by a bound in this
18+
LL | where
19+
LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
20+
| -------------------------- required by this bound in `foo`
21+
...
22+
LL | foo::<Z>();
23+
| ^^^^^^^^ the trait `for<'a, 'b, 'c> TraitC<'a, 'b, 'c>` is not implemented for `<<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB`
24+
25+
error: aborting due to 2 previous errors
26+
27+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)