1 #![feature(fn_traits, unboxed_closures)]
2 
test<F: for<'x> FnOnce<(&'x str,)>>(_: F)3 fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
4 
5 struct Compose<F, G>(F, G);
6 impl<T, F, G> FnOnce<(T,)> for Compose<F, G>
7 where
8     F: FnOnce<(T,)>,
9     G: FnOnce<(F::Output,)>,
10 {
11     type Output = G::Output;
call_once(self, (x,): (T,)) -> G::Output12     extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output {
13         (self.1)((self.0)(x))
14     }
15 }
16 
bad<T>(f: fn(&'static str) -> T)17 fn bad<T>(f: fn(&'static str) -> T) {
18     test(Compose(f, |_| {}));
19     //~^ ERROR: implementation of `FnOnce` is not general enough
20 }
21 
main()22 fn main() {}
23