提交 78705b5e 编写于 作者: N Niko Matsakis

tests: move coherence-subtyping from run-pass to compile-fail

This is the pattern we no longer accept.
上级 652fd2ef
// run-pass
// Test that two distinct impls which match subtypes of one another
// yield coherence errors (or not) depending on the variance.
......@@ -10,6 +9,7 @@ impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
//~^ ERROR
}
///////////////////////////////////////////////////////////////////////////
......@@ -22,6 +22,7 @@ impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
//~^ ERROR
}
///////////////////////////////////////////////////////////////////////////
......@@ -34,6 +35,7 @@ impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
//~^ ERROR
}
fn main() { }
error[E0119]: conflicting implementations of trait `Contravariant` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
--> $DIR/coherence-subtyping.rs:21:1
|
LL | impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
| -------------------------------------------------------------- first implementation here
...
LL | impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
error[E0119]: conflicting implementations of trait `Covariant` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
--> $DIR/coherence-subtyping.rs:34:1
|
LL | impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
| ---------------------------------------------------------- first implementation here
...
LL | impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
error[E0119]: conflicting implementations of trait `Invariant` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
--> $DIR/coherence-subtyping.rs:47:1
|
LL | impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
| ---------------------------------------------------------- first implementation here
...
LL | impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0119`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册