Skip to content

ICE with associated type #21637

Closed
Closed
@Kimundi

Description

@Kimundi

Reproduced by

pub trait Pattern<'a>: Sized {
    type Matcher;
}

struct CharEqMatcher<'a, C>(C, &'a str);

impl<'a, C> Pattern<'a> for C {
    type Matcher = CharEqMatcher<'a, C>;
}

pub struct MatchIndices<'a, P: Pattern<'a>>(P::Matcher);

impl<'a, P: Pattern<'a>> Clone for MatchIndices<'a, P> where P::Matcher: Clone {
    fn clone(&self) -> Self {
        MatchIndices(Clone::clone(&self.0))
    }
}

fn main() {}
error: internal compiler error: Where clause 
`Binder(TraitRef(<P as pattern::Pattern<'a>>::Matcher, core::marker::Sized))` was applicable to
`Obligation(predicate=Binder(TraitPredicate(TraitRef(P, core::marker::Sized))),depth=62)`
but now is not

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions