-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.
fixes #122714
- Loading branch information
Showing
5 changed files
with
129 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
8 changes: 8 additions & 0 deletions
8
tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.fixed
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,8 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(dead_code)] | ||
|
||
trait Trait<T> | ||
where for<'a, 'b> T: Trait<T> + 'b { } //~ ERROR use of undeclared lifetime name `'b` | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.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,8 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(dead_code)] | ||
|
||
trait Trait<T> | ||
where T: for<'a> Trait<T> + 'b { } //~ ERROR use of undeclared lifetime name `'b` | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.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,16 @@ | ||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:6:31 | ||
| | ||
LL | where T: for<'a> Trait<T> + 'b { } | ||
| ^^ undeclared lifetime | ||
| | ||
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html | ||
help: consider making the bound lifetime-generic with a new `'b` lifetime | ||
| | ||
LL - where T: for<'a> Trait<T> + 'b { } | ||
LL + where for<'a, 'b> T: Trait<T> + 'b { } | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0261`. |