Skip to content

ICE when default method references associated type that can't be normalized #23485

Closed
@nikomatsakis

Description

@nikomatsakis

This trait causes an ICE when implemented and casted appropriately (from #23300):

trait Iterator {
    type Item;

    fn next(&mut self) -> Option<Self::Item>;

    fn cloned(self) -> Cloned<Self> where
        Self: Sized,
        Self::Item: Deref,
        <Self::Item as Deref>::Target: Clone,
    {
        Cloned { it: self }
    }
}

I'll attach the full test in the PR, it's a pain for me to cut-and-paste it right now :)

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