Skip to content

Commit 9dc729e

Browse files
committed
clarify on_missing_args help text
1 parent 889390c commit 9dc729e

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

compiler/rustc_passes/src/errors.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,9 +1359,7 @@ pub(crate) struct OnMoveMalformedFormatLiterals {
13591359

13601360
#[derive(Diagnostic)]
13611361
#[diag("unknown parameter `{$name}`")]
1362-
#[help(
1363-
r#"the only supported format parameter for `#[diagnostic::on_missing_args]` is {"`{This}`"}"#
1364-
)]
1362+
#[help(r#"use {"`{This}`"} to refer to the macro name"#)]
13651363
pub(crate) struct OnMissingArgsMalformedFormatLiterals {
13661364
pub name: Symbol,
13671365
}

tests/ui/diagnostic_namespace/on_missing_args/report_warning_on_invalid_formats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(diagnostic_on_missing_args)]
33

44
#[diagnostic::on_missing_args(
5-
message = "pair! is missing {T}",
5+
message = "{T}! is missing arguments",
66
//~^ WARN unknown parameter `T`
77
)]
88
macro_rules! pair {

tests/ui/diagnostic_namespace/on_missing_args/report_warning_on_invalid_formats.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
warning: unknown parameter `T`
2-
--> $DIR/report_warning_on_invalid_formats.rs:5:34
2+
--> $DIR/report_warning_on_invalid_formats.rs:5:17
33
|
4-
LL | message = "pair! is missing {T}",
5-
| ^
4+
LL | message = "{T}! is missing arguments",
5+
| ^
66
|
7-
= help: the only supported format parameter for `#[diagnostic::on_missing_args]` is `{This}`
7+
= help: use `{This}` to refer to the macro name
88
= note: `#[warn(malformed_diagnostic_format_literals)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
99

1010
warning: 1 warning emitted

0 commit comments

Comments
 (0)