Add more coherence tests

This commit is contained in:
Georg Semmler 2019-10-12 20:53:11 +02:00
parent 9249a7393c
commit 77f0aaf0d0
No known key found for this signature in database
GPG key ID: A87BCEE5205CE489
21 changed files with 402 additions and 0 deletions

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl Remote for i32 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,12 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-foreign.rs:12:1
|
LL | impl Remote for i32 {
| ^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to previous error
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,25 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl Remote1<Rc<i32>> for i32 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl Remote1<Rc<Local>> for f64 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl<T> Remote1<Rc<T>> for f32 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,30 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-foreign[foreign].rs:12:1
|
LL | impl Remote1<Rc<i32>> for i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-foreign[foreign].rs:16:1
|
LL | impl Remote1<Rc<Local>> for f64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-foreign[foreign].rs:20:1
|
LL | impl<T> Remote1<Rc<T>> for f32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,16 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local<T>(Rc<T>);
impl Remote1<Local<i32>> for i32 {}
impl<T> Remote1<Local<T>> for f32 {}
fn main() {}

View file

@ -0,0 +1,21 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl Remote for Box<i32> {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl<T> Remote for Box<Rc<T>> {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-fundamental[foreign].rs:12:1
|
LL | impl Remote for Box<i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign-for-fundamental[foreign].rs:16:1
|
LL | impl<T> Remote for Box<Rc<T>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<T>(Rc<T>);
impl Remote for Box<Local> {}
impl<T> Remote for Box<Local1<T>> {}
fn main() {}

View file

@ -0,0 +1,15 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl Remote for Local {}
fn main() {}

View file

@ -0,0 +1,26 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<T>(Rc<T>);
impl Remote1<Box<String>> for i32 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl Remote1<Box<Rc<i32>>> for f64 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl<T> Remote1<Box<Rc<T>>> for f32 {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,30 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:13:1
|
LL | impl Remote1<Box<String>> for i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:17:1
|
LL | impl Remote1<Box<Rc<i32>>> for f64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:21:1
|
LL | impl<T> Remote1<Box<Rc<T>>> for f32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,18 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<T>(Rc<T>);
impl Remote1<Box<Local>> for i32 {}
impl Remote1<Box<Local1<i32>>> for f64 {}
impl<T> Remote1<Box<Local1<T>>> for f32 {}
fn main() {}

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl<T> Remote for (Local, T) {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,12 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl[t]-foreign-for-(local, t).rs:12:1
|
LL | impl<T> Remote for (Local, T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to previous error
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,23 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
use std::sync::Arc;
struct Local;
impl Remote for Rc<Local> {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
impl<T> Remote for Arc<T> {
//~^ ERROR only traits defined in the current crate
// | can be implemented for arbitrary types [E0117]
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl[t]-foreign-for-foreign[t].rs:13:1
|
LL | impl Remote for Rc<Local> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/impl[t]-foreign-for-foreign[t].rs:18:1
|
LL | impl<T> Remote for Arc<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference only types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0117`.

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
impl<T> Remote for Box<T> {
//~^ ERROR type parameter `T` must be used as the type parameter for
// | some local type (e.g., `MyStruct<T>`)
}
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:1
|
LL | impl<T> Remote for Box<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0210`.

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<S>(Rc<S>);
impl<T> Remote1<Box<Local>> for Rc<T> {}
impl<S, T> Remote1<Box<Local1<S>>> for Rc<T> {}
fn main() {}

View file

@ -0,0 +1,17 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<S>(Rc<S>);
impl<T> Remote1<Local> for Rc<T> {}
impl<T, S> Remote1<Local1<S>> for Rc<T> {}
fn main() {}

View file

@ -0,0 +1,19 @@
#![feature(re_rebalance_coherence)]
// compile-flags:--crate-name=test
// aux-build:coherence_lib.rs
// check-pass
extern crate coherence_lib as lib;
use lib::*;
use std::rc::Rc;
struct Local;
struct Local1<S>(Rc<S>);
impl<T> Remote1<Local> for Box<Rc<T>> {}
impl<T, S> Remote1<Local1<S>> for Box<Rc<T>> {}
impl<T> Remote1<Box<Local>> for Box<Rc<T>> {}
impl<T, S> Remote1<Box<Local1<S>>> for Box<Rc<T>> {}
fn main() {}