Skip to content

[NLL] ICE: unexpected region for local data with reference to closure #48697

Closed
@matthewjasper

Description

@matthewjasper

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)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.NLL-completeWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions