-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect stricter constraints on gats where clauses in impls vs trait
- Loading branch information
Showing
8 changed files
with
153 additions
and
50 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
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
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
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
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
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
14 changes: 14 additions & 0 deletions
14
src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs
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,14 @@ | ||
// check-fail | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
trait Foo { | ||
type Assoc<'a, 'b>; | ||
} | ||
impl Foo for () { | ||
type Assoc<'a, 'b> where 'a: 'b = (); | ||
//~^ `impl` associated type | ||
//~| impl has stricter | ||
} | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
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,21 @@ | ||
error: `impl` associated type signature for `Assoc` doesn't match `trait` associated type signature | ||
--> $DIR/missing-where-clause-on-trait.rs:9:5 | ||
| | ||
LL | type Assoc<'a, 'b>; | ||
| ------------------- expected | ||
... | ||
LL | type Assoc<'a, 'b> where 'a: 'b = (); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found | ||
|
||
error[E0276]: impl has stricter requirements than trait | ||
--> $DIR/missing-where-clause-on-trait.rs:9:5 | ||
| | ||
LL | type Assoc<'a, 'b>; | ||
| ------------------- definition of `Assoc` from trait | ||
... | ||
LL | type Assoc<'a, 'b> where 'a: 'b = (); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0276`. |