Skip to content

Commit 3f831c6

Browse files
committed
add test and bless existing ones
1 parent 61cab77 commit 3f831c6

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#![feature(generic_const_exprs)]
2+
#![feature(specialization)]
3+
#![allow(incomplete_features)]
4+
5+
//--------------------------------------------------
6+
7+
trait Depth {
8+
const C: usize;
9+
}
10+
11+
trait Type {
12+
type AT: Depth;
13+
}
14+
15+
//--------------------------------------------------
16+
17+
enum Predicate<const B: bool> {}
18+
19+
trait Satisfied {}
20+
21+
impl Satisfied for Predicate<true> {}
22+
23+
//--------------------------------------------------
24+
25+
trait Spec1 {}
26+
27+
impl<T: Type> Spec1 for T where Predicate<{T::AT::C > 0}>: Satisfied {}
28+
29+
trait Spec2 {}
30+
31+
//impl<T: Type > Spec2 for T where Predicate<{T::AT::C > 1}>: Satisfied {}
32+
impl<T: Type > Spec2 for T where Predicate<true>: Satisfied {}
33+
34+
//--------------------------------------------------
35+
36+
trait Foo {
37+
fn Bar();
38+
}
39+
40+
impl<T: Spec1> Foo for T {
41+
default fn Bar() {}
42+
}
43+
44+
impl<T: Spec2> Foo for T {
45+
//~^ ERROR conflicting implementations of trait
46+
fn Bar() {}
47+
}
48+
49+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0119]: conflicting implementations of trait `Foo`
2+
--> $DIR/issue-72845.rs:44:1
3+
|
4+
LL | impl<T: Spec1> Foo for T {
5+
| ------------------------ first implementation here
6+
...
7+
LL | impl<T: Spec2> Foo for T {
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0119`.

src/test/ui/consts/const-eval/const-eval-query-stack.stderr

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

0 commit comments

Comments
 (0)