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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 8 additions & 4 deletions
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

Lines changed: 6 additions & 3 deletions
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

0 commit comments

Comments
 (0)