-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-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.
Description
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![feature(impl_header_lifetime_elision)]
struct Foo<'a, 'b> {
x: &'a u32,
y: &'b u32,
}
struct Bar<'b> {
z: &'b u32
}
impl Foo<'_, '_> {
fn take_bar(&mut self, b: Bar<'_>) {
self.y = b.z
}
}
fn main() { }produces this confusing error:
error[E0621]: explicit lifetime required in the type of `b`
--> src/main.rs:15:9
|
14 | fn take_bar(&mut self, b: Bar<'_>) {
| - consider changing the type of `b` to `Bar<'_>`
15 | self.y = b.z
| ^^^^^^^^^^^^ lifetime `'_` required
I think the problem here is that the "nice region error" code is actually getting in the way of the NLL errors, which are better.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-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.