Skip to content

Matching of Self doesn't take lifetime parameters into account #15517

Closed
@pcwalton

Description

@pcwalton

The following code compiles:

struct Foo<'a,'b> {
    x: &'a int,
    y: &'b int,
}

trait Tr {
    fn foo(x: Self) {}
}

impl<'a,'b> Tr for Foo<'a,'b> {
    fn foo(x: Foo<'b,'a>) {} // <-- bad
}

fn main(){}

Nominating for 1.0, P-backcompat-lang. I may well just fix this along with #14022, since the solution is likely going to be similar to what @nikomatsakis pointed out, but I want to get it on the radar.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions