diff --git a/tests/ui/transmutability/coherence.next.stderr b/tests/ui/transmutability/coherence.next.stderr new file mode 100644 index 00000000000..ce94c57a7f6 --- /dev/null +++ b/tests/ui/transmutability/coherence.next.stderr @@ -0,0 +1,19 @@ +error[E0747]: type provided when a constant was expected + --> $DIR/coherence.rs:10:37 + | +LL | impl> OpaqueTrait for T {} + | ^^ + +error[E0119]: conflicting implementations of trait `OpaqueTrait` for type `&_` + --> $DIR/coherence.rs:13:1 + | +LL | impl> OpaqueTrait for T {} + | ---------------------------------------------------------- first implementation here +... +LL | impl OpaqueTrait for &T where T: OpaqueTrait {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0747. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/transmutability/coherence.old.stderr b/tests/ui/transmutability/coherence.old.stderr new file mode 100644 index 00000000000..ce94c57a7f6 --- /dev/null +++ b/tests/ui/transmutability/coherence.old.stderr @@ -0,0 +1,19 @@ +error[E0747]: type provided when a constant was expected + --> $DIR/coherence.rs:10:37 + | +LL | impl> OpaqueTrait for T {} + | ^^ + +error[E0119]: conflicting implementations of trait `OpaqueTrait` for type `&_` + --> $DIR/coherence.rs:13:1 + | +LL | impl> OpaqueTrait for T {} + | ---------------------------------------------------------- first implementation here +... +LL | impl OpaqueTrait for &T where T: OpaqueTrait {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0747. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/transmutability/coherence.rs b/tests/ui/transmutability/coherence.rs new file mode 100644 index 00000000000..274d7b17a53 --- /dev/null +++ b/tests/ui/transmutability/coherence.rs @@ -0,0 +1,16 @@ +//! Regression test for + +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +#![feature(transmutability)] +trait OpaqueTrait {} + +impl> OpaqueTrait for T {} +//~^ ERROR: type provided when a constant was expected + +impl OpaqueTrait for &T where T: OpaqueTrait {} +//~^ ERROR: conflicting implementations of trait `OpaqueTrait` for type `&_` + +fn main() {}