Skip to content

Weird interaction between higher-ranked lifetimes and associated type bounds #23481

Closed
@apasel422

Description

@apasel422

foo.rs:

pub trait Foo
where
    for<'a> &'a Self: Bar,
    for<'a> <&'a Self as Bar>::Xyz: Clone {}

pub trait Bar {
    type Xyz;
}

impl Foo for () {}

impl<'a> Bar for &'a () {
    type Xyz = usize;
}

Error from rustc 1.0.0-nightly (30e1f9a1c 2015-03-14) (built 2015-03-15)

foo.rs:12:1: 12:19 error: the trait `for<'a> core::clone::Clone` is not implemented for the type `<&'a () as Bar>::Xyz` [E0277]
foo.rs:12 impl Foo for () {}
          ^~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsA-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)A-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions