add test and bless existing ones
This commit is contained in:
parent
61cab770bd
commit
3f831c64cc
3 changed files with 62 additions and 1 deletions
49
src/test/ui/const-generics/issues/issue-72845.rs
Normal file
49
src/test/ui/const-generics/issues/issue-72845.rs
Normal 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() {}
|
12
src/test/ui/const-generics/issues/issue-72845.stderr
Normal file
12
src/test/ui/const-generics/issues/issue-72845.stderr
Normal 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`.
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue