2 // This is a regression test for the ICE from issue #10846.
4 // The original issue causing the ICE: the LUB-computations during
5 // type inference were encountering late-bound lifetimes, and
6 // asserting that such lifetimes should have already been substituted
7 // with a concrete lifetime.
9 // However, those encounters were occurring within the lexical scope
10 // of the binding for the late-bound lifetime; that is, the late-bound
11 // lifetimes were perfectly valid. The core problem was that the type
12 // folding code was over-zealously passing back all lifetimes when
13 // doing region-folding, when really all clients of the region-folding
14 // case only want to see FREE lifetime variables, not bound ones.
16 // pretty-expanded FIXME #23616
20 fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<dyn for<'a> FnMut(&'a isize)>) {}
21 test(Some(Box::new(|_f: Box<dyn for<'a> FnMut(&'a isize)>| {})));
24 // The code below is shorthand for the code above (and more likely
25 // to represent what one encounters in practice).
27 fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<dyn FnMut(& isize)>) {}
28 test(Some(Box::new(|_f: Box<dyn FnMut(& isize)>| {})));