-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 #114146 - compiler-errors:dont-report-rpitit-name, r=…
…spastorino Skip reporting item name when checking RPITIT GAT's associated type bounds hold Doesn't really make sense to label an item that has a name that users can't really mention. Fixes #114145. Also fixes #113794. r? `@spastorino`
- Loading branch information
Showing
6 changed files
with
121 additions
and
8 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
11 changes: 11 additions & 0 deletions
11
tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.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,11 @@ | ||
// issue: 114146 | ||
|
||
#![feature(return_position_impl_trait_in_trait)] | ||
|
||
trait Foo { | ||
fn bar<'other: 'a>() -> impl Sized + 'a {} | ||
//~^ ERROR use of undeclared lifetime name `'a` | ||
//~| ERROR use of undeclared lifetime name `'a` | ||
} | ||
|
||
fn main() {} |
33 changes: 33 additions & 0 deletions
33
tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.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,33 @@ | ||
error[E0261]: use of undeclared lifetime name `'a` | ||
--> $DIR/bad-item-bound-within-rpitit-2.rs:6:20 | ||
| | ||
LL | fn bar<'other: 'a>() -> impl Sized + 'a {} | ||
| ^^ undeclared lifetime | ||
| | ||
help: consider introducing lifetime `'a` here | ||
| | ||
LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {} | ||
| +++ | ||
help: consider introducing lifetime `'a` here | ||
| | ||
LL | trait Foo<'a> { | ||
| ++++ | ||
|
||
error[E0261]: use of undeclared lifetime name `'a` | ||
--> $DIR/bad-item-bound-within-rpitit-2.rs:6:42 | ||
| | ||
LL | fn bar<'other: 'a>() -> impl Sized + 'a {} | ||
| ^^ undeclared lifetime | ||
| | ||
help: consider introducing lifetime `'a` here | ||
| | ||
LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {} | ||
| +++ | ||
help: consider introducing lifetime `'a` here | ||
| | ||
LL | trait Foo<'a> { | ||
| ++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0261`. |
25 changes: 25 additions & 0 deletions
25
tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.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,25 @@ | ||
// issue: 114145 | ||
|
||
#![feature(return_position_impl_trait_in_trait)] | ||
|
||
trait Iterable { | ||
type Item<'a> | ||
where | ||
Self: 'a; | ||
|
||
fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>; | ||
} | ||
|
||
impl<'a, I: 'a + Iterable> Iterable for &'a I { | ||
type Item<'b> = I::Item<'a> | ||
where | ||
'b: 'a; | ||
//~^ ERROR impl has stricter requirements than trait | ||
|
||
fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { | ||
//~^ ERROR the type `&'a I` does not fulfill the required lifetime | ||
(*self).iter() | ||
} | ||
} | ||
|
||
fn main() {} |
30 changes: 30 additions & 0 deletions
30
tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.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,30 @@ | ||
error[E0276]: impl has stricter requirements than trait | ||
--> $DIR/bad-item-bound-within-rpitit.rs:16:13 | ||
| | ||
LL | type Item<'a> | ||
| ------------- definition of `Item` from trait | ||
... | ||
LL | 'b: 'a; | ||
| ^^ impl has extra requirement `'b: 'a` | ||
| | ||
help: copy the `where` clause predicates from the trait | ||
| | ||
LL | where Self: 'b; | ||
| ~~~~~~~~~~~~~~ | ||
|
||
error[E0477]: the type `&'a I` does not fulfill the required lifetime | ||
--> $DIR/bad-item-bound-within-rpitit.rs:19:23 | ||
| | ||
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: type must outlive the anonymous lifetime as defined here | ||
--> $DIR/bad-item-bound-within-rpitit.rs:10:28 | ||
| | ||
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>; | ||
| ^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0276, E0477. | ||
For more information about an error, try `rustc --explain E0276`. |