-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #84485 - marmeladema:trait-tests, r=jackh726
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// check-pass | ||
|
||
#![feature(associated_type_bounds)] | ||
|
||
trait A<'a, 'b> {} | ||
|
||
trait B<'a, 'b, 'c> {} | ||
|
||
fn err<'u, 'a, F>() | ||
where | ||
for<'b> F: Iterator<Item: for<'c> B<'a, 'b, 'c> + for<'c> A<'a, 'c>>, | ||
{ | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#![feature(associated_type_bounds)] | ||
|
||
trait TraitA<'a> { | ||
type AsA; | ||
} | ||
|
||
trait TraitB<'a, 'b> { | ||
type AsB; | ||
} | ||
|
||
trait TraitC<'a, 'b, 'c> {} | ||
|
||
struct X; | ||
|
||
impl<'a, 'b, 'c> TraitC<'a, 'b, 'c> for X {} | ||
|
||
struct Y; | ||
|
||
impl<'a, 'b> TraitB<'a, 'b> for Y { | ||
type AsB = X; | ||
} | ||
|
||
struct Z; | ||
|
||
impl<'a> TraitA<'a> for Z { | ||
type AsA = Y; | ||
} | ||
|
||
fn foo<T>() | ||
where | ||
for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>, | ||
{ | ||
} | ||
|
||
fn main() { | ||
foo::<Z>(); | ||
//~^ ERROR: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied | ||
//~| 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error[E0277]: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied | ||
--> $DIR/issue-83017.rs:36:5 | ||
| | ||
LL | fn foo<T>() | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>, | ||
| ------------------------------------------------------- required by this bound in `foo` | ||
... | ||
LL | foo::<Z>(); | ||
| ^^^^^^^^ the trait `for<'a, 'b> TraitB<'a, 'b>` is not implemented for `<Z as TraitA<'a>>::AsA` | ||
|
||
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 | ||
--> $DIR/issue-83017.rs:36:5 | ||
| | ||
LL | fn foo<T>() | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>, | ||
| -------------------------- required by this bound in `foo` | ||
... | ||
LL | foo::<Z>(); | ||
| ^^^^^^^^ the trait `for<'a, 'b, 'c> TraitC<'a, 'b, 'c>` is not implemented for `<<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |