1 // Regression test for an ICE that occurred with the universes code:
3 // The signature of the closure `|_|` was being inferred to
4 // `exists<'r> fn(&'r u8)`. This should result in a type error since
5 // the signature `for<'r> fn(&'r u8)` is required. However, due to a
6 // bug in the type variable generalization code, the placeholder for
7 // `'r` was leaking out into the writeback phase, causing an ICE.
10 fn clone(&self) -> Box<dyn Fn(T)>;
13 impl<T, F: 'static> ClonableFn<T> for F
14 where F: Fn(T) + Clone {
15 fn clone(&self) -> Box<dyn Fn(T)> {
16 Box::new(self.clone())
20 struct Foo(Box<dyn for<'a> ClonableFn<&'a bool>>);
23 Foo(Box::new(|_| ())); //~ ERROR mismatched types