-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-soundWorking towards the "invalid code does not compile" goalWorking towards the "invalid code does not compile" goalT-langRelevant to the language teamRelevant to the language team
Milestone
Description
The following code compiles with NLL currently
fn main() {
let x = {
let z = 0;
&z
};
}
because it's equivalent to:
fn main() {
let x;
{
let z = 0;
x = &z
};
}
However, any further use of x will result in a "z
does not live long enough" warning. Should there be some read of x after the rest of the let is done to ensure that this doesn't happen?
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-soundWorking towards the "invalid code does not compile" goalWorking towards the "invalid code does not compile" goalT-langRelevant to the language teamRelevant to the language team