Skip to content

Ambiguity in assemble_candidates_after_normalizing_self_ty causes coherence error #52

Closed
@compiler-errors

Description

@compiler-errors

This coherence failure...

pub(crate) trait Drive {}

trait DerefAndDrive {}

impl<T> Drive for T
where
    T: 'static,
    for<'a> &'a T: IntoIterator,
    for<'a> <&'a T as IntoIterator>::Item: DerefAndDrive,
{
}

impl Drive for () {}

fn main() {}

... is because the goal <&'a () as IntoIterator>::Item: DerefAndDrive is considered ambiguous when unifying the two impls above. That's because we try normalizing the self type of the goal, and &'a (): IntoIterator is treated as unknowable.

I think this is problematic, because even if we were to add an upstream implementation to be able to normalize <&'a () as IntoIterator>::Item, it couldn't implement DerefAndDrive since that's a trait local to the crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coherenceHaving to do with regressions in `-Ztrait-solver=next-coherence`S-breaking-change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions