Skip to content

Confusing/inconsistent lifetime error with == on types with different covariant lifetimes #45534

Closed
@jseyfried

Description

@jseyfried
#[derive(Eq, PartialEq)]
struct S<'a>(&'a ());

fn f<'a, 'b>(a: S<'a>, b: S<'b>) {
    a.eq(&b); // This is OK
    a == b; // This errors that 'a cannot outlive 'b so that the expression is assignable
}

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