Skip to content

Commit 992ba80

Browse files
Add test for bad suggestion
1 parent 01d7841 commit 992ba80

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trait Foo {
2+
type T<'a1, 'b1>
3+
where
4+
'a1: 'b1;
5+
}
6+
7+
impl Foo for () {
8+
type T<'a2, 'b2> = () where 'b2: 'a2;
9+
//~^ ERROR impl has stricter requirements than trait
10+
}
11+
12+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0276]: impl has stricter requirements than trait
2+
--> $DIR/mismatched-where-clause-regions.rs:8:38
3+
|
4+
LL | type T<'a1, 'b1>
5+
| ---------------- definition of `T` from trait
6+
...
7+
LL | type T<'a2, 'b2> = () where 'b2: 'a2;
8+
| ^^^ impl has extra requirement `'b2: 'a2`
9+
|
10+
help: copy the `where` clause predicates from the trait
11+
|
12+
LL | type T<'a2, 'b2> = () where 'a2: 'b2;
13+
| ~~~~~~~~~~~~~~
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0276`.

0 commit comments

Comments
 (0)