Skip to content

Commit ca94dd5

Browse files
committed
Add more information link to orphan impls
1 parent 86a9959 commit ca94dd5

37 files changed

+121
-59
lines changed

compiler/rustc_hir_analysis/messages.ftl

+3-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ hir_analysis_only_current_traits_arbitrary = only traits defined in the current
351351
352352
hir_analysis_only_current_traits_foreign = this is not defined in the current crate because this is a foreign trait
353353
354-
hir_analysis_only_current_traits_label = impl doesn't use any uncovered types from inside the current crate
354+
hir_analysis_only_current_traits_label = impl doesn't have any local type before any uncovered type parameters
355+
356+
hir_analysis_only_current_traits_label_more_info = for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
355357
356358
hir_analysis_only_current_traits_name = this is not defined in the current crate because {$name} are always foreign
357359

compiler/rustc_hir_analysis/src/errors.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ pub enum OnlyCurrentTraits {
14411441
Outside {
14421442
#[primary_span]
14431443
#[label(hir_analysis_only_current_traits_label)]
1444+
#[label(hir_analysis_only_current_traits_label_more_info)]
14441445
span: Span,
14451446
#[note(hir_analysis_only_current_traits_note)]
14461447
note: (),
@@ -1449,6 +1450,7 @@ pub enum OnlyCurrentTraits {
14491450
Primitive {
14501451
#[primary_span]
14511452
#[label(hir_analysis_only_current_traits_label)]
1453+
#[label(hir_analysis_only_current_traits_label_more_info)]
14521454
span: Span,
14531455
#[note(hir_analysis_only_current_traits_note)]
14541456
note: (),
@@ -1457,6 +1459,7 @@ pub enum OnlyCurrentTraits {
14571459
Arbitrary {
14581460
#[primary_span]
14591461
#[label(hir_analysis_only_current_traits_label)]
1462+
#[label(hir_analysis_only_current_traits_label_more_info)]
14601463
span: Span,
14611464
#[note(hir_analysis_only_current_traits_note)]
14621465
note: (),

tests/ui/coherence/coherence-cow.re_a.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T> Remote for Pair<T,Cover<T>> { }
55
| ^^^^^^^^^^^^^^^^^^^----------------
66
| | |
77
| | `Pair` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-cow.re_b.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T> Remote for Pair<Cover<T>,T> { }
55
| ^^^^^^^^^^^^^^^^^^^----------------
66
| | |
77
| | `Pair` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-cow.re_c.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
55
| ^^^^^^^^^^^^^^^^^^^^^----------------
66
| | |
77
| | `Pair` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-fundamental-trait-objects.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl Misc for dyn Fundamental<Local> {}
55
| ^^^^^^^^^^^^^^----------------------
66
| | |
77
| | `dyn Fundamental<Local>` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ LL | impl !Send for dyn Marker2 {}
4141
| ^^^^^^^^^^^^^^^-----------
4242
| | |
4343
| | `dyn Marker2` is not defined in the current crate
44-
| impl doesn't use any uncovered types from inside the current crate
44+
| impl doesn't have any local type before any uncovered type parameters
45+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4546
|
4647
= note: define and implement a trait or new type instead
4748

tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ LL | unsafe impl Send for dyn Marker2 {}
4141
| ^^^^^^^^^^^^^^^^^^^^^-----------
4242
| | |
4343
| | `dyn Marker2` is not defined in the current crate
44-
| impl doesn't use any uncovered types from inside the current crate
44+
| impl doesn't have any local type before any uncovered type parameters
45+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4546
|
4647
= note: define and implement a trait or new type instead
4748

tests/ui/coherence/coherence-impls-copy.stderr

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ LL | impl Copy for &'static [NotSync] {}
1515
| ^^^^^^^^^^^^^^------------------
1616
| | |
1717
| | this is not defined in the current crate because slices are always foreign
18-
| impl doesn't use any uncovered types from inside the current crate
18+
| impl doesn't have any local type before any uncovered type parameters
19+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1920
|
2021
= note: define and implement a trait or new type instead
2122

@@ -26,7 +27,8 @@ LL | impl Copy for i32 {}
2627
| ^^^^^^^^^^^^^^---
2728
| | |
2829
| | `i32` is not defined in the current crate
29-
| impl doesn't use any uncovered types from inside the current crate
30+
| impl doesn't have any local type before any uncovered type parameters
31+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3032
|
3133
= note: define and implement a trait or new type instead
3234

@@ -43,7 +45,8 @@ LL | impl Copy for (MyType, MyType) {}
4345
| ^^^^^^^^^^^^^^----------------
4446
| | |
4547
| | this is not defined in the current crate because tuples are always foreign
46-
| impl doesn't use any uncovered types from inside the current crate
48+
| impl doesn't have any local type before any uncovered type parameters
49+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4750
|
4851
= note: define and implement a trait or new type instead
4952

@@ -60,7 +63,8 @@ LL | impl Copy for [MyType] {}
6063
| ^^^^^^^^^^^^^^--------
6164
| | |
6265
| | this is not defined in the current crate because slices are always foreign
63-
| impl doesn't use any uncovered types from inside the current crate
66+
| impl doesn't have any local type before any uncovered type parameters
67+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
6468
|
6569
= note: define and implement a trait or new type instead
6670

tests/ui/coherence/coherence-impls-send.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | unsafe impl Send for &'static [NotSync] {}
55
| ^^^^^^^^^^^^^^^^^^^^^------------------
66
| | |
77
| | this is not defined in the current crate because slices are always foreign
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

@@ -16,7 +17,8 @@ LL | unsafe impl Send for (MyType, MyType) {}
1617
| ^^^^^^^^^^^^^^^^^^^^^----------------
1718
| | |
1819
| | this is not defined in the current crate because tuples are always foreign
19-
| impl doesn't use any uncovered types from inside the current crate
20+
| impl doesn't have any local type before any uncovered type parameters
21+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2022
|
2123
= note: define and implement a trait or new type instead
2224

@@ -33,7 +35,8 @@ LL | unsafe impl Send for [MyType] {}
3335
| ^^^^^^^^^^^^^^^^^^^^^--------
3436
| | |
3537
| | this is not defined in the current crate because slices are always foreign
36-
| impl doesn't use any uncovered types from inside the current crate
38+
| impl doesn't have any local type before any uncovered type parameters
39+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3740
|
3841
= note: define and implement a trait or new type instead
3942

tests/ui/coherence/coherence-impls-sized.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ LL | impl Sized for (MyType, MyType) {}
2323
| ^^^^^^^^^^^^^^^----------------
2424
| | |
2525
| | this is not defined in the current crate because tuples are always foreign
26-
| impl doesn't use any uncovered types from inside the current crate
26+
| impl doesn't have any local type before any uncovered type parameters
27+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2728
|
2829
= note: define and implement a trait or new type instead
2930

@@ -46,7 +47,8 @@ LL | impl Sized for [MyType] {}
4647
| ^^^^^^^^^^^^^^^--------
4748
| | |
4849
| | this is not defined in the current crate because slices are always foreign
49-
| impl doesn't use any uncovered types from inside the current crate
50+
| impl doesn't have any local type before any uncovered type parameters
51+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
5052
|
5153
= note: define and implement a trait or new type instead
5254

@@ -63,7 +65,8 @@ LL | impl Sized for &'static [NotSync] {}
6365
| ^^^^^^^^^^^^^^^------------------
6466
| | |
6567
| | this is not defined in the current crate because slices are always foreign
66-
| impl doesn't use any uncovered types from inside the current crate
68+
| impl doesn't have any local type before any uncovered type parameters
69+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
6770
|
6871
= note: define and implement a trait or new type instead
6972

tests/ui/coherence/coherence-negative-impls-copy-bad.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl !Copy for str {}
55
| ^^^^^^^^^^^^^^^---
66
| | |
77
| | `str` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

@@ -16,7 +17,8 @@ LL | impl !Copy for fn() {}
1617
| ^^^^^^^^^^^^^^^----
1718
| | |
1819
| | `fn()` is not defined in the current crate
19-
| impl doesn't use any uncovered types from inside the current crate
20+
| impl doesn't have any local type before any uncovered type parameters
21+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2022
|
2123
= note: define and implement a trait or new type instead
2224

@@ -27,7 +29,8 @@ LL | impl !Copy for () {}
2729
| ^^^^^^^^^^^^^^^--
2830
| | |
2931
| | this is not defined in the current crate because tuples are always foreign
30-
| impl doesn't use any uncovered types from inside the current crate
32+
| impl doesn't have any local type before any uncovered type parameters
33+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3134
|
3235
= note: define and implement a trait or new type instead
3336

tests/ui/coherence/coherence-orphan.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ LL | impl TheTrait<usize> for isize {}
66
| | | |
77
| | | `isize` is not defined in the current crate
88
| | `usize` is not defined in the current crate
9-
| impl doesn't use any uncovered types from inside the current crate
9+
| impl doesn't have any local type before any uncovered type parameters
10+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1011
|
1112
= note: define and implement a trait or new type instead
1213

@@ -17,7 +18,8 @@ LL | impl !Send for Vec<isize> {}
1718
| ^^^^^^^^^^^^^^^----------
1819
| | |
1920
| | `Vec` is not defined in the current crate
20-
| impl doesn't use any uncovered types from inside the current crate
21+
| impl doesn't have any local type before any uncovered type parameters
22+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2123
|
2224
= note: define and implement a trait or new type instead
2325

tests/ui/coherence/coherence-overlapping-pairs.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T> Remote for lib::Pair<T,Foo> { }
55
| ^^^^^^^^^^^^^^^^^^^----------------
66
| | |
77
| | `Pair` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-pair-covered-uncovered-1.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
66
| | | |
77
| | | `i32` is not defined in the current crate
88
| | `Pair` is not defined in the current crate
9-
| impl doesn't use any uncovered types from inside the current crate
9+
| impl doesn't have any local type before any uncovered type parameters
10+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1011
|
1112
= note: define and implement a trait or new type instead
1213

tests/ui/coherence/coherence-pair-covered-uncovered.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T,U> Remote for Pair<T,Local<U>> { }
55
| ^^^^^^^^^^^^^^^^^^^^^----------------
66
| | |
77
| | `Pair` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-vec-local-2.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl<T> Remote for Vec<Local<T>> { }
55
| ^^^^^^^^^^^^^^^^^^^-------------
66
| | |
77
| | `Vec` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence-vec-local.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl Remote for Vec<Local> { }
55
| ^^^^^^^^^^^^^^^^----------
66
| | |
77
| | `Vec` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence_local_err_struct.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl lib::MyCopy for lib::MyStruct<MyType> { }
55
| ^^^^^^^^^^^^^^^^^^^^^---------------------
66
| | |
77
| | `MyStruct` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/coherence_local_err_tuple.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl lib::MyCopy for (MyType,) { }
55
| ^^^^^^^^^^^^^^^^^^^^^---------
66
| | |
77
| | this is not defined in the current crate because tuples are always foreign
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/impl-foreign-for-foreign.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | impl Remote for i32 {
55
| ^^^^^^^^^^^^^^^^---
66
| | |
77
| | `i32` is not defined in the current crate
8-
| impl doesn't use any uncovered types from inside the current crate
8+
| impl doesn't have any local type before any uncovered type parameters
9+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
910
|
1011
= note: define and implement a trait or new type instead
1112

tests/ui/coherence/impl-foreign-for-foreign[foreign].stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ LL | impl Remote1<Rc<i32>> for i32 {
66
| | | |
77
| | | `i32` is not defined in the current crate
88
| | `Rc` is not defined in the current crate
9-
| impl doesn't use any uncovered types from inside the current crate
9+
| impl doesn't have any local type before any uncovered type parameters
10+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1011
|
1112
= note: define and implement a trait or new type instead
1213

@@ -18,7 +19,8 @@ LL | impl Remote1<Rc<Local>> for f64 {
1819
| | | |
1920
| | | `f64` is not defined in the current crate
2021
| | `Rc` is not defined in the current crate
21-
| impl doesn't use any uncovered types from inside the current crate
22+
| impl doesn't have any local type before any uncovered type parameters
23+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2224
|
2325
= note: define and implement a trait or new type instead
2426

@@ -30,7 +32,8 @@ LL | impl<T> Remote1<Rc<T>> for f32 {
3032
| | | |
3133
| | | `f32` is not defined in the current crate
3234
| | `Rc` is not defined in the current crate
33-
| impl doesn't use any uncovered types from inside the current crate
35+
| impl doesn't have any local type before any uncovered type parameters
36+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3437
|
3538
= note: define and implement a trait or new type instead
3639

tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ LL | impl Remote for Box<i32> {
66
| | | |
77
| | | `i32` is not defined in the current crate
88
| | `std::alloc::Global` is not defined in the current crate
9-
| impl doesn't use any uncovered types from inside the current crate
9+
| impl doesn't have any local type before any uncovered type parameters
10+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1011
|
1112
= note: define and implement a trait or new type instead
1213

@@ -18,7 +19,8 @@ LL | impl<T> Remote for Box<Rc<T>> {
1819
| | | |
1920
| | | `Rc` is not defined in the current crate
2021
| | `std::alloc::Global` is not defined in the current crate
21-
| impl doesn't use any uncovered types from inside the current crate
22+
| impl doesn't have any local type before any uncovered type parameters
23+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2224
|
2325
= note: define and implement a trait or new type instead
2426

tests/ui/coherence/impl-foreign[foreign]-for-foreign.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ LL | impl Remote1<u32> for f64 {
66
| | | |
77
| | | `f64` is not defined in the current crate
88
| | `u32` is not defined in the current crate
9-
| impl doesn't use any uncovered types from inside the current crate
9+
| impl doesn't have any local type before any uncovered type parameters
10+
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1011
|
1112
= note: define and implement a trait or new type instead
1213

0 commit comments

Comments
 (0)