Skip to content

Commit 641bd12

Browse files
Add note to lint message
1 parent 7654c22 commit 641bd12

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ lint_unused_op = unused {$op} that must be used
949949
lint_unused_result = unused result of type `{$ty}`
950950
951951
lint_unused_visibilities = visibility qualifiers have no effect on `const _` declarations
952+
.note = there is no declared name for the qualifier to affect
952953
.suggestion = remove the qualifier
953954
954955
lint_use_let_underscore_ignore_suggestion = use `let _ = ...` to ignore the expression or result

compiler/rustc_lint/src/lints.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,6 +3150,7 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
31503150

31513151
#[derive(LintDiagnostic)]
31523152
#[diag(lint_unused_visibilities)]
3153+
#[note]
31533154
pub(crate) struct UnusedVisibility {
31543155
#[suggestion(style = "short", code = "", applicability = "machine-applicable")]
31553156
pub span: Span,

tests/ui/lint/unused-visibilities.stderr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ warning: visibility qualifiers have no effect on `const _` declarations
44
LL | pub const _: () = {};
55
| ^^^ help: remove the qualifier
66
|
7+
= note: there is no declared name for the qualifier to affect
78
note: the lint level is defined here
89
--> $DIR/unused-visibilities.rs:4:9
910
|
@@ -15,6 +16,8 @@ warning: visibility qualifiers have no effect on `const _` declarations
1516
|
1617
LL | pub(self) const _: () = {};
1718
| ^^^^^^^^^ help: remove the qualifier
19+
|
20+
= note: there is no declared name for the qualifier to affect
1821

1922
warning: visibility qualifiers have no effect on `const _` declarations
2023
--> $DIR/unused-visibilities.rs:14:9
@@ -25,6 +28,7 @@ LL | pub const _: () = {};
2528
LL | foo!();
2629
| ------ in this macro invocation
2730
|
31+
= note: there is no declared name for the qualifier to affect
2832
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
2933

3034
warning: 3 warnings emitted

0 commit comments

Comments
 (0)