Skip to content

ICE:Unimplemented when trying to select an implementation for constant trait item reference. #26095

Closed
@Ygg01

Description

@Ygg01

When running following code:

#![feature(associated_consts)]
trait HasNumber<T> {
    const Number: usize;
}

enum One {}
enum Two {}

enum Foo {}

impl<T> HasNumber<T> for One {
    const Number: usize = 1;
}

impl<T> HasNumber<T> for Two {
    const Number: usize = 2;
}

On playground nightly and beta channels I get the following error:

<anon>:3:5: 3:25 error: internal compiler error: Encountered error `Unimplemented` when trying to select an implementation for constant trait item reference.
<anon>:3     const Number: usize;
             ^~~~~~~~~~~~~~~~~~~~

I expected to not get that error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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