forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#65417 - weiznich:more_coherence_tests, r=ni…
…komatsakis Add more coherence tests I've wrote the missing test cases listed in [this google doc](https://docs.google.com/spreadsheets/d/1WlroTEXE6qxxGvEOhICkUpqguYZP9YOZEvnmEtSNtM0/edit#gid=0) > The other thing that might be useful is to rename the existing tests so they all fit the new naming scheme we were using. I'm not entirely sure how to do this. If everything from the google sheet is covered could I just remove the remaining tests in `src/test/ui/coherence` or is there something in there that should remain? cc rust-lang#63599 r? @nikomatsakis
- Loading branch information
Showing
21 changed files
with
402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
25 changes: 25 additions & 0 deletions
25
src/test/ui/coherence/impl-foreign-for-foreign[foreign].rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
30 changes: 30 additions & 0 deletions
30
src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/coherence/impl-foreign-for-fundamental[foreign].rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
17 changes: 17 additions & 0 deletions
17
src/test/ui/coherence/impl-foreign-for-fundamental[local].rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
26 changes: 26 additions & 0 deletions
26
src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
30 changes: 30 additions & 0 deletions
30
src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
18 changes: 18 additions & 0 deletions
18
src/test/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/coherence/impl[t]-foreign-for-(local, t).stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
17 changes: 17 additions & 0 deletions
17
src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
17 changes: 17 additions & 0 deletions
17
src/test/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
Oops, something went wrong.