Skip to content

impl_header_lifetime_elision errors can mention in-band lifetimes when that feature is disabled #54456

Closed
@scottmcm

Description

@scottmcm

https://play.rust-lang.org/?gist=63df9129c4f3d2c76f2620acc38d0e57&version=nightly&edition=2018

fn foo<'a>(x: &str, y: &'a str) {}

trait Foo<T> {}
impl<'a> Foo<&str> for &'a str {}

The fn elision is totally fine, but the translation to an impl header gives

error[E0688]: cannot mix in-band and explicit lifetime definitions
 --> src/lib.rs:4:14
  |
4 | impl<'a> Foo<&str> for &'a str {}
  |      --      ^ in-band lifetime definition here
  |      |
  |      explicit lifetime definition here

This 1) shouldn't be an error, and 2) shouldn't mention "in-band lifetime"s even if it is.

cc impl_header_lifetime_elision tracking issue, #15872

(This feature is on-by-default in 2018, but not yet stable in 2015.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions