- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code gives an internal compiler error. It is a normal compiler error without NLL.
#![feature(nll)]
fn foo(x: &i32) -> &i32 {
    let z = 4;
    let f = &|y| { y };
    let k = f(&z);
    f(x)
}
fn main() {}error: internal compiler error: unexpected region for local data ReFree(DefId(0/0:3 ~ example[8787]::foo[0]), BrAnon(0))
 --> <source>:9:17
  |
6 |     let k = f(&z);
  |                ^
error: aborting due to previous error
Compiler returned: 101
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.