Skip to content

Do not hint to use elided '_ lifetimes in errors #52743

Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum

https://play.rust-lang.org/?gist=96fc205e5162ae48cb27063a22ea4518&version=nightly&mode=debug&edition=2015

#![feature(nll)]
#![feature(in_band_lifetimes)]

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() { }
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

error: aborting due to previous error

cc @davidtwco

Metadata

Metadata

Assignees

Labels

NLL-diagnosticsWorking towards the "diagnostic parity" goal

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions