1
Fork 0

add test and bless existing ones

This commit is contained in:
b-naber 2021-12-05 12:35:49 +01:00
parent 61cab770bd
commit 3f831c64cc
3 changed files with 62 additions and 1 deletions

View file

@ -0,0 +1,49 @@
#![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() {}

View file

@ -0,0 +1,12 @@
error[E0119]: conflicting implementations of trait `Foo`
--> $DIR/issue-72845.rs:44:1
|
LL | impl<T: Spec1> Foo for T {
| ------------------------ first implementation here
...
LL | impl<T: Spec2> Foo for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View file

@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
LL | let x: &'static i32 = &X; LL | let x: &'static i32 = &X;
| ^ referenced constant has errors | ^ referenced constant has errors
query stack during panic: query stack during panic:
#0 [normalize_mir_const_after_erasing_regions] normalizing `main::promoted[1]` #0 [try_normalize_mir_const_after_erasing_regions] normalizing `main::promoted[1]`
#1 [optimized_mir] optimizing MIR for `main` #1 [optimized_mir] optimizing MIR for `main`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items #2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack end of query stack