about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs (renamed from tests/crashes/140571.rs)11
-rw-r--r--tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr21
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/crashes/140571.rs b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs
index 97fa1d8432d..f4cde1d62b2 100644
--- a/tests/crashes/140571.rs
+++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs
@@ -1,14 +1,21 @@
-//@ known-bug: #140571
+// Regression test for #140571. The compiler used to ICE
+
+#![feature(associated_const_equality, specialization)]
+//~^ WARN the feature `specialization` is incomplete
+
 pub trait IsVoid {
     const IS_VOID: bool;
 }
 impl<T> IsVoid for T {
     default const IS_VOID: bool = false;
 }
-impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
 
 pub trait NotVoid {}
 impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {}
 
 pub trait Maybe<T> {}
 impl<T> Maybe<T> for T {}
+impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
+//~^ ERROR conflicting implementations of trait `Maybe<()>` for type `()`
+
+fn main() {}
diff --git a/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr
new file mode 100644
index 00000000000..a26b30fbb63
--- /dev/null
+++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr
@@ -0,0 +1,21 @@
+warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:3:39
+   |
+LL | #![feature(associated_const_equality, specialization)]
+   |                                       ^^^^^^^^^^^^^^
+   |
+   = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
+   = help: consider using `min_specialization` instead, which is more stable and complete
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0119]: conflicting implementations of trait `Maybe<()>` for type `()`
+  --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:18:1
+   |
+LL | impl<T> Maybe<T> for T {}
+   | ---------------------- first implementation here
+LL | impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0119`.