Skip to content

Commit b89c620

Browse files
committed
Make new information notes instead of labels
1 parent ca94dd5 commit b89c620

36 files changed

+248
-248
lines changed

compiler/rustc_hir_analysis/messages.ftl

+4-4
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,14 @@ 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 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
357-
358354
hir_analysis_only_current_traits_name = this is not defined in the current crate because {$name} are always foreign
359355
360356
hir_analysis_only_current_traits_note = define and implement a trait or new type instead
361357
358+
hir_analysis_only_current_traits_note_more_info = for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
359+
360+
hir_analysis_only_current_traits_note_uncovered = impl doesn't have any local type before any uncovered type parameters
361+
362362
hir_analysis_only_current_traits_opaque = type alias impl trait is treated as if it were foreign, because its hidden type could be from a foreign crate
363363
364364
hir_analysis_only_current_traits_outside = only traits defined in the current crate can be implemented for types defined outside of the crate

compiler/rustc_hir_analysis/src/errors.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1440,27 +1440,27 @@ pub enum OnlyCurrentTraits {
14401440
#[diag(hir_analysis_only_current_traits_outside, code = E0117)]
14411441
Outside {
14421442
#[primary_span]
1443-
#[label(hir_analysis_only_current_traits_label)]
1444-
#[label(hir_analysis_only_current_traits_label_more_info)]
14451443
span: Span,
1444+
#[note(hir_analysis_only_current_traits_note_uncovered)]
1445+
#[note(hir_analysis_only_current_traits_note_more_info)]
14461446
#[note(hir_analysis_only_current_traits_note)]
14471447
note: (),
14481448
},
14491449
#[diag(hir_analysis_only_current_traits_primitive, code = E0117)]
14501450
Primitive {
14511451
#[primary_span]
1452-
#[label(hir_analysis_only_current_traits_label)]
1453-
#[label(hir_analysis_only_current_traits_label_more_info)]
14541452
span: Span,
1453+
#[note(hir_analysis_only_current_traits_note_uncovered)]
1454+
#[note(hir_analysis_only_current_traits_note_more_info)]
14551455
#[note(hir_analysis_only_current_traits_note)]
14561456
note: (),
14571457
},
14581458
#[diag(hir_analysis_only_current_traits_arbitrary, code = E0117)]
14591459
Arbitrary {
14601460
#[primary_span]
1461-
#[label(hir_analysis_only_current_traits_label)]
1462-
#[label(hir_analysis_only_current_traits_label_more_info)]
14631461
span: Span,
1462+
#[note(hir_analysis_only_current_traits_note_uncovered)]
1463+
#[note(hir_analysis_only_current_traits_note_more_info)]
14641464
#[note(hir_analysis_only_current_traits_note)]
14651465
note: (),
14661466
},

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ty
33
|
44
LL | impl<T> Remote for Pair<T,Cover<T>> { }
55
| ^^^^^^^^^^^^^^^^^^^----------------
6-
| | |
7-
| | `Pair` is not defined in 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
6+
| |
7+
| `Pair` is not defined in the current crate
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to 1 previous error

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ty
33
|
44
LL | impl<T> Remote for Pair<Cover<T>,T> { }
55
| ^^^^^^^^^^^^^^^^^^^----------------
6-
| | |
7-
| | `Pair` is not defined in 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
6+
| |
7+
| `Pair` is not defined in the current crate
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to 1 previous error

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ty
33
|
44
LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
55
| ^^^^^^^^^^^^^^^^^^^^^----------------
6-
| | |
7-
| | `Pair` is not defined in 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
6+
| |
7+
| `Pair` is not defined in the current crate
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to 1 previous error

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
33
|
44
LL | impl Misc for dyn Fundamental<Local> {}
55
| ^^^^^^^^^^^^^^----------------------
6-
| | |
7-
| | `dyn Fundamental<Local>` is not defined in 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
6+
| |
7+
| `dyn Fundamental<Local>` is not defined in the current crate
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to 1 previous error

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
3939
|
4040
LL | impl !Send for dyn Marker2 {}
4141
| ^^^^^^^^^^^^^^^-----------
42-
| | |
43-
| | `dyn Marker2` is not defined in 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
42+
| |
43+
| `dyn Marker2` is not defined in the current crate
4644
|
45+
= note: impl doesn't have any local type before any uncovered type parameters
46+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4747
= note: define and implement a trait or new type instead
4848

4949
error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)`

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
3939
|
4040
LL | unsafe impl Send for dyn Marker2 {}
4141
| ^^^^^^^^^^^^^^^^^^^^^-----------
42-
| | |
43-
| | `dyn Marker2` is not defined in 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
42+
| |
43+
| `dyn Marker2` is not defined in the current crate
4644
|
45+
= note: impl doesn't have any local type before any uncovered type parameters
46+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4747
= note: define and implement a trait or new type instead
4848

4949
error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)`

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
1313
|
1414
LL | impl Copy for &'static [NotSync] {}
1515
| ^^^^^^^^^^^^^^------------------
16-
| | |
17-
| | this is not defined in the current crate because slices are always foreign
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
16+
| |
17+
| this is not defined in the current crate because slices are always foreign
2018
|
19+
= note: impl doesn't have any local type before any uncovered type parameters
20+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2121
= note: define and implement a trait or new type instead
2222

2323
error[E0117]: only traits defined in the current crate can be implemented for primitive types
2424
--> $DIR/coherence-impls-copy.rs:5:1
2525
|
2626
LL | impl Copy for i32 {}
2727
| ^^^^^^^^^^^^^^---
28-
| | |
29-
| | `i32` is not defined in 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
28+
| |
29+
| `i32` is not defined in the current crate
3230
|
31+
= note: impl doesn't have any local type before any uncovered type parameters
32+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3333
= note: define and implement a trait or new type instead
3434

