Auto merge of #89345 - jackh726:89333, r=estebank
Don't lose binders when printing trait bound suggestion Fixes #89333
This commit is contained in:
commit
2801a770ce
3 changed files with 42 additions and 16 deletions
11
src/test/ui/suggestions/issue-89333.rs
Normal file
11
src/test/ui/suggestions/issue-89333.rs
Normal file
|
|
@ -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 {}
|
||||
15
src/test/ui/suggestions/issue-89333.stderr
Normal file
15
src/test/ui/suggestions/issue-89333.stderr
Normal file
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue