From db1bfbdbc07454ac4b35290e79931b51d5e5b36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 13 Oct 2019 11:35:21 -0700 Subject: [PATCH] Account for tuples in explanation --- src/librustc_typeck/coherence/orphan.rs | 5 +++-- src/test/ui/coherence/coherence-impls-copy.old.stderr | 6 +++--- src/test/ui/coherence/coherence-impls-copy.re.stderr | 6 +++--- src/test/ui/coherence/coherence-impls-send.old.stderr | 6 +++--- src/test/ui/coherence/coherence-impls-send.re.stderr | 6 +++--- src/test/ui/coherence/coherence-impls-sized.old.stderr | 6 +++--- src/test/ui/coherence/coherence-impls-sized.re.stderr | 6 +++--- src/test/ui/coherence/coherence_local_err_tuple.old.stderr | 2 +- src/test/ui/coherence/coherence_local_err_tuple.re.stderr | 2 +- src/test/ui/error-codes/E0206.stderr | 2 +- .../typeck-default-trait-impl-cross-crate-coherence.stderr | 4 ++-- 11 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index ef2de50b2cb4..1ae9b93d9a69 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 c2c61fd6d916..bd0debadbb0e 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 c2c61fd6d916..bd0debadbb0e 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 3c504c591ba6..024080a621de 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 3c504c591ba6..024080a621de 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 a2a653cf330f..84328d915efb 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 a2a653cf330f..84328d915efb 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 7c3c26f5b920..0bc55eff3d21 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 7c3c26f5b920..0bc55eff3d21 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 7d5175246d19..7d7336cdff26 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 69a8100096ce..4773ac7f7dbe 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