1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // This is a regression test for the ICE from issue #10846.
13 // The original issue causing the ICE: the LUB-computations during
14 // type inference were encountering late-bound lifetimes, and
15 // asserting that such lifetimes should have already been subsituted
16 // with a concrete lifetime.
18 // However, those encounters were occurring within the lexical scope
19 // of the binding for the late-bound lifetime; that is, the late-bound
20 // lifetimes were perfectly valid. The core problem was that the type
21 // folding code was over-zealously passing back all lifetimes when
22 // doing region-folding, when really all clients of the region-folding
23 // case only want to see FREE lifetime variables, not bound ones.
27 fn test(_x: Option<|f: <'a> |g: &'a int||>) {}
28 test(Some(|_f: <'a> |g: &'a int|| {}));
31 // The code below is shorthand for the code above (and more likely
32 // to represent what one encounters in practice).
34 fn test(_x: Option<|f: |g: & int||>) {}
35 test(Some(|_f: |g: & int|| {}));