1 // Test that Fn-family traits with lifetime parameters shouldn't compile and
2 // we suggest the usage of higher-rank trait bounds instead.
4 fn fa(_: impl Fn<'a>(&'a str) -> bool) {}
5 //~^ ERROR `Fn` traits cannot take lifetime parameters
7 fn fb(_: impl FnMut<'a, 'b>(&'a str, &'b str) -> bool) {}
8 //~^ ERROR `Fn` traits cannot take lifetime parameters
10 fn fc(_: impl std::fmt::Display + FnOnce<'a>(&'a str) -> bool + std::fmt::Debug) {}
11 //~^ ERROR `Fn` traits cannot take lifetime parameters
13 use std::ops::Fn as AliasedFn;
14 fn fd(_: impl AliasedFn<'a>(&'a str) -> bool) {}
15 //~^ ERROR `Fn` traits cannot take lifetime parameters
17 fn fe<F>(_: F) where F: Fn<'a>(&'a str) -> bool {}
18 //~^ ERROR `Fn` traits cannot take lifetime parameters