about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-10-13 11:35:21 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-10-28 09:57:36 -0700
commitdb1bfbdbc07454ac4b35290e79931b51d5e5b36f (patch)
treedd86b0310686f2c64ba5268b0fd1e5dfef4e3502
parentdaeafd895d26892d9adac2f7103b071b6c07823e (diff)
downloadrust-db1bfbdbc07454ac4b35290e79931b51d5e5b36f.tar.gz
rust-db1bfbdbc07454ac4b35290e79931b51d5e5b36f.zip
Account for tuples in explanation
-rw-r--r--src/librustc_typeck/coherence/orphan.rs5
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-send.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-send.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.old.stderr2
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.re.stderr2
-rw-r--r--src/test/ui/error-codes/E0206.stderr2
-rw-r--r--src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr4
11 files changed, 26 insertions, 25 deletions
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index ef2de50b2cb..1ae9b93d9a6 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -54,8 +54,9 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
                             "`{}` is not defined in the current crate{}",
                             ty,
                             match &ty.kind {
-                                ty::Slice(_) => " because slices are always considered foreign",
-                                ty::Array(..) => " because arrays are always considered foreign",
+                                ty::Slice(_) => " because slices are always foreign",
+                                ty::Array(..) => " because arrays are always foreign",
+                                ty::Tuple(..) => " because tuples are always foreign",
                                 _ => "",
                             },
                         );
diff --git a/src/test/ui/coherence/coherence-impls-copy.old.stderr b/src/test/ui/coherence/coherence-impls-copy.old.stderr
index c2c61fd6d91..bd0debadbb0 100644
--- a/src/test/ui/coherence/coherence-impls-copy.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.old.stderr
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^--------
    | |             |
-   | |             `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^------------------
    | |             |
-   | |             `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence-impls-copy.re.stderr b/src/test/ui/coherence/coherence-impls-copy.re.stderr
index c2c61fd6d91..bd0debadbb0 100644
--- a/src/test/ui/coherence/coherence-impls-copy.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.re.stderr
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^--------
    | |             |
-   | |             `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^------------------
    | |             |
-   | |             `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence-impls-send.old.stderr b/src/test/ui/coherence/coherence-impls-send.old.stderr
index 3c504c591ba..024080a621d 100644
--- a/src/test/ui/coherence/coherence-impls-send.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.old.stderr
@@ -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) {}
    | ^^^^^^^^^^^^^^^^^^^^^----------------
    | |                    |
-   | |                    `(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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^^^^^^^--------
    | |                    |
-   | |                    `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^^^^^^^------------------
    | |                    |
-   | |                    `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence-impls-send.re.stderr b/src/test/ui/coherence/coherence-impls-send.re.stderr
index 3c504c591ba..024080a621d 100644
--- a/src/test/ui/coherence/coherence-impls-send.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.re.stderr
@@ -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) {}
    | ^^^^^^^^^^^^^^^^^^^^^----------------
    | |                    |
-   | |                    `(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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^^^^^^^--------
    | |                    |
-   | |                    `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^^^^^^^------------------
    | |                    |
-   | |                    `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence-impls-sized.old.stderr b/src/test/ui/coherence/coherence-impls-sized.old.stderr
index a2a653cf330..84328d915ef 100644
--- a/src/test/ui/coherence/coherence-impls-sized.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.old.stderr
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^--------
    | |              |
-   | |              `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^------------------
    | |              |
-   | |              `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence-impls-sized.re.stderr b/src/test/ui/coherence/coherence-impls-sized.re.stderr
index a2a653cf330..84328d915ef 100644
--- a/src/test/ui/coherence/coherence-impls-sized.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.re.stderr
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^--------
    | |              |
-   | |              `[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
    |
    = 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] {}
    | ^^^^^^^^^^^^^^^------------------
    | |              |
-   | |              `[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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
index 7c3c26f5b92..0bc55eff3d2 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
index 7c3c26f5b92..0bc55eff3d2 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/error-codes/E0206.stderr b/src/test/ui/error-codes/E0206.stderr
index 7d5175246d1..7d7336cdff2 100644
--- a/src/test/ui/error-codes/E0206.stderr
+++ b/src/test/ui/error-codes/E0206.stderr
@@ -16,7 +16,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = note: define and implement a trait or new type instead
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
index 69a8100096c..4773ac7f7db 100644
--- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
+++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 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
    |
    = 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,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^----
    | |                        |
-   | |                        `(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
    |
    = note: define and implement a trait or new type instead