]> git.lizzy.rs Git - rust.git/commitdiff
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)
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.


Trivial merge