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