Skip to content

Commit fc01b4b

Browse files
committedApr 6, 2023
fix and bless ui tests 1/2
·
1.88.01.70.0
1 parent af74ef8 commit fc01b4b

File tree

5 files changed

+288
-271
lines changed

5 files changed

+288
-271
lines changed
 

‎compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,15 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> {
214214
if path.is_ident("code") {
215215
self.code.set_once((), path.span().unwrap());
216216

217-
let code = nested.parse::<TokenStream>()?;
217+
let code = nested.parse::<syn::LitStr>()?;
218218
tokens.extend(quote! {
219219
#diag.code(rustc_errors::DiagnosticId::Error(#code.to_string()));
220220
});
221+
} else {
222+
span_err(path.span().unwrap(), "unknown argument").note("only the `code` parameter is valid after the slug").emit();
223+
224+
// consume the buffer so we don't have syntax errors from syn
225+
let _ = nested.parse::<TokenStream>();
221226
}
222227
Ok(())
223228
})?;

‎compiler/rustc_macros/src/diagnostics/utils.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ impl SubdiagnosticKind {
716716
}
717717
}
718718

719+
let mut has_errors = false;
720+
let input = nested.input;
721+
719722
match (nested_name, &mut kind) {
720723
("code", SubdiagnosticKind::Suggestion { code_field, .. }) => {
721724
let code_init = build_suggestion_code(
@@ -734,6 +737,7 @@ impl SubdiagnosticKind {
734737
let value = get_string!();
735738
let value = Applicability::from_str(&value.value()).unwrap_or_else(|()| {
736739
span_err(value.span().unwrap(), "invalid applicability").emit();
740+
has_errors = true;
737741
Applicability::Unspecified
738742
});
739743
applicability.set_once(value, span);
@@ -749,6 +753,7 @@ impl SubdiagnosticKind {
749753
span_err(value.span().unwrap(), "invalid suggestion style")
750754
.help("valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`")
751755
.emit();
756+
has_errors = true;
752757
SuggestionKind::Normal
753758
});
754759

@@ -762,17 +767,25 @@ impl SubdiagnosticKind {
762767
"only `style`, `code` and `applicability` are valid nested attributes",
763768
)
764769
.emit();
770+
has_errors = true;
765771
}
766772
(_, SubdiagnosticKind::MultipartSuggestion { .. }) => {
767773
span_err(path_span, "invalid nested attribute")
768774
.help("only `style` and `applicability` are valid nested attributes")
769775
.emit();
776+
has_errors = true;
770777
}
771778
_ => {
772779
span_err(path_span, "invalid nested attribute").emit();
780+
has_errors = true;
773781
}
774782
}
775783

784+
if has_errors {
785+
// Consume the rest of the input to avoid spamming errors
786+
let _ = input.parse::<TokenStream>();
787+
}
788+
776789
Ok(())
777790
})?;
778791

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

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ enum DiagnosticOnEnum {
5050
#[derive(Diagnostic)]
5151
#[diag(no_crate_example, code = "E0123")]
5252
#[diag = "E0123"]
53-
//~^ ERROR `#[diag = ...]` is not a valid attribute
53+
//~^ ERROR expected parentheses: #[diag(...)]
5454
struct WrongStructAttrStyle {}
5555

5656
#[derive(Diagnostic)]
@@ -62,8 +62,7 @@ struct InvalidStructAttr {}
6262

6363
#[derive(Diagnostic)]
6464
#[diag("E0123")]
65-
//~^ ERROR `#[diag("...")]` is not a valid attribute
66-
//~^^ ERROR diagnostic slug not specified
65+
//~^ ERROR diagnostic slug not specified
6766
struct InvalidLitNestedAttr {}
6867

6968
#[derive(Diagnostic)]
@@ -73,27 +72,25 @@ struct InvalidNestedStructAttr {}
7372

7473
#[derive(Diagnostic)]
7574
#[diag(nonsense("foo"), code = "E0123", slug = "foo")]
76-
//~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute
77-
//~^^ ERROR diagnostic slug not specified
75+
//~^ ERROR diagnostic slug must be the first argument
76+
//~| ERROR diagnostic slug not specified
7877
struct InvalidNestedStructAttr1 {}
7978

8079
#[derive(Diagnostic)]
8180
#[diag(nonsense = "...", code = "E0123", slug = "foo")]
82-
//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
83-
//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
81+
//~^ ERROR unknown argument
8482
//~| ERROR diagnostic slug not specified
8583
struct InvalidNestedStructAttr2 {}
8684

8785
#[derive(Diagnostic)]
8886
#[diag(nonsense = 4, code = "E0123", slug = "foo")]
89-
//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
90-
//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
87+
//~^ ERROR unknown argument
9188
//~| ERROR diagnostic slug not specified
9289
struct InvalidNestedStructAttr3 {}
9390

9491
#[derive(Diagnostic)]
9592
#[diag(no_crate_example, code = "E0123", slug = "foo")]
96-
//~^ ERROR `#[diag(slug = ...)]` is not a valid attribute
93+
//~^ ERROR unknown argument
9794
struct InvalidNestedStructAttr4 {}
9895

9996
#[derive(Diagnostic)]
@@ -118,7 +115,7 @@ struct CodeSpecifiedTwice {}
118115

119116
#[derive(Diagnostic)]
120117
#[diag(no_crate_example, no_crate::example, code = "E0456")]
121-
//~^ ERROR `#[diag(no_crate::example)]` is not a valid attribute
118+
//~^ ERROR diagnostic slug must be the first argument
122119
struct SlugSpecifiedTwice {}
123120

124121
#[derive(Diagnostic)]
@@ -232,7 +229,7 @@ struct SuggestWithoutCode {
232229
#[diag(no_crate_example, code = "E0123")]
233230
struct SuggestWithBadKey {
234231
#[suggestion(nonsense = "bar")]
235-
//~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute
232+
//~^ ERROR invalid nested attribute
236233
//~| ERROR suggestion without `code = "..."`
237234
suggestion: (Span, Applicability),
238235
}
@@ -241,7 +238,7 @@ struct SuggestWithBadKey {
241238
#[diag(no_crate_example, code = "E0123")]
242239
struct SuggestWithShorthandMsg {
243240
#[suggestion(msg = "bar")]
244-
//~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute
241+
//~^ ERROR invalid nested attribute
245242
//~| ERROR suggestion without `code = "..."`
246243
suggestion: (Span, Applicability),
247244
}
@@ -530,23 +527,23 @@ struct BoolField {
530527
#[diag(no_crate_example, code = "E0123")]
531528
struct LabelWithTrailingPath {
532529
#[label(no_crate_label, foo)]
533-
//~^ ERROR `#[label(foo)]` is not a valid attribute
530+
//~^ ERROR a diagnostic slug must be the first argument to the attribute
534531
span: Span,
535532
}
536533

537534
#[derive(Diagnostic)]
538535
#[diag(no_crate_example, code = "E0123")]
539536
struct LabelWithTrailingNameValue {
540537
#[label(no_crate_label, foo = "...")]
541-
//~^ ERROR `#[label(foo = ...)]` is not a valid attribute
538+
//~^ ERROR invalid nested attribute
542539
span: Span,
543540
}
544541

545542
#[derive(Diagnostic)]
546543
#[diag(no_crate_example, code = "E0123")]
547544
struct LabelWithTrailingList {
548545
#[label(no_crate_label, foo("..."))]
549-
//~^ ERROR `#[label(foo(...))]` is not a valid attribute
546+
//~^ ERROR invalid nested attribute
550547
span: Span,
551548
}
552549

@@ -643,8 +640,8 @@ struct MissingCodeInSuggestion {
643640
//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
644641
//~| ERROR cannot find attribute `multipart_suggestion` in this scope
645642
#[multipart_suggestion()]
646-
//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
647-
//~| ERROR cannot find attribute `multipart_suggestion` in this scope
643+
//~^ ERROR cannot find attribute `multipart_suggestion` in this scope
644+
//~| ERROR unexpected end of input, unexpected token in nested attribute, expected ident
648645
struct MultipartSuggestion {
649646
#[multipart_suggestion(no_crate_suggestion)]
650647
//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
@@ -698,7 +695,7 @@ struct RawIdentDiagnosticArg {
698695
#[diag(no_crate_example)]
699696
struct SubdiagnosticBad {
700697
#[subdiagnostic(bad)]
701-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
698+
//~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
702699
note: Note,
703700
}
704701

@@ -714,15 +711,15 @@ struct SubdiagnosticBadStr {
714711
#[diag(no_crate_example)]
715712
struct SubdiagnosticBadTwice {
716713
#[subdiagnostic(bad, bad)]
717-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
714+
//~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
718715
note: Note,
719716
}
720717

721718
#[derive(Diagnostic)]
722719
#[diag(no_crate_example)]
723720
struct SubdiagnosticBadLitStr {
724721
#[subdiagnostic("bad")]
725-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
722+
//~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
726723
note: Note,
727724
}
728725

@@ -797,14 +794,15 @@ struct SuggestionsNoItem {
797794
struct SuggestionsInvalidItem {
798795
#[suggestion(code(foo))]
799796
//~^ ERROR `code(...)` must contain only string literals
797+
//~| ERROR unexpected token
800798
sub: Span,
801799
}
802800

803-
#[derive(Diagnostic)]
801+
#[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope
804802
#[diag(no_crate_example)]
805803
struct SuggestionsInvalidLiteral {
806804
#[suggestion(code = 3)]
807-
//~^ ERROR `code = "..."`/`code(...)` must contain only string literals
805+
//~^ ERROR expected string literal
808806
sub: Span,
809807
}
810808

‎tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr

Lines changed: 144 additions & 169 deletions
Large diffs are not rendered by default.

‎tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr

Lines changed: 104 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -26,71 +26,65 @@ error: `#[label = ...]` is not a valid attribute
2626
LL | #[label = "..."]
2727
| ^^^^^^^^^^^^^^^^
2828

29-
error: `#[label(bug = ...)]` is not a valid attribute
29+
error: invalid nested attribute
3030
--> $DIR/subdiagnostic-derive.rs:84:9
3131
|
3232
LL | #[label(bug = "...")]
33-
| ^^^^^^^^^^^
33+
| ^^^
3434

3535
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
3636
--> $DIR/subdiagnostic-derive.rs:84:1
3737
|
3838
LL | #[label(bug = "...")]
3939
| ^^^^^^^^^^^^^^^^^^^^^
4040

41-
error: `#[label("...")]` is not a valid attribute
41+
error: unexpected literal in nested attribute, expected ident
4242
--> $DIR/subdiagnostic-derive.rs:94:9
4343
|
4444
LL | #[label("...")]
4545
| ^^^^^
4646

47-
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
48-
--> $DIR/subdiagnostic-derive.rs:94:1
49-
|
50-
LL | #[label("...")]
51-
| ^^^^^^^^^^^^^^^
52-
53-
error: `#[label(slug = ...)]` is not a valid attribute
47+
error: invalid nested attribute
5448
--> $DIR/subdiagnostic-derive.rs:104:9
5549
|
5650
LL | #[label(slug = 4)]
57-
| ^^^^^^^^
51+
| ^^^^
5852

5953
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
6054
--> $DIR/subdiagnostic-derive.rs:104:1
6155
|
6256
LL | #[label(slug = 4)]
6357
| ^^^^^^^^^^^^^^^^^^
6458

65-
error: `#[label(slug(...))]` is not a valid attribute
59+
error: invalid nested attribute
6660
--> $DIR/subdiagnostic-derive.rs:114:9
6761
|
6862
LL | #[label(slug("..."))]
69-
| ^^^^^^^^^^^
63+
| ^^^^
7064

7165
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
7266
--> $DIR/subdiagnostic-derive.rs:114:1
7367
|
7468
LL | #[label(slug("..."))]
7569
| ^^^^^^^^^^^^^^^^^^^^^
7670

77-
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
78-
--> $DIR/subdiagnostic-derive.rs:134:1
71+
error: unexpected end of input, unexpected token in nested attribute, expected ident
72+
--> $DIR/subdiagnostic-derive.rs:134:9
7973
|
8074
LL | #[label()]
81-
| ^^^^^^^^^^
75+
| ^
8276

83-
error: `#[label(code = ...)]` is not a valid attribute
77+
error: invalid nested attribute
8478
--> $DIR/subdiagnostic-derive.rs:143:27
8579
|
8680
LL | #[label(no_crate_example, code = "...")]
87-
| ^^^^^^^^^^^^
81+
| ^^^^
8882

89-
error: `#[label(applicability = ...)]` is not a valid attribute
83+
error: invalid nested attribute
9084
--> $DIR/subdiagnostic-derive.rs:152:27
9185
|
9286
LL | #[label(no_crate_example, applicability = "machine-applicable")]
93-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87+
| ^^^^^^^^^^^^^
9488

9589
error: unsupported type attribute for subdiagnostic enum
9690
--> $DIR/subdiagnostic-derive.rs:161:1
@@ -122,11 +116,11 @@ error: `#[bar(...)]` is not a valid attribute
122116
LL | #[bar("...")]
123117
| ^^^^^^^^^^^^^
124118

125-
error: `#[label(code = ...)]` is not a valid attribute
119+
error: invalid nested attribute
126120
--> $DIR/subdiagnostic-derive.rs:223:13
127121
|
128122
LL | #[label(code = "...")]
129-
| ^^^^^^^^^^^^
123+
| ^^^^
130124

131125
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
132126
--> $DIR/subdiagnostic-derive.rs:223:5
@@ -190,13 +184,11 @@ LL | | b: u64,
190184
LL | | }
191185
| |_^
192186

193-
error: `#[label(no_crate::example)]` is not a valid attribute
194-
--> $DIR/subdiagnostic-derive.rs:325:27
187+
error: a diagnostic slug must be the first argument to the attribute
188+
--> $DIR/subdiagnostic-derive.rs:325:44
195189
|
196190
LL | #[label(no_crate_example, no_crate::example)]
197-
| ^^^^^^^^^^^^^^^^^
198-
|
199-
= help: a diagnostic slug must be the first argument to the attribute
191+
| ^
200192

201193
error: specified multiple times
202194
--> $DIR/subdiagnostic-derive.rs:338:5
@@ -217,16 +209,16 @@ LL | struct AG {
217209
| ^^
218210

219211
error: specified multiple times
220-
--> $DIR/subdiagnostic-derive.rs:381:46
212+
--> $DIR/subdiagnostic-derive.rs:381:1
221213
|
222214
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
223-
| ^^^^^^^^^^^^
215+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
224216
|
225217
note: previously specified here
226-
--> $DIR/subdiagnostic-derive.rs:381:32
218+
--> $DIR/subdiagnostic-derive.rs:381:1
227219
|
228220
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
229-
| ^^^^^^^^^^^^
221+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230222

231223
error: specified multiple times
232224
--> $DIR/subdiagnostic-derive.rs:399:5
@@ -253,10 +245,10 @@ LL | #[suggestion(no_crate_example)]
253245
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
254246

255247
error: invalid applicability
256-
--> $DIR/subdiagnostic-derive.rs:432:46
248+
--> $DIR/subdiagnostic-derive.rs:432:62
257249
|
258250
LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")]
259-
| ^^^^^^^^^^^^^^^^^^^^^
251+
| ^^^^^
260252

261253
error: suggestion without `#[primary_span]` field
262254
--> $DIR/subdiagnostic-derive.rs:450:1
@@ -314,11 +306,11 @@ LL | | var: String,
314306
LL | | }
315307
| |_^
316308

317-
error: `#[multipart_suggestion(code = ...)]` is not a valid attribute
309+
error: invalid nested attribute
318310
--> $DIR/subdiagnostic-derive.rs:538:42
319311
|
320312
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
321-
| ^^^^^^^^^^^^
313+
| ^^^^
322314
|
323315
= help: only `style` and `applicability` are valid nested attributes
324316

@@ -339,11 +331,11 @@ error: `#[suggestion_part(...)]` attribute without `code = "..."`
339331
LL | #[suggestion_part]
340332
| ^^^^^^^^^^^^^^^^^^
341333

342-
error: `#[suggestion_part(...)]` attribute without `code = "..."`
343-
--> $DIR/subdiagnostic-derive.rs:556:5
334+
error: unexpected end of input, unexpected token in nested attribute, expected ident
335+
--> $DIR/subdiagnostic-derive.rs:556:23
344336
|
345337
LL | #[suggestion_part()]
346-
| ^^^^^^^^^^^^^^^^^^^^
338+
| ^
347339

348340
error: `#[primary_span]` is not a valid attribute
349341
--> $DIR/subdiagnostic-derive.rs:565:5
@@ -371,19 +363,11 @@ error: `#[suggestion_part(...)]` attribute without `code = "..."`
371363
LL | #[suggestion_part]
372364
| ^^^^^^^^^^^^^^^^^^
373365

374-
error: `#[suggestion_part(...)]` attribute without `code = "..."`
375-
--> $DIR/subdiagnostic-derive.rs:576:5
376-
|
377-
LL | #[suggestion_part()]
378-
| ^^^^^^^^^^^^^^^^^^^^
379-
380-
error: `#[suggestion_part(foo = ...)]` is not a valid attribute
366+
error: `code` is the only valid nested attribute
381367
--> $DIR/subdiagnostic-derive.rs:579:23
382368
|
383369
LL | #[suggestion_part(foo = "bar")]
384-
| ^^^^^^^^^^^
385-
|
386-
= help: `code` is the only valid nested attribute
370+
| ^^^
387371

388372
error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
389373
--> $DIR/subdiagnostic-derive.rs:582:5
@@ -397,17 +381,29 @@ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of
397381
LL | #[suggestion_part()]
398382
| ^^^^^^^^^^^^^^^^^^^^
399383

384+
error: unexpected end of input, unexpected token in nested attribute, expected ident
385+
--> $DIR/subdiagnostic-derive.rs:576:23
386+
|
387+
LL | #[suggestion_part()]
388+
| ^
389+
390+
error: expected `,`
391+
--> $DIR/subdiagnostic-derive.rs:579:27
392+
|
393+
LL | #[suggestion_part(foo = "bar")]
394+
| ^
395+
400396
error: specified multiple times
401-
--> $DIR/subdiagnostic-derive.rs:593:37
397+
--> $DIR/subdiagnostic-derive.rs:593:5
402398
|
403399
LL | #[suggestion_part(code = "...", code = ",,,")]
404-
| ^^^^^^^^^^^^
400+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
405401
|
406402
note: previously specified here
407-
--> $DIR/subdiagnostic-derive.rs:593:23
403+
--> $DIR/subdiagnostic-derive.rs:593:5
408404
|
409405
LL | #[suggestion_part(code = "...", code = ",,,")]
410-
| ^^^^^^^^^^^^
406+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
411407

412408
error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
413409
--> $DIR/subdiagnostic-derive.rs:622:5
@@ -416,46 +412,64 @@ LL | #[applicability]
416412
| ^^^^^^^^^^^^^^^^
417413

418414
error: expected exactly one string literal for `code = ...`
419-
--> $DIR/subdiagnostic-derive.rs:670:23
415+
--> $DIR/subdiagnostic-derive.rs:670:34
420416
|
421417
LL | #[suggestion_part(code("foo"))]
422-
| ^^^^^^^^^^^
418+
| ^
419+
420+
error: unexpected token
421+
--> $DIR/subdiagnostic-derive.rs:670:28
422+
|
423+
LL | #[suggestion_part(code("foo"))]
424+
| ^^^^^
423425

424426
error: expected exactly one string literal for `code = ...`
425-
--> $DIR/subdiagnostic-derive.rs:679:23
427+
--> $DIR/subdiagnostic-derive.rs:679:41
428+
|
429+
LL | #[suggestion_part(code("foo", "bar"))]
430+
| ^
431+
432+
error: unexpected token
433+
--> $DIR/subdiagnostic-derive.rs:679:28
426434
|
427435
LL | #[suggestion_part(code("foo", "bar"))]
428-
| ^^^^^^^^^^^^^^^^^^
436+
| ^^^^^
429437

430438
error: expected exactly one string literal for `code = ...`
431-
--> $DIR/subdiagnostic-derive.rs:688:23
439+
--> $DIR/subdiagnostic-derive.rs:688:30
432440
|
433441
LL | #[suggestion_part(code(3))]
434-
| ^^^^^^^
442+
| ^
443+
444+
error: unexpected token
445+
--> $DIR/subdiagnostic-derive.rs:688:28
446+
|
447+
LL | #[suggestion_part(code(3))]
448+
| ^
435449

436450
error: expected exactly one string literal for `code = ...`
437-
--> $DIR/subdiagnostic-derive.rs:697:23
451+
--> $DIR/subdiagnostic-derive.rs:697:29
438452
|
439453
LL | #[suggestion_part(code())]
440-
| ^^^^^^
454+
| ^
441455

442-
error: `code = "..."`/`code(...)` must contain only string literals
443-
--> $DIR/subdiagnostic-derive.rs:706:23
456+
error: expected string literal
457+
--> $DIR/subdiagnostic-derive.rs:706:30
444458
|
445459
LL | #[suggestion_part(code = 3)]
446-
| ^^^^^^^^
460+
| ^
447461

448462
error: specified multiple times
449-
--> $DIR/subdiagnostic-derive.rs:748:61
463+
--> $DIR/subdiagnostic-derive.rs:748:1
450464
|
451465
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
452-
| ^^^^^^^^^^^^^^^^
466+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
453467
|
454468
note: previously specified here
455-
--> $DIR/subdiagnostic-derive.rs:748:43
469+
--> $DIR/subdiagnostic-derive.rs:748:1
456470
|
457471
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
458-
| ^^^^^^^^^^^^^^^^
472+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
459473

460474
error: `#[suggestion_hidden(...)]` is not a valid attribute
461475
--> $DIR/subdiagnostic-derive.rs:757:1
@@ -481,25 +495,29 @@ LL | #[suggestion(no_crate_example, code = "", style = "foo")]
481495
|
482496
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
483497

484-
error: `#[suggestion(style = ...)]` is not a valid attribute
485-
--> $DIR/subdiagnostic-derive.rs:781:43
498+
error: expected `= "xxx"`
499+
--> $DIR/subdiagnostic-derive.rs:781:49
486500
|
487501
LL | #[suggestion(no_crate_example, code = "", style = 42)]
488-
| ^^^^^^^^^^
502+
| ^
489503

490-
error: `#[suggestion(style)]` is not a valid attribute
491-
--> $DIR/subdiagnostic-derive.rs:789:43
504+
error: a diagnostic slug must be the first argument to the attribute
505+
--> $DIR/subdiagnostic-derive.rs:789:48
492506
|
493507
LL | #[suggestion(no_crate_example, code = "", style)]
494-
| ^^^^^
508+
| ^
509+
510+
error: expected `= "xxx"`
511+
--> $DIR/subdiagnostic-derive.rs:797:48
495512
|
496-
= help: a diagnostic slug must be the first argument to the attribute
513+
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
514+
| ^
497515

498-
error: `#[suggestion(style(...))]` is not a valid attribute
499-
--> $DIR/subdiagnostic-derive.rs:797:43
516+
error: expected `,`
517+
--> $DIR/subdiagnostic-derive.rs:797:48
500518
|
501519
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
502-
| ^^^^^^^^^^^^
520+
| ^
503521

504522
error: `#[primary_span]` is not a valid attribute
505523
--> $DIR/subdiagnostic-derive.rs:808:5
@@ -582,6 +600,14 @@ error[E0425]: cannot find value `slug` in module `crate::fluent_generated`
582600
LL | #[label(slug)]
583601
| ^^^^ not found in `crate::fluent_generated`
584602

585-
error: aborting due to 81 previous errors
603+
error[E0425]: cannot find value `__code_29` in this scope
604+
--> $DIR/subdiagnostic-derive.rs:703:10
605+
|
606+
LL | #[derive(Subdiagnostic)]
607+
| ^^^^^^^^^^^^^ not found in this scope
608+
|
609+
= note: this error originates in the derive macro `Subdiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
610+
611+
error: aborting due to 86 previous errors
586612

587613
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)
Please sign in to comment.