-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-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. @Aaron1011 later minimized one of those errors into this example:
#![feature(nll)]
struct MyStruct<'a> {
field: &'a mut (),
field2: WithDrop
}
struct WithDrop;
impl Drop for WithDrop {
fn drop(&mut self) {}
}
impl<'a> MyStruct<'a> {
fn consume(self) -> &'a mut () { self.field }
}
fn main() {}
which yields:
error[E0597]: `*self.field` does not live long enough
--> src/main.rs:18:38
|
18 | fn consume(self) -> &'a mut () { self.field }
| ^^^^^^^^^^ - borrowed value only lives until here
| |
| borrowed value does not live long enough
|
= note: borrowed value must be valid for lifetime '_#3r...
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)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-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.