Skip to content

implied bounds: lifetime equality lost after normalization #106569

Open
@aliemjay

Description

@aliemjay

This doesn't compile although it should

struct Equal<'a, 'b>(&'a &'b (), &'b &'a ()); // implies 'a == 'b
trait Trait { type Ty; }
impl<'x> Trait for Equal<'x, 'x> { type Ty = (); }
fn test<'a, 'b>(_: (<Equal<'a, 'b> as Trait>::Ty, Equal<'a, 'b>)) {}
//~^ ERROR lifetime may not live long enough

It compiles with this trivial change:

- fn test<'a, 'b>(_: (<Equal<'a, 'b> as Trait>::Ty, Equal<'a, 'b>)) {}
+ fn test<'a, 'b>(_: <Equal<'a, 'b> as Trait>::Ty, _: Equal<'a, 'b>) {}

@rustbot label C-bug T-types A-implied-bounds

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-implied-boundsArea: Implied bounds / inferred outlives-boundsC-bugCategory: This is a bug.S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions