rust/tests/ui/const-generics/issues/issue-72845.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
909 B
Rust
Raw Normal View History

2021-12-05 05:35:49 -06:00
#![feature(generic_const_exprs)]
#![feature(specialization)]
#![allow(incomplete_features)]
//--------------------------------------------------
trait Depth {
const C: usize;
}
trait Type {
type AT: Depth;
}
//--------------------------------------------------
enum Predicate<const B: bool> {}
trait Satisfied {}
impl Satisfied for Predicate<true> {}
//--------------------------------------------------
trait Spec1 {}
impl<T: Type> Spec1 for T where Predicate<{T::AT::C > 0}>: Satisfied {}
trait Spec2 {}
//impl<T: Type > Spec2 for T where Predicate<{T::AT::C > 1}>: Satisfied {}
impl<T: Type > Spec2 for T where Predicate<true>: Satisfied {}
//--------------------------------------------------
trait Foo {
fn Bar();
}
impl<T: Spec1> Foo for T {
default fn Bar() {}
}
impl<T: Spec2> Foo for T {
//~^ ERROR conflicting implementations of trait
fn Bar() {}
}
fn main() {}