-
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-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-langRelevant to the language teamRelevant to the language team
Milestone
Description
In an example like:
rust/src/test/ui/issue-40510-1.rs
Lines 14 to 20 in 59fa6bd
fn f() { | |
let mut x: Box<()> = Box::new(()); | |
|| { | |
&mut x | |
}; | |
} |
AST-borrowck accepts such code, but NLL will start rejecting it.
@nikomatsakis concluded in a comment back in April (#49824 (comment)) that similar code (or at least it looks similar to me) is in fact incorrect, and decided that NLL was correct in rejecting such cases.
This issue is just marking that this change in semantics has occurred, so that I can link to it from places like #52663
Known instances:
- NLL: unexpected "free region `` does not outlive" error #49824 (comment)
- https://github.com/rust-lang/rust/blob/59fa6bd6c14eebd213884da08a33639b4c848bb3/src/test/ui/issue-40510-1.rs
- https://github.com/rust-lang/rust/blob/59fa6bd6c14eebd213884da08a33639b4c848bb3/src/test/ui/issue-40510-3.rs
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-langRelevant to the language teamRelevant to the language team