Closed
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.