3535
error[E0206]: the trait `Copy` cannot be implemented for this type
@@ -43,11 +43,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
4343
|
4444
LL | impl Copy for (MyType, MyType) {}
4545
| ^^^^^^^^^^^^^^----------------
46-
| | |
47-
| | this is not defined in the current crate because tuples are always foreign
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
46+
| |
47+
| this is not defined in the current crate because tuples are always foreign
5048
|
49+
= note: impl doesn't have any local type before any uncovered type parameters
50+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
5151
= note: define and implement a trait or new type instead
5252

5353
error[E0206]: the trait `Copy` cannot be implemented for this type
@@ -61,11 +61,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
6161
|
6262
LL | impl Copy for [MyType] {}
6363
| ^^^^^^^^^^^^^^--------
64-
| | |
65-
| | this is not defined in the current crate because slices are always foreign
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
64+
| |
65+
| this is not defined in the current crate because slices are always foreign
6866
|
67+
= note: impl doesn't have any local type before any uncovered type parameters
68+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
6969
= note: define and implement a trait or new type instead
7070

7171
error[E0206]: the trait `Copy` cannot be implemented for this type

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
33
|
44
LL | unsafe impl Send for &'static [NotSync] {}
55
| ^^^^^^^^^^^^^^^^^^^^^------------------
6-
| | |
7-
| | this is not defined in the current crate because slices are always foreign
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
6+
| |
7+
| this is not defined in the current crate because slices are always foreign
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
1414
--> $DIR/coherence-impls-send.rs:16:1
1515
|
1616
LL | unsafe impl Send for (MyType, MyType) {}
1717
| ^^^^^^^^^^^^^^^^^^^^^----------------
18-
| | |
19-
| | this is not defined in the current crate because tuples are always foreign
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
18+
| |
19+
| this is not defined in the current crate because tuples are always foreign
2220
|
21+
= note: impl doesn't have any local type before any uncovered type parameters
22+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2323
= note: define and implement a trait or new type instead
2424

2525
error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `&'static NotSync`
@@ -33,11 +33,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
3333
|
3434
LL | unsafe impl Send for [MyType] {}
3535
| ^^^^^^^^^^^^^^^^^^^^^--------
36-
| | |
37-
| | this is not defined in the current crate because slices are always foreign
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
36+
| |
37+
| this is not defined in the current crate because slices are always foreign
4038
|
39+
= note: impl doesn't have any local type before any uncovered type parameters
40+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
4141
= note: define and implement a trait or new type instead
4242

4343
error: aborting due to 4 previous errors

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
2121
|
2222
LL | impl Sized for (MyType, MyType) {}
2323
| ^^^^^^^^^^^^^^^----------------
24-
| | |
25-
| | this is not defined in the current crate because tuples are always foreign
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
24+
| |
25+
| this is not defined in the current crate because tuples are always foreign
2826
|
27+
= note: impl doesn't have any local type before any uncovered type parameters
28+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2929
= note: define and implement a trait or new type instead
3030

3131
error[E0322]: explicit impls for the `Sized` trait are not permitted
@@ -45,11 +45,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
4545
|
4646
LL | impl Sized for [MyType] {}
4747
| ^^^^^^^^^^^^^^^--------
48-
| | |
49-
| | this is not defined in the current crate because slices are always foreign
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
48+
| |
49+
| this is not defined in the current crate because slices are always foreign
5250
|
51+
= note: impl doesn't have any local type before any uncovered type parameters
52+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
5353
= note: define and implement a trait or new type instead
5454

5555
error[E0322]: explicit impls for the `Sized` trait are not permitted
@@ -63,11 +63,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
6363
|
6464
LL | impl Sized for &'static [NotSync] {}
6565
| ^^^^^^^^^^^^^^^------------------
66-
| | |
67-
| | this is not defined in the current crate because slices are always foreign
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
66+
| |
67+
| this is not defined in the current crate because slices are always foreign
7068
|
69+
= note: impl doesn't have any local type before any uncovered type parameters
70+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
7171
= note: define and implement a trait or new type instead
7272

7373
error: aborting due to 9 previous errors

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
33
|
44
LL | impl !Copy for str {}
55
| ^^^^^^^^^^^^^^^---
6-
| | |
7-
| | `str` is not defined in 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
6+
| |
7+
| `str` is not defined in the current crate
108
|
9+
= note: impl doesn't have any local type before any uncovered type parameters
10+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
1111
= note: define and implement a trait or new type instead
1212

1313
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
1414
--> $DIR/coherence-negative-impls-copy-bad.rs:7:1
1515
|
1616
LL | impl !Copy for fn() {}
1717
| ^^^^^^^^^^^^^^^----
18-
| | |
19-
| | `fn()` is not defined in 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
18+
| |
19+
| `fn()` is not defined in the current crate
2220
|
21+
= note: impl doesn't have any local type before any uncovered type parameters
22+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
2323
= note: define and implement a trait or new type instead
2424

2525
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2626
--> $DIR/coherence-negative-impls-copy-bad.rs:10:1
2727
|
2828
LL | impl !Copy for () {}
2929
| ^^^^^^^^^^^^^^^--
30-
| | |
31-
| | this is not defined in the current crate because tuples are always foreign
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
30+
| |
31+
| this is not defined in the current crate because tuples are always foreign
3432
|
33+
= note: impl doesn't have any local type before any uncovered type parameters
34+
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
3535
= note: define and implement a trait or new type instead
3636

3737
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)