Account for tuples in explanation

This commit is contained in:
Esteban Küber
2019-10-13 11:35:21 -07:00
parent daeafd895d
commit db1bfbdbc0
11 changed files with 26 additions and 25 deletions

View File

@@ -54,8 +54,9 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
"`{}` is not defined in the current crate{}", "`{}` is not defined in the current crate{}",
ty, ty,
match &ty.kind { match &ty.kind {
ty::Slice(_) => " because slices are always considered foreign", ty::Slice(_) => " because slices are always foreign",
ty::Array(..) => " because arrays are always considered foreign", ty::Array(..) => " because arrays are always foreign",
ty::Tuple(..) => " because tuples are always foreign",
_ => "", _ => "",
}, },
); );

View File

@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for (MyType, MyType) {} LL | impl Copy for (MyType, MyType) {}
| ^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -73,7 +73,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for [MyType] {} LL | impl Copy for [MyType] {}
| ^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -84,7 +84,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for &'static [NotSync] {} LL | impl Copy for &'static [NotSync] {}
| ^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for (MyType, MyType) {} LL | impl Copy for (MyType, MyType) {}
| ^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -73,7 +73,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for [MyType] {} LL | impl Copy for [MyType] {}
| ^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -84,7 +84,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for &'static [NotSync] {} LL | impl Copy for &'static [NotSync] {}
| ^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for (MyType, MyType) {} LL | unsafe impl Send for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -21,7 +21,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for [MyType] {} LL | unsafe impl Send for [MyType] {}
| ^^^^^^^^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -32,7 +32,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for &'static [NotSync] {} LL | unsafe impl Send for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for (MyType, MyType) {} LL | unsafe impl Send for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -21,7 +21,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for [MyType] {} LL | unsafe impl Send for [MyType] {}
| ^^^^^^^^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -32,7 +32,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | unsafe impl Send for &'static [NotSync] {} LL | unsafe impl Send for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for (MyType, MyType) {} LL | impl Sized for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -51,7 +51,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for [MyType] {} LL | impl Sized for [MyType] {}
| ^^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for &'static [NotSync] {} LL | impl Sized for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for (MyType, MyType) {} LL | impl Sized for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^---------------- | ^^^^^^^^^^^^^^^----------------
| | | | | |
| | `(MyType, MyType)` is not defined in the current crate | | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -51,7 +51,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for [MyType] {} LL | impl Sized for [MyType] {}
| ^^^^^^^^^^^^^^^-------- | ^^^^^^^^^^^^^^^--------
| | | | | |
| | `[MyType]` is not defined in the current crate because slices are always considered foreign | | `[MyType]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Sized for &'static [NotSync] {} LL | impl Sized for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^------------------ | ^^^^^^^^^^^^^^^------------------
| | | | | |
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign | | `[NotSync]` is not defined in the current crate because slices are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl lib::MyCopy for (MyType,) { } LL | impl lib::MyCopy for (MyType,) { }
| ^^^^^^^^^^^^^^^^^^^^^--------- | ^^^^^^^^^^^^^^^^^^^^^---------
| | | | | |
| | `(MyType,)` is not defined in the current crate | | `(MyType,)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl lib::MyCopy for (MyType,) { } LL | impl lib::MyCopy for (MyType,) { }
| ^^^^^^^^^^^^^^^^^^^^^--------- | ^^^^^^^^^^^^^^^^^^^^^---------
| | | | | |
| | `(MyType,)` is not defined in the current crate | | `(MyType,)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -16,7 +16,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl Copy for Foo { } LL | impl Copy for Foo { }
| ^^^^^^^^^^^^^^--- | ^^^^^^^^^^^^^^---
| | | | | |
| | `[u8; _]` is not defined in the current crate because arrays are always considered foreign | | `[u8; _]` is not defined in the current crate because arrays are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead

View File

@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl DefaultedTrait for (A,) { } LL | impl DefaultedTrait for (A,) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^---- | ^^^^^^^^^^^^^^^^^^^^^^^^----
| | | | | |
| | `(A,)` is not defined in the current crate | | `(A,)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
@@ -15,7 +15,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
LL | impl !DefaultedTrait for (B,) { } LL | impl !DefaultedTrait for (B,) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^---- | ^^^^^^^^^^^^^^^^^^^^^^^^^----
| | | | | |
| | `(B,)` is not defined in the current crate | | `(B,)` is not defined in the current crate because tuples are always foreign
| impl doesn't use only types from inside the current crate | impl doesn't use only types from inside the current crate
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead