-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error message found by NLL in librustc_codegen_llvm
#53221
Comments
Putting on the 2018 RC since this blocks #53172. |
Here is the code that is failing to compile: rust/src/librustc_codegen_llvm/back/archive.rs Lines 239 to 254 in fbb6275
|
What happens if this line is changed from rust/src/librustc_codegen_llvm/llvm/ffi.rs Line 1567 in b73535f
An |
…ted out by nll As explained by eddyb in rust-lang#53221, "An &ArchiveChild doesn't point into the archive itself, it points to an owned object that itself points to the archive, and LLVMRustArchiveMemberNew copies the ArchiveChild (whereas the current signature suggests it keeps the &ArchiveChild)."
I'll close this then. |
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:
https://play.rust-lang.org/?gist=6e22b15051f9a108d09f28a0b657f717&version=nightly&mode=debug&edition=2015
As far as I can tell, the
Some(child.raw)
is interpreted as aSome(&mut *child.raw)
, which borrows fromChild
-- but that borrow outlists the variablechild
. Andchild
has a dtor that frees memory. So something may be legitimately wrong here?You can solve this by adding a
take
method that clears theraw
field afterwards:https://play.rust-lang.org/?gist=64c20d529ad49d5871417c391a8dbcde&version=nightly&mode=debug&edition=2015
But I'm not sure what is the intention.
cc @eddyb @irinagpopa
The text was updated successfully, but these errors were encountered: