-
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)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
In #47596, @SimonSapin reported several NLL errors in dependencies of the servo crate. @lqd later minimized one of those errors into this example:
#![feature(nll)]
struct AutoGCRooter {
stackTop: *mut *mut AutoGCRooter,
}
impl AutoGCRooter {
unsafe fn add_to_root_stack(&mut self) {
*self.stackTop = self;
}
}
fn main() {}
which yields:
error[E0506]: cannot assign to `*self.stackTop` because it is borrowed
--> src/main.rs:9:9
|
9 | *self.stackTop = self;
| ^^^^^^^^^^^^^^^^^----
| | |
| | borrow of `*self.stackTop` occurs here
| assignment to borrowed `*self.stackTop` occurs here
error: aborting due to previous error
Removing feature(nll) makes the code work, so probably this is an NLL bug.
Metadata
Metadata
Assignees
Labels
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.