Skip to content

Commit 30fac00

Browse files
committed
fix diagnostic derive
1 parent 9d8105d commit 30fac00

File tree

5 files changed

+215
-234
lines changed

5 files changed

+215
-234
lines changed

compiler/rustc_macros/src/diagnostics/subdiagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
202202
(None, None) => {
203203
throw_span_err!(
204204
attr.span().unwrap(),
205-
"diagnostic slug or raw_label must be first argument of a `#[{name}(...)]` attribute"
205+
"diagnostic slug or raw_label must be first argument of a attribute"
206206
);
207207
}
208208
(Some(_), Some(_)) => {

tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ struct HelloWarn {}
4545
//~^ ERROR unsupported type attribute for diagnostic derive enum
4646
enum DiagnosticOnEnum {
4747
Foo,
48-
//~^ ERROR diagnostic slug not specified
48+
//~^ ERROR diagnostic slug or label is not specified
4949
Bar,
50-
//~^ ERROR diagnostic slug not specified
50+
//~^ ERROR diagnostic slug or label is not specified
5151
}
5252

5353
#[derive(Diagnostic)]
@@ -59,13 +59,12 @@ struct WrongStructAttrStyle {}
5959
#[derive(Diagnostic)]
6060
#[nonsense(no_crate_example, code = "E0123")]
6161
//~^ ERROR `#[nonsense(...)]` is not a valid attribute
62-
//~^^ ERROR diagnostic slug not specified
62+
//~^^ ERROR diagnostic slug or label is not specified
6363
//~^^^ ERROR cannot find attribute `nonsense` in this scope
6464
struct InvalidStructAttr {}
6565

6666
#[derive(Diagnostic)]
6767
#[diag("E0123")]
68-
//~^ ERROR diagnostic slug not specified
6968
struct InvalidLitNestedAttr {}
7069

7170
#[derive(Diagnostic)]
@@ -75,20 +74,20 @@ struct InvalidNestedStructAttr {}
7574

7675
#[derive(Diagnostic)]
7776
#[diag(nonsense("foo"), code = "E0123", slug = "foo")]
78-
//~^ ERROR diagnostic slug must be the first argument
79-
//~| ERROR diagnostic slug not specified
77+
//~^ ERROR diagnostic slug or label is not specified
78+
//~| ERROR diagnostic slug must be the first argument
8079
struct InvalidNestedStructAttr1 {}
8180

8281
#[derive(Diagnostic)]
8382
#[diag(nonsense = "...", code = "E0123", slug = "foo")]
8483
//~^ ERROR unknown argument
85-
//~| ERROR diagnostic slug not specified
84+
//~| ERROR diagnostic slug or label is not specified
8685
struct InvalidNestedStructAttr2 {}
8786

8887
#[derive(Diagnostic)]
8988
#[diag(nonsense = 4, code = "E0123", slug = "foo")]
9089
//~^ ERROR unknown argument
91-
//~| ERROR diagnostic slug not specified
90+
//~| ERROR diagnostic slug or label is not specified
9291
struct InvalidNestedStructAttr3 {}
9392

9493
#[derive(Diagnostic)]
@@ -122,11 +121,11 @@ struct CodeSpecifiedTwice {}
122121
struct SlugSpecifiedTwice {}
123122

124123
#[derive(Diagnostic)]
125-
struct KindNotProvided {} //~ ERROR diagnostic slug not specified
124+
struct KindNotProvided {} //~ ERROR diagnostic slug or label is not specified
126125

127126
#[derive(Diagnostic)]
128127
#[diag(code = "E0456")]
129-
//~^ ERROR diagnostic slug not specified
128+
//~^ ERROR diagnostic slug or label is not specified
130129
struct SlugNotProvided {}
131130

132131
#[derive(Diagnostic)]
@@ -579,21 +578,21 @@ struct ErrorWithWarn {
579578
#[derive(Diagnostic)]
580579
#[error(no_crate_example, code = "E0123")]
581580
//~^ ERROR `#[error(...)]` is not a valid attribute
582-
//~| ERROR diagnostic slug not specified
581+
//~| ERROR diagnostic slug or label is not specified
583582
//~| ERROR cannot find attribute `error` in this scope
584583
struct ErrorAttribute {}
585584

586585
#[derive(Diagnostic)]
587586
#[warn_(no_crate_example, code = "E0123")]
588587
//~^ ERROR `#[warn_(...)]` is not a valid attribute
589-
//~| ERROR diagnostic slug not specified
588+
//~| ERROR diagnostic slug or label is not specified
590589
//~| ERROR cannot find attribute `warn_` in this scope
591590
struct WarnAttribute {}
592591

593592
#[derive(Diagnostic)]
594593
#[lint(no_crate_example, code = "E0123")]
595594
//~^ ERROR `#[lint(...)]` is not a valid attribute
596-
//~| ERROR diagnostic slug not specified
595+
//~| ERROR diagnostic slug or label is not specified
597596
//~| ERROR cannot find attribute `lint` in this scope
598597
struct LintAttributeOnSessionDiag {}
599598

0 commit comments

Comments
 (0)