Skip to content

Commit db1bfbd

Browse files
committed
Account for tuples in explanation
1 parent daeafd8 commit db1bfbd

11 files changed

+26
-25
lines changed

src/librustc_typeck/coherence/orphan.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
5454
"`{}` is not defined in the current crate{}",
5555
ty,
5656
match &ty.kind {
57-
ty::Slice(_) => " because slices are always considered foreign",
58-
ty::Array(..) => " because arrays are always considered foreign",
57+
ty::Slice(_) => " because slices are always foreign",
58+
ty::Array(..) => " because arrays are always foreign",
59+
ty::Tuple(..) => " because tuples are always foreign",
5960
_ => "",
6061
},
6162
);

src/test/ui/coherence/coherence-impls-copy.old.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
6262
LL | impl Copy for (MyType, MyType) {}
6363
| ^^^^^^^^^^^^^^----------------
6464
| | |
65-
| | `(MyType, MyType)` is not defined in the current crate
65+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
6666
| impl doesn't use only types from inside the current crate
6767
|
6868
= 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
7373
LL | impl Copy for [MyType] {}
7474
| ^^^^^^^^^^^^^^--------
7575
| | |
76-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
76+
| | `[MyType]` is not defined in the current crate because slices are always foreign
7777
| impl doesn't use only types from inside the current crate
7878
|
7979
= 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
8484
LL | impl Copy for &'static [NotSync] {}
8585
| ^^^^^^^^^^^^^^------------------
8686
| | |
87-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
87+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
8888
| impl doesn't use only types from inside the current crate
8989
|
9090
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence-impls-copy.re.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
6262
LL | impl Copy for (MyType, MyType) {}
6363
| ^^^^^^^^^^^^^^----------------
6464
| | |
65-
| | `(MyType, MyType)` is not defined in the current crate
65+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
6666
| impl doesn't use only types from inside the current crate
6767
|
6868
= 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
7373
LL | impl Copy for [MyType] {}
7474
| ^^^^^^^^^^^^^^--------
7575
| | |
76-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
76+
| | `[MyType]` is not defined in the current crate because slices are always foreign
7777
| impl doesn't use only types from inside the current crate
7878
|
7979
= 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
8484
LL | impl Copy for &'static [NotSync] {}
8585
| ^^^^^^^^^^^^^^------------------
8686
| | |
87-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
87+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
8888
| impl doesn't use only types from inside the current crate
8989
|
9090
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence-impls-send.old.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
44
LL | unsafe impl Send for (MyType, MyType) {}
55
| ^^^^^^^^^^^^^^^^^^^^^----------------
66
| | |
7-
| | `(MyType, MyType)` is not defined in the current crate
7+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
88
| impl doesn't use only types from inside the current crate
99
|
1010
= 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
2121
LL | unsafe impl Send for [MyType] {}
2222
| ^^^^^^^^^^^^^^^^^^^^^--------
2323
| | |
24-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
24+
| | `[MyType]` is not defined in the current crate because slices are always foreign
2525
| impl doesn't use only types from inside the current crate
2626
|
2727
= 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
3232
LL | unsafe impl Send for &'static [NotSync] {}
3333
| ^^^^^^^^^^^^^^^^^^^^^------------------
3434
| | |
35-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
35+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
3636
| impl doesn't use only types from inside the current crate
3737
|
3838
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence-impls-send.re.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
44
LL | unsafe impl Send for (MyType, MyType) {}
55
| ^^^^^^^^^^^^^^^^^^^^^----------------
66
| | |
7-
| | `(MyType, MyType)` is not defined in the current crate
7+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
88
| impl doesn't use only types from inside the current crate
99
|
1010
= 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
2121
LL | unsafe impl Send for [MyType] {}
2222
| ^^^^^^^^^^^^^^^^^^^^^--------
2323
| | |
24-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
24+
| | `[MyType]` is not defined in the current crate because slices are always foreign
2525
| impl doesn't use only types from inside the current crate
2626
|
2727
= 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
3232
LL | unsafe impl Send for &'static [NotSync] {}
3333
| ^^^^^^^^^^^^^^^^^^^^^------------------
3434
| | |
35-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
35+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
3636
| impl doesn't use only types from inside the current crate
3737
|
3838
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence-impls-sized.old.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
4040
LL | impl Sized for (MyType, MyType) {}
4141
| ^^^^^^^^^^^^^^^----------------
4242
| | |
43-
| | `(MyType, MyType)` is not defined in the current crate
43+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
4444
| impl doesn't use only types from inside the current crate
4545
|
4646
= 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
5151
LL | impl Sized for [MyType] {}
5252
| ^^^^^^^^^^^^^^^--------
5353
| | |
54-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
54+
| | `[MyType]` is not defined in the current crate because slices are always foreign
5555
| impl doesn't use only types from inside the current crate
5656
|
5757
= 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
6262
LL | impl Sized for &'static [NotSync] {}
6363
| ^^^^^^^^^^^^^^^------------------
6464
| | |
65-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
65+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
6666
| impl doesn't use only types from inside the current crate
6767
|
6868
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence-impls-sized.re.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
4040
LL | impl Sized for (MyType, MyType) {}
4141
| ^^^^^^^^^^^^^^^----------------
4242
| | |
43-
| | `(MyType, MyType)` is not defined in the current crate
43+
| | `(MyType, MyType)` is not defined in the current crate because tuples are always foreign
4444
| impl doesn't use only types from inside the current crate
4545
|
4646
= 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
5151
LL | impl Sized for [MyType] {}
5252
| ^^^^^^^^^^^^^^^--------
5353
| | |
54-
| | `[MyType]` is not defined in the current crate because slices are always considered foreign
54+
| | `[MyType]` is not defined in the current crate because slices are always foreign
5555
| impl doesn't use only types from inside the current crate
5656
|
5757
= 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
6262
LL | impl Sized for &'static [NotSync] {}
6363
| ^^^^^^^^^^^^^^^------------------
6464
| | |
65-
| | `[NotSync]` is not defined in the current crate because slices are always considered foreign
65+
| | `[NotSync]` is not defined in the current crate because slices are always foreign
6666
| impl doesn't use only types from inside the current crate
6767
|
6868
= note: define and implement a trait or new type instead

src/test/ui/coherence/coherence_local_err_tuple.old.stderr

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

src/test/ui/coherence/coherence_local_err_tuple.re.stderr

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

src/test/ui/error-codes/E0206.stderr

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

src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
44
LL | impl DefaultedTrait for (A,) { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^----
66
| | |
7-
| | `(A,)` is not defined in the current crate
7+
| | `(A,)` is not defined in the current crate because tuples are always foreign
88
| impl doesn't use only types from inside the current crate
99
|
1010
= 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
1515
LL | impl !DefaultedTrait for (B,) { }
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^----
1717
| | |
18-
| | `(B,)` is not defined in the current crate
18+
| | `(B,)` is not defined in the current crate because tuples are always foreign
1919
| impl doesn't use only types from inside the current crate
2020
|
2121
= note: define and implement a trait or new type instead

0 commit comments

Comments
 (0)