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

False conflicting implementation with generic_const_exprs and adt_const_params #95951

Closed
thorjelly opened this issue Apr 11, 2022 · 1 comment
Labels
C-bug Category: This is a bug.

Comments

@thorjelly
Copy link

This code fails to compile:

#![feature(generic_const_exprs)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]

struct Foo {}

#[derive(PartialEq, Eq)]
pub enum Bar {
    One,
    Two
}

trait Baz<T, const FOO: Bar> {}

impl<T> Baz<T, {Bar::One}> for Foo {}
impl<T> Baz<T, {Bar::Two}> for Foo {}

However, it compiles if #![feature(generic_const_exprs)] is removed.

It also only appears to be the case with complex generic types. This compiles too:

#![feature(generic_const_exprs)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]

struct Foo {}

trait Baz<T, const FOO: u32> {}

impl<T> Baz<T, 1> for Foo {}
impl<T> Baz<T, 2> for Foo {}
@thorjelly thorjelly added the C-bug Category: This is a bug. label Apr 11, 2022
@thorjelly
Copy link
Author

Did an inadequate job of searching for this issue; appears to be a duplicate of #92186.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant