Skip to content

overlapping impl candidates are no longer an error #35

Open
@aliemjay

Description

@aliemjay

The following passes typeck and ICEs in MIR building for test with the message encountered ambiguity selecting <std::option::Option<T> as Overlap> during codegen:

trait Local {}

trait Overlap { fn f(); }
impl<T> Overlap for Option<T> where Self: Clone, { fn f() {} }
impl<T> Overlap for Option<T> where Self: Local, { fn f() {} }

fn test<T>()
where
    Option<T>: Clone + Local,
{
    <Option<T> as Overlap>::f();
}

test is not really callable as coherence disallows adding a impl Local for Option, but we should still return an ambiguity in case of overlapping impl candidates.

https://github.com/rust-lang/rust/blob/fe37f37e4b764bb82fc0eb8c727842746de7c93f/compiler/rustc_trait_selection/src/solve/mod.rs#L197

Metadata

Metadata

Assignees

No one assigned

    Labels

    stabilization-report-relevantRelevant for stabilization report for new solver (new breakage, new capabilities)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions