Skip to content

Commit 77f0aaf

Browse files
committed
Add more coherence tests
1 parent 9249a73 commit 77f0aaf

21 files changed

+402
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
12+
impl Remote for i32 {
13+
//~^ ERROR only traits defined in the current crate
14+
// | can be implemented for arbitrary types [E0117]
15+
}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl-foreign-for-foreign.rs:12:1
3+
|
4+
LL | impl Remote for i32 {
5+
| ^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
12+
impl Remote1<Rc<i32>> for i32 {
13+
//~^ ERROR only traits defined in the current crate
14+
// | can be implemented for arbitrary types [E0117]
15+
}
16+
impl Remote1<Rc<Local>> for f64 {
17+
//~^ ERROR only traits defined in the current crate
18+
// | can be implemented for arbitrary types [E0117]
19+
}
20+
impl<T> Remote1<Rc<T>> for f32 {
21+
//~^ ERROR only traits defined in the current crate
22+
// | can be implemented for arbitrary types [E0117]
23+
}
24+
25+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl-foreign-for-foreign[foreign].rs:12:1
3+
|
4+
LL | impl Remote1<Rc<i32>> for i32 {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
11+
--> $DIR/impl-foreign-for-foreign[foreign].rs:16:1
12+
|
13+
LL | impl Remote1<Rc<Local>> for f64 {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
15+
|
16+
= note: the impl does not reference only types defined in this crate
17+
= note: define and implement a trait or new type instead
18+
19+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
20+
--> $DIR/impl-foreign-for-foreign[foreign].rs:20:1
21+
|
22+
LL | impl<T> Remote1<Rc<T>> for f32 {
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
24+
|
25+
= note: the impl does not reference only types defined in this crate
26+
= note: define and implement a trait or new type instead
27+
28+
error: aborting due to 3 previous errors
29+
30+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
// check-pass
6+
7+
extern crate coherence_lib as lib;
8+
use lib::*;
9+
use std::rc::Rc;
10+
11+
struct Local<T>(Rc<T>);
12+
13+
impl Remote1<Local<i32>> for i32 {}
14+
impl<T> Remote1<Local<T>> for f32 {}
15+
16+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
12+
impl Remote for Box<i32> {
13+
//~^ ERROR only traits defined in the current crate
14+
// | can be implemented for arbitrary types [E0117]
15+
}
16+
impl<T> Remote for Box<Rc<T>> {
17+
//~^ ERROR only traits defined in the current crate
18+
// | can be implemented for arbitrary types [E0117]
19+
}
20+
21+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl-foreign-for-fundamental[foreign].rs:12:1
3+
|
4+
LL | impl Remote for Box<i32> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
11+
--> $DIR/impl-foreign-for-fundamental[foreign].rs:16:1
12+
|
13+
LL | impl<T> Remote for Box<Rc<T>> {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
15+
|
16+
= note: the impl does not reference only types defined in this crate
17+
= note: define and implement a trait or new type instead
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
// check-pass
6+
7+
extern crate coherence_lib as lib;
8+
use lib::*;
9+
use std::rc::Rc;
10+
11+
struct Local;
12+
struct Local1<T>(Rc<T>);
13+
14+
impl Remote for Box<Local> {}
15+
impl<T> Remote for Box<Local1<T>> {}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
// check-pass
6+
7+
extern crate coherence_lib as lib;
8+
use lib::*;
9+
use std::rc::Rc;
10+
11+
struct Local;
12+
13+
impl Remote for Local {}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
struct Local1<T>(Rc<T>);
12+
13+
impl Remote1<Box<String>> for i32 {
14+
//~^ ERROR only traits defined in the current crate
15+
// | can be implemented for arbitrary types [E0117]
16+
}
17+
impl Remote1<Box<Rc<i32>>> for f64 {
18+
//~^ ERROR only traits defined in the current crate
19+
// | can be implemented for arbitrary types [E0117]
20+
}
21+
impl<T> Remote1<Box<Rc<T>>> for f32 {
22+
//~^ ERROR only traits defined in the current crate
23+
// | can be implemented for arbitrary types [E0117]
24+
}
25+
26+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:13:1
3+
|
4+
LL | impl Remote1<Box<String>> for i32 {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
11+
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:17:1
12+
|
13+
LL | impl Remote1<Box<Rc<i32>>> for f64 {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
15+
|
16+
= note: the impl does not reference only types defined in this crate
17+
= note: define and implement a trait or new type instead
18+
19+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
20+
--> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:21:1
21+
|
22+
LL | impl<T> Remote1<Box<Rc<T>>> for f32 {
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
24+
|
25+
= note: the impl does not reference only types defined in this crate
26+
= note: define and implement a trait or new type instead
27+
28+
error: aborting due to 3 previous errors
29+
30+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
// check-pass
6+
7+
extern crate coherence_lib as lib;
8+
use lib::*;
9+
use std::rc::Rc;
10+
11+
struct Local;
12+
struct Local1<T>(Rc<T>);
13+
14+
impl Remote1<Box<Local>> for i32 {}
15+
impl Remote1<Box<Local1<i32>>> for f64 {}
16+
impl<T> Remote1<Box<Local1<T>>> for f32 {}
17+
18+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
12+
impl<T> Remote for (Local, T) {
13+
//~^ ERROR only traits defined in the current crate
14+
// | can be implemented for arbitrary types [E0117]
15+
}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl[t]-foreign-for-(local, t).rs:12:1
3+
|
4+
LL | impl<T> Remote for (Local, T) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
use std::sync::Arc;
10+
11+
struct Local;
12+
13+
impl Remote for Rc<Local> {
14+
//~^ ERROR only traits defined in the current crate
15+
// | can be implemented for arbitrary types [E0117]
16+
}
17+
18+
impl<T> Remote for Arc<T> {
19+
//~^ ERROR only traits defined in the current crate
20+
// | can be implemented for arbitrary types [E0117]
21+
}
22+
23+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2+
--> $DIR/impl[t]-foreign-for-foreign[t].rs:13:1
3+
|
4+
LL | impl Remote for Rc<Local> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
6+
|
7+
= note: the impl does not reference only types defined in this crate
8+
= note: define and implement a trait or new type instead
9+
10+
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
11+
--> $DIR/impl[t]-foreign-for-foreign[t].rs:18:1
12+
|
13+
LL | impl<T> Remote for Arc<T> {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
15+
|
16+
= note: the impl does not reference only types defined in this crate
17+
= note: define and implement a trait or new type instead
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0117`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
6+
extern crate coherence_lib as lib;
7+
use lib::*;
8+
use std::rc::Rc;
9+
10+
struct Local;
11+
12+
impl<T> Remote for Box<T> {
13+
//~^ ERROR type parameter `T` must be used as the type parameter for
14+
// | some local type (e.g., `MyStruct<T>`)
15+
}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
2+
--> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:1
3+
|
4+
LL | impl<T> Remote for Box<T> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
6+
|
7+
= note: only traits defined in the current crate can be implemented for a type parameter
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0210`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(re_rebalance_coherence)]
2+
3+
// compile-flags:--crate-name=test
4+
// aux-build:coherence_lib.rs
5+
// check-pass
6+
7+
extern crate coherence_lib as lib;
8+
use lib::*;
9+
use std::rc::Rc;
10+
11+
struct Local;
12+
struct Local1<S>(Rc<S>);
13+
14+
impl<T> Remote1<Box<Local>> for Rc<T> {}
15+
impl<S, T> Remote1<Box<Local1<S>>> for Rc<T> {}
16+
17+
fn main() {}

0 commit comments

Comments
 (0)