Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlapping impl candidates are no longer an error #35

Open
aliemjay opened this issue Jun 23, 2023 · 2 comments
Open

overlapping impl candidates are no longer an error #35

aliemjay opened this issue Jun 23, 2023 · 2 comments
Labels
stabilization-report-relevant Relevant for stabilization report for new solver (new breakage, new capabilities)

Comments

@aliemjay
Copy link
Member

aliemjay commented Jun 23, 2023

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

@compiler-errors
Copy link
Member

I kind of want this to not return an ambiguity, but just compile without error. The only time this should ICE is during codegen...

@lcnr
Copy link
Contributor

lcnr commented Apr 25, 2024

this will no longer ICE with rust-lang/rust#124374 and is something I'd like to work. Still keeping this open as it should be mentioned when stabilizing the new solver

@compiler-errors compiler-errors added the stabilization-report-relevant Relevant for stabilization report for new solver (new breakage, new capabilities) label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stabilization-report-relevant Relevant for stabilization report for new solver (new breakage, new capabilities)
Projects
None yet
Development

No branches or pull requests

3 participants