]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #104531 - ohno418:recover-fn-traits-with-lifetime-params, r=estebank
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 29 Dec 2022 17:24:29 +0000 (18:24 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Dec 2022 17:24:29 +0000 (18:24 +0100)
commit81c2b7280fd78b0bc780f382c9cf12ace244e3dc
tree0e16d32a9bce04b2184771790f7709e053f2d169
parent29d76cc6f5064e393440019198328b4424302633
parente5281c389d5bffabaa0a9762314808fb6c2803a3
Rollup merge of #104531 - ohno418:recover-fn-traits-with-lifetime-params, r=estebank

Provide a better error and a suggestion for `Fn` traits with lifetime params

Given `Fn`-family traits with lifetime params in trait bounds like `fn f(_: impl Fn<'a>(&'a str) -> bool)`, we currently produce many unhelpful errors.

This PR allows these situations to suggest simply using Higher-Rank Trait Bounds like `for<'a> Fn(&'a str) -> bool`.

Fixes https://github.com/rust-lang/rust/issues/103490.