mirror of
https://github.com/rust-lang/rust
synced 2024-09-30 22:04:36 +00:00
Add more tests
This commit is contained in:
parent
3f004a1bc4
commit
a9c38d9d01
16
src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs
Normal file
16
src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#![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<u32> for f64 {
|
||||
//~^ ERROR only traits defined in the current crate can be implemented for arbitrary types [E0117]
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,12 @@
|
|||
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
|
||||
--> $DIR/impl-foreign[foreign]-for-foreign.rs:12:1
|
||||
|
|
||||
LL | impl Remote1<u32> 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: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0117`.
|
16
src/test/ui/coherence/impl-foreign[foreign]-for-local.rs
Normal file
16
src/test/ui/coherence/impl-foreign[foreign]-for-local.rs
Normal 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;
|
||||
|
||||
impl Remote1<u32> for Local {
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,20 @@
|
|||
#![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> Remote1<u32> for Box<T> {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
impl<'a, T> Remote1<u32> for &'a T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<u32> 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[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:16:1
|
||||
|
|
||||
LL | impl<'a, T> Remote1<u32> for &'a 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
16
src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs
Normal file
16
src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#![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> Remote1<u32> for T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
Normal file
11
src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
Normal 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[foreign]-for-t.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<u32> for 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`.
|
|
@ -0,0 +1,20 @@
|
|||
#![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> Remote2<Box<T>, Local> for u32 {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
impl<'a, T> Remote2<&'a T, Local> for u32 {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t],local]-for-foreign.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote2<Box<T>, Local> for u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t],local]-for-foreign.rs:16:1
|
||||
|
|
||||
LL | impl<'a, T> Remote2<&'a T, Local> for u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
|
@ -0,0 +1,20 @@
|
|||
#![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> Remote1<Box<T>> for u32 {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
impl<'a, T> Remote1<&'a T> for u32 {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<Box<T>> for u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:16:1
|
||||
|
|
||||
LL | impl<'a, T> Remote1<&'a T> for u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
|
@ -0,0 +1,19 @@
|
|||
#![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<'a, T> Remote1<Box<T>> for &'a T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
impl<'a, T> Remote1<&'a T> for Box<T> {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:12:1
|
||||
|
|
||||
LL | impl<'a, T> Remote1<Box<T>> for &'a 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[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:15:1
|
||||
|
|
||||
LL | impl<'a, T> Remote1<&'a T> 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
|
@ -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;
|
||||
|
||||
impl<T> Remote1<Box<T>> for Local {}
|
||||
|
||||
impl<'a, T> Remote1<&'a T> for Local {}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
#![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> Remote1<Box<T>> for T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
impl<'a, T> Remote1<&'a T> for T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<Box<T>> for 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[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:15:1
|
||||
|
|
||||
LL | impl<'a, T> Remote1<&'a T> for 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
|
@ -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 Local2<T>(Rc<T>);
|
||||
|
||||
impl<T> Remote2<Local, Box<T>> for u32 {}
|
||||
impl<'a, T> Remote2<Local, &'a T> for u32 {}
|
||||
impl<T> Remote2<Local2<T>, Box<T>> for u32 {}
|
||||
impl<'a, T> Remote2<Local2<T>, &'a T> for u32 {}
|
||||
|
||||
fn main() {}
|
16
src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs
Normal file
16
src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs
Normal 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;
|
||||
|
||||
impl<T> Remote1<Local> for Rc<T> {}
|
||||
impl<T> Remote1<Local> for Vec<Box<T>> {}
|
||||
|
||||
fn main() {}
|
15
src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs
Normal file
15
src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs
Normal 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 Remote1<Local> for Local {}
|
||||
|
||||
fn main() {}
|
16
src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs
Normal file
16
src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#![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> Remote1<T> for u32 {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
Normal file
11
src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
Normal 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[t]-for-foreign.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<T> for u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`.
|
20
src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs
Normal file
20
src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
#![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> Remote1<T> for Box<T> {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
impl<'a, A, B> Remote1<A> for &'a B {
|
||||
//~^ ERROR type parameter `B` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
|
||||
--> $DIR/impl[t]-foreign[t]-for-fundamental.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<T> 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[E0210]: type parameter `B` must be used as the type parameter for some local type (e.g., `MyStruct<B>`)
|
||||
--> $DIR/impl[t]-foreign[t]-for-fundamental.rs:16:1
|
||||
|
|
||||
LL | impl<'a, A, B> Remote1<A> for &'a B {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `B` 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0210`.
|
15
src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs
Normal file
15
src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs
Normal 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<T> Remote1<T> for Local {}
|
||||
|
||||
fn main() {}
|
16
src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs
Normal file
16
src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#![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> Remote1<T> for T {
|
||||
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
Normal file
11
src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
Normal 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[t]-for-t.rs:12:1
|
||||
|
|
||||
LL | impl<T> Remote1<T> for 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`.
|
Loading…
Reference in a new issue