- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)T-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.
Milestone
Description
Trying to port librustc_codegen_llvm to use NLL (cc #53172) yields these errors:
https://gist.github.com/memoryruins/14a2aad7fc85d0429ae9e4240ec0dacb
The error seem legitimate. I reduced the pattern in question to this test case:
As far as I can tell, the Some(child.raw) is interpreted as a Some(&mut *child.raw), which borrows from Child -- but that borrow outlists the variable child. And child has a dtor that frees memory. So something may be legitimately wrong here?
You can solve this by adding a take method that clears the raw field afterwards:
But I'm not sure what is the intention.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)T-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.