Skip to content

Coherence does not properly handle VtableObject impls #23323

Closed
@arielb1

Description

@arielb1

Directly having an impl Trait for Trait and cause a "coherence failed to report ambiguity" ICE. Having an indirect impl (impl<T: ?Sized> Trait for T) causes cryptic "type annotations required: cannot resolve Bar : Bar" and "recursion limit exceeded during monomorphisation" errors, but I didn't manage to get an ICE.

An example that causes a coherence failed to report ambiguity ICE:

trait Bar { fn bar(&self); }

impl Bar for Bar {
    fn bar(&self) { println!("trait-object impl called"); }
}

impl Bar for () {
    fn bar(&self) { println!("unit impl called"); }
}

fn main() {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions