forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#89345 - jackh726:89333, r=estebank
Don't lose binders when printing trait bound suggestion Fixes rust-lang#89333
- Loading branch information
Showing
3 changed files
with
42 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-fail | ||
// Ensure we don't error when emitting trait bound not satisfied when self type | ||
// has late bound var | ||
|
||
fn main() { | ||
test(&|| 0); //~ ERROR the trait bound | ||
} | ||
|
||
trait Trait {} | ||
|
||
fn test<T>(arg: &impl Fn() -> T) where for<'a> &'a T: Trait {} |
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 @@ | ||
error[E0277]: the trait bound `for<'a> &'a _: Trait` is not satisfied | ||
--> $DIR/issue-89333.rs:6:5 | ||
| | ||
LL | test(&|| 0); | ||
| ^^^^ the trait `for<'a> Trait` is not implemented for `&'a _` | ||
| | ||
note: required by a bound in `test` | ||
--> $DIR/issue-89333.rs:11:55 | ||
| | ||
LL | fn test<T>(arg: &impl Fn() -> T) where for<'a> &'a T: Trait {} | ||
| ^^^^^ required by this bound in `test` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |