mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
tests: move coherence-subtyping from run-pass to compile-fail
This is the pattern we no longer accept.
This commit is contained in:
parent
652fd2efdf
commit
78705b5ec7
@ -1,4 +1,3 @@
|
||||
// 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() { }
|
30
src/test/ui/coherence/coherence-subtyping.stderr
Normal file
30
src/test/ui/coherence/coherence-subtyping.stderr
Normal file
@ -0,0 +1,30 @@
|
||||
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`.
|
Loading…
Reference in New Issue
Block a user