From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- .../session-diagnostic/diagnostic-derive.rs | 57 ++-- .../session-diagnostic/diagnostic-derive.stderr | 315 ++++++++++----------- .../session-diagnostic/subdiagnostic-derive.rs | 43 +-- .../session-diagnostic/subdiagnostic-derive.stderr | 288 ++++++++++--------- 4 files changed, 364 insertions(+), 339 deletions(-) (limited to 'tests/ui-fulldeps/session-diagnostic') diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 01e6434b0..6cc7bab37 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -50,7 +50,7 @@ enum DiagnosticOnEnum { #[derive(Diagnostic)] #[diag(no_crate_example, code = "E0123")] #[diag = "E0123"] -//~^ ERROR `#[diag = ...]` is not a valid attribute +//~^ ERROR expected parentheses: #[diag(...)] struct WrongStructAttrStyle {} #[derive(Diagnostic)] @@ -62,8 +62,7 @@ struct InvalidStructAttr {} #[derive(Diagnostic)] #[diag("E0123")] -//~^ ERROR `#[diag("...")]` is not a valid attribute -//~^^ ERROR diagnostic slug not specified +//~^ ERROR diagnostic slug not specified struct InvalidLitNestedAttr {} #[derive(Diagnostic)] @@ -73,27 +72,25 @@ struct InvalidNestedStructAttr {} #[derive(Diagnostic)] #[diag(nonsense("foo"), code = "E0123", slug = "foo")] -//~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute -//~^^ ERROR diagnostic slug not specified +//~^ ERROR diagnostic slug must be the first argument +//~| ERROR diagnostic slug not specified struct InvalidNestedStructAttr1 {} #[derive(Diagnostic)] #[diag(nonsense = "...", code = "E0123", slug = "foo")] -//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute -//~| ERROR `#[diag(slug = ...)]` is not a valid attribute +//~^ ERROR unknown argument //~| ERROR diagnostic slug not specified struct InvalidNestedStructAttr2 {} #[derive(Diagnostic)] #[diag(nonsense = 4, code = "E0123", slug = "foo")] -//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute -//~| ERROR `#[diag(slug = ...)]` is not a valid attribute +//~^ ERROR unknown argument //~| ERROR diagnostic slug not specified struct InvalidNestedStructAttr3 {} #[derive(Diagnostic)] #[diag(no_crate_example, code = "E0123", slug = "foo")] -//~^ ERROR `#[diag(slug = ...)]` is not a valid attribute +//~^ ERROR unknown argument struct InvalidNestedStructAttr4 {} #[derive(Diagnostic)] @@ -118,7 +115,7 @@ struct CodeSpecifiedTwice {} #[derive(Diagnostic)] #[diag(no_crate_example, no_crate::example, code = "E0456")] -//~^ ERROR `#[diag(no_crate::example)]` is not a valid attribute +//~^ ERROR diagnostic slug must be the first argument struct SlugSpecifiedTwice {} #[derive(Diagnostic)] @@ -232,7 +229,7 @@ struct SuggestWithoutCode { #[diag(no_crate_example, code = "E0123")] struct SuggestWithBadKey { #[suggestion(nonsense = "bar")] - //~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute + //~^ ERROR invalid nested attribute //~| ERROR suggestion without `code = "..."` suggestion: (Span, Applicability), } @@ -241,7 +238,7 @@ struct SuggestWithBadKey { #[diag(no_crate_example, code = "E0123")] struct SuggestWithShorthandMsg { #[suggestion(msg = "bar")] - //~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute + //~^ ERROR invalid nested attribute //~| ERROR suggestion without `code = "..."` suggestion: (Span, Applicability), } @@ -513,11 +510,24 @@ struct OptUnitField { bar: Option<()>, } +#[derive(Diagnostic)] +#[diag(no_crate_example)] +struct BoolField { + #[primary_span] + spans: Span, + #[help] + foo: bool, + #[help(no_crate_help)] + //~^ ERROR the `#[help(...)]` attribute can only be applied to fields of type + // only allow plain 'bool' fields + bar: Option, +} + #[derive(Diagnostic)] #[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingPath { #[label(no_crate_label, foo)] - //~^ ERROR `#[label(foo)]` is not a valid attribute + //~^ ERROR a diagnostic slug must be the first argument to the attribute span: Span, } @@ -525,7 +535,7 @@ struct LabelWithTrailingPath { #[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingNameValue { #[label(no_crate_label, foo = "...")] - //~^ ERROR `#[label(foo = ...)]` is not a valid attribute + //~^ ERROR invalid nested attribute span: Span, } @@ -533,7 +543,7 @@ struct LabelWithTrailingNameValue { #[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingList { #[label(no_crate_label, foo("..."))] - //~^ ERROR `#[label(foo(...))]` is not a valid attribute + //~^ ERROR invalid nested attribute span: Span, } @@ -630,8 +640,8 @@ struct MissingCodeInSuggestion { //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute //~| ERROR cannot find attribute `multipart_suggestion` in this scope #[multipart_suggestion()] -//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute -//~| ERROR cannot find attribute `multipart_suggestion` in this scope +//~^ ERROR cannot find attribute `multipart_suggestion` in this scope +//~| ERROR unexpected end of input, unexpected token in nested attribute, expected ident struct MultipartSuggestion { #[multipart_suggestion(no_crate_suggestion)] //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute @@ -685,7 +695,7 @@ struct RawIdentDiagnosticArg { #[diag(no_crate_example)] struct SubdiagnosticBad { #[subdiagnostic(bad)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute + //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic` note: Note, } @@ -701,7 +711,7 @@ struct SubdiagnosticBadStr { #[diag(no_crate_example)] struct SubdiagnosticBadTwice { #[subdiagnostic(bad, bad)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute + //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic` note: Note, } @@ -709,7 +719,7 @@ struct SubdiagnosticBadTwice { #[diag(no_crate_example)] struct SubdiagnosticBadLitStr { #[subdiagnostic("bad")] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute + //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic` note: Note, } @@ -784,14 +794,15 @@ struct SuggestionsNoItem { struct SuggestionsInvalidItem { #[suggestion(code(foo))] //~^ ERROR `code(...)` must contain only string literals + //~| ERROR unexpected token sub: Span, } -#[derive(Diagnostic)] +#[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope #[diag(no_crate_example)] struct SuggestionsInvalidLiteral { #[suggestion(code = 3)] - //~^ ERROR `code = "..."`/`code(...)` must contain only string literals + //~^ ERROR expected string literal sub: Span, } diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index fc0cd8419..a2f3bb527 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -20,11 +20,11 @@ LL | Bar, | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:52:1 +error: expected parentheses: #[diag(...)] + --> $DIR/diagnostic-derive.rs:52:8 | LL | #[diag = "E0123"] - | ^^^^^^^^^^^^^^^^^ + | ^ error: `#[nonsense(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:57:1 @@ -44,35 +44,24 @@ LL | | struct InvalidStructAttr {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag("...")]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:64:8 - | -LL | #[diag("E0123")] - | ^^^^^^^ - | - = help: a diagnostic slug is required as the first argument - error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:64:1 | LL | / #[diag("E0123")] LL | | -LL | | LL | | struct InvalidLitNestedAttr {} | |______________________________^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag(nonsense(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:75:8 +error: diagnostic slug must be the first argument + --> $DIR/diagnostic-derive.rs:74:16 | LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^^^^ - | - = help: a diagnostic slug is required as the first argument + | ^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:75:1 + --> $DIR/diagnostic-derive.rs:74:1 | LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")] LL | | @@ -82,120 +71,102 @@ LL | | struct InvalidNestedStructAttr1 {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:81:8 - | -LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^^^^^ - | - = help: only `code` is a valid nested attributes following the slug - -error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:81:42 +error: unknown argument + --> $DIR/diagnostic-derive.rs:80:8 | LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ + | ^^^^^^^^ | - = help: only `code` is a valid nested attributes following the slug + = note: only the `code` parameter is valid after the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:81:1 + --> $DIR/diagnostic-derive.rs:80:1 | LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")] LL | | LL | | -LL | | LL | | struct InvalidNestedStructAttr2 {} | |__________________________________^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:88:8 - | -LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ - -error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:88:38 +error: unknown argument + --> $DIR/diagnostic-derive.rs:86:8 | LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ + | ^^^^^^^^ | - = help: only `code` is a valid nested attributes following the slug + = note: only the `code` parameter is valid after the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:88:1 + --> $DIR/diagnostic-derive.rs:86:1 | LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")] LL | | LL | | -LL | | LL | | struct InvalidNestedStructAttr3 {} | |__________________________________^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:95:42 +error: unknown argument + --> $DIR/diagnostic-derive.rs:92:42 | LL | #[diag(no_crate_example, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ + | ^^^^ | - = help: only `code` is a valid nested attributes following the slug + = note: only the `code` parameter is valid after the slug error: `#[suggestion = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:102:5 + --> $DIR/diagnostic-derive.rs:99:5 | LL | #[suggestion = "bar"] | ^^^^^^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:109:8 + --> $DIR/diagnostic-derive.rs:106:8 | LL | #[diag(no_crate_example, code = "E0456")] | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:108:8 + --> $DIR/diagnostic-derive.rs:105:8 | LL | #[diag(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:109:33 + --> $DIR/diagnostic-derive.rs:106:26 | LL | #[diag(no_crate_example, code = "E0456")] - | ^^^^^^^ + | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:108:33 + --> $DIR/diagnostic-derive.rs:105:26 | LL | #[diag(no_crate_example, code = "E0123")] - | ^^^^^^^ + | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:115:49 + --> $DIR/diagnostic-derive.rs:112:42 | LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] - | ^^^^^^^ + | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:115:33 + --> $DIR/diagnostic-derive.rs:112:26 | LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] - | ^^^^^^^ + | ^^^^ -error: `#[diag(no_crate::example)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:120:26 +error: diagnostic slug must be the first argument + --> $DIR/diagnostic-derive.rs:117:43 | LL | #[diag(no_crate_example, no_crate::example, code = "E0456")] - | ^^^^^^^^^^^^^^^^^ - | - = help: diagnostic slug must be the first argument + | ^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:125:1 + --> $DIR/diagnostic-derive.rs:122:1 | LL | struct KindNotProvided {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -203,7 +174,7 @@ LL | struct KindNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:128:1 + --> $DIR/diagnostic-derive.rs:125:1 | LL | / #[diag(code = "E0456")] LL | | @@ -213,31 +184,31 @@ LL | | struct SlugNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:139:5 + --> $DIR/diagnostic-derive.rs:136:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: `#[nonsense]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:147:5 + --> $DIR/diagnostic-derive.rs:144:5 | LL | #[nonsense] | ^^^^^^^^^^^ error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:164:5 + --> $DIR/diagnostic-derive.rs:161:5 | LL | #[label(no_crate_label)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `name` doesn't refer to a field on this type - --> $DIR/diagnostic-derive.rs:172:46 + --> $DIR/diagnostic-derive.rs:169:46 | LL | #[suggestion(no_crate_suggestion, code = "{name}")] | ^^^^^^^^ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/diagnostic-derive.rs:177:10 + --> $DIR/diagnostic-derive.rs:174:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ expected `'}'` in format string @@ -246,7 +217,7 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found - --> $DIR/diagnostic-derive.rs:187:10 + --> $DIR/diagnostic-derive.rs:184:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ unmatched `}` in format string @@ -255,47 +226,47 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:207:5 + --> $DIR/diagnostic-derive.rs:204:5 | LL | #[label(no_crate_label)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:226:5 + --> $DIR/diagnostic-derive.rs:223:5 | LL | #[suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[suggestion(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:234:18 +error: invalid nested attribute + --> $DIR/diagnostic-derive.rs:231:18 | LL | #[suggestion(nonsense = "bar")] - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^ | = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:234:5 + --> $DIR/diagnostic-derive.rs:231:5 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[suggestion(msg = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:243:18 +error: invalid nested attribute + --> $DIR/diagnostic-derive.rs:240:18 | LL | #[suggestion(msg = "bar")] - | ^^^^^^^^^^^ + | ^^^ | = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:243:5 + --> $DIR/diagnostic-derive.rs:240:5 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:266:5 + --> $DIR/diagnostic-derive.rs:263:5 | LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")] LL | | @@ -305,75 +276,79 @@ LL | | suggestion: Applicability, = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` error: specified multiple times - --> $DIR/diagnostic-derive.rs:282:24 + --> $DIR/diagnostic-derive.rs:279:24 | LL | suggestion: (Span, Span, Applicability), | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:282:18 + --> $DIR/diagnostic-derive.rs:279:18 | LL | suggestion: (Span, Span, Applicability), | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:290:33 + --> $DIR/diagnostic-derive.rs:287:33 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:290:18 + --> $DIR/diagnostic-derive.rs:287:18 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:297:5 + --> $DIR/diagnostic-derive.rs:294:5 | LL | #[label = "bar"] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:448:53 + --> $DIR/diagnostic-derive.rs:445:5 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:450:24 + --> $DIR/diagnostic-derive.rs:447:24 | LL | suggestion: (Span, Applicability), | ^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/diagnostic-derive.rs:456:53 + --> $DIR/diagnostic-derive.rs:453:69 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ -error: `#[label(foo)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:519:29 +error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()` + --> $DIR/diagnostic-derive.rs:520:5 | -LL | #[label(no_crate_label, foo)] - | ^^^ +LL | #[help(no_crate_help)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: a diagnostic slug must be the first argument to the attribute + --> $DIR/diagnostic-derive.rs:529:32 | - = help: a diagnostic slug must be the first argument to the attribute +LL | #[label(no_crate_label, foo)] + | ^ -error: `#[label(foo = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:527:29 +error: invalid nested attribute + --> $DIR/diagnostic-derive.rs:537:29 | LL | #[label(no_crate_label, foo = "...")] - | ^^^^^^^^^^^ + | ^^^ -error: `#[label(foo(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:535:29 +error: invalid nested attribute + --> $DIR/diagnostic-derive.rs:545:29 | LL | #[label(no_crate_label, foo("..."))] - | ^^^^^^^^^^ + | ^^^ error: `#[primary_span]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:547:5 + --> $DIR/diagnostic-derive.rs:557:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -381,13 +356,13 @@ LL | #[primary_span] = help: the `primary_span` field attribute is not valid for lint diagnostics error: `#[error(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:567:1 + --> $DIR/diagnostic-derive.rs:577:1 | LL | #[error(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:567:1 + --> $DIR/diagnostic-derive.rs:577:1 | LL | / #[error(no_crate_example, code = "E0123")] LL | | @@ -399,13 +374,13 @@ LL | | struct ErrorAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[warn_(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:574:1 + --> $DIR/diagnostic-derive.rs:584:1 | LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:574:1 + --> $DIR/diagnostic-derive.rs:584:1 | LL | / #[warn_(no_crate_example, code = "E0123")] LL | | @@ -417,13 +392,13 @@ LL | | struct WarnAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:581:1 + --> $DIR/diagnostic-derive.rs:591:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:581:1 + --> $DIR/diagnostic-derive.rs:591:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -435,19 +410,19 @@ LL | | struct LintAttributeOnSessionDiag {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:588:1 + --> $DIR/diagnostic-derive.rs:598:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:588:1 + --> $DIR/diagnostic-derive.rs:598:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:588:1 + --> $DIR/diagnostic-derive.rs:598:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -460,19 +435,19 @@ LL | | struct LintAttributeOnLintDiag {} = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]` error: specified multiple times - --> $DIR/diagnostic-derive.rs:598:53 + --> $DIR/diagnostic-derive.rs:608:53 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:598:39 + --> $DIR/diagnostic-derive.rs:608:39 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:607:24 + --> $DIR/diagnostic-derive.rs:617:24 | LL | suggestion: (Span, usize), | ^^^^^ @@ -480,7 +455,7 @@ LL | suggestion: (Span, usize), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:615:17 + --> $DIR/diagnostic-derive.rs:625:17 | LL | suggestion: (Span,), | ^^^^^^^ @@ -488,13 +463,13 @@ LL | suggestion: (Span,), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:622:5 + --> $DIR/diagnostic-derive.rs:632:5 | LL | #[suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:629:1 + --> $DIR/diagnostic-derive.rs:639:1 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -502,23 +477,21 @@ LL | #[multipart_suggestion(no_crate_suggestion)] = help: consider creating a `Subdiagnostic` instead error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:632:1 - | -LL | #[multipart_suggestion()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider creating a `Subdiagnostic` instead - -error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:636:5 + --> $DIR/diagnostic-derive.rs:646:5 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider creating a `Subdiagnostic` instead +error: unexpected end of input, unexpected token in nested attribute, expected ident + --> $DIR/diagnostic-derive.rs:642:24 + | +LL | #[multipart_suggestion()] + | ^ + error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:644:1 + --> $DIR/diagnostic-derive.rs:654:1 | LL | #[suggestion(no_crate_suggestion, code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -526,45 +499,39 @@ LL | #[suggestion(no_crate_suggestion, code = "...")] = help: `#[label]` and `#[suggestion]` can only be applied to fields error: `#[label]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:653:1 + --> $DIR/diagnostic-derive.rs:663:1 | LL | #[label] | ^^^^^^^^ | = help: `#[label]` and `#[suggestion]` can only be applied to fields -error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:687:5 +error: `eager` is the only supported nested attribute for `subdiagnostic` + --> $DIR/diagnostic-derive.rs:697:7 | LL | #[subdiagnostic(bad)] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = help: `eager` is the only supported nested attribute for `subdiagnostic` + | ^^^^^^^^^^^^^^^^^^ error: `#[subdiagnostic = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:695:5 + --> $DIR/diagnostic-derive.rs:705:5 | LL | #[subdiagnostic = "bad"] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:703:5 +error: `eager` is the only supported nested attribute for `subdiagnostic` + --> $DIR/diagnostic-derive.rs:713:7 | LL | #[subdiagnostic(bad, bad)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: `eager` is the only supported nested attribute for `subdiagnostic` + | ^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:711:5 +error: `eager` is the only supported nested attribute for `subdiagnostic` + --> $DIR/diagnostic-derive.rs:721:7 | LL | #[subdiagnostic("bad")] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: `eager` is the only supported nested attribute for `subdiagnostic` + | ^^^^^^^^^^^^^^^^^^^^ error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:719:5 + --> $DIR/diagnostic-derive.rs:729:5 | LL | #[subdiagnostic(eager)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -572,25 +539,31 @@ LL | #[subdiagnostic(eager)] = help: eager subdiagnostics are not supported on lints error: expected at least one string literal for `code(...)` - --> $DIR/diagnostic-derive.rs:777:18 + --> $DIR/diagnostic-derive.rs:787:23 | LL | #[suggestion(code())] - | ^^^^^^ + | ^ error: `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:785:23 + --> $DIR/diagnostic-derive.rs:795:23 + | +LL | #[suggestion(code(foo))] + | ^^^ + +error: unexpected token + --> $DIR/diagnostic-derive.rs:795:23 | LL | #[suggestion(code(foo))] | ^^^ -error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:793:18 +error: expected string literal + --> $DIR/diagnostic-derive.rs:804:25 | LL | #[suggestion(code = 3)] - | ^^^^^^^^ + | ^ error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:808:5 + --> $DIR/diagnostic-derive.rs:819:5 | LL | #[suggestion(no_crate_suggestion, code = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -606,61 +579,69 @@ LL | #[nonsense(no_crate_example, code = "E0123")] | ^^^^^^^^ error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:147:7 + --> $DIR/diagnostic-derive.rs:144:7 | LL | #[nonsense] | ^^^^^^^^ error: cannot find attribute `error` in this scope - --> $DIR/diagnostic-derive.rs:567:3 + --> $DIR/diagnostic-derive.rs:577:3 | LL | #[error(no_crate_example, code = "E0123")] | ^^^^^ error: cannot find attribute `warn_` in this scope - --> $DIR/diagnostic-derive.rs:574:3 + --> $DIR/diagnostic-derive.rs:584:3 | LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^ help: a built-in attribute with a similar name exists: `warn` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:581:3 + --> $DIR/diagnostic-derive.rs:591:3 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:588:3 + --> $DIR/diagnostic-derive.rs:598:3 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:629:3 + --> $DIR/diagnostic-derive.rs:639:3 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:632:3 + --> $DIR/diagnostic-derive.rs:642:3 | LL | #[multipart_suggestion()] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:636:7 + --> $DIR/diagnostic-derive.rs:646:7 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated` - --> $DIR/diagnostic-derive.rs:70:8 + --> $DIR/diagnostic-derive.rs:69:8 | LL | #[diag(nonsense, code = "E0123")] | ^^^^^^^^ not found in `crate::fluent_generated` +error[E0425]: cannot find value `__code_34` in this scope + --> $DIR/diagnostic-derive.rs:801:10 + | +LL | #[derive(Diagnostic)] + | ^^^^^^^^^^ not found in this scope + | + = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:341:10 + --> $DIR/diagnostic-derive.rs:338:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index c882f7792..1d928ca93 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -82,7 +82,7 @@ struct F { #[derive(Subdiagnostic)] #[label(bug = "...")] -//~^ ERROR `#[label(bug = ...)]` is not a valid attribute +//~^ ERROR invalid nested attribute //~| ERROR diagnostic slug must be first argument struct G { #[primary_span] @@ -92,8 +92,7 @@ struct G { #[derive(Subdiagnostic)] #[label("...")] -//~^ ERROR `#[label("...")]` is not a valid attribute -//~| ERROR diagnostic slug must be first argument +//~^ ERROR unexpected literal in nested attribute, expected ident struct H { #[primary_span] span: Span, @@ -102,7 +101,7 @@ struct H { #[derive(Subdiagnostic)] #[label(slug = 4)] -//~^ ERROR `#[label(slug = ...)]` is not a valid attribute +//~^ ERROR invalid nested attribute //~| ERROR diagnostic slug must be first argument struct J { #[primary_span] @@ -112,7 +111,7 @@ struct J { #[derive(Subdiagnostic)] #[label(slug("..."))] -//~^ ERROR `#[label(slug(...))]` is not a valid attribute +//~^ ERROR invalid nested attribute //~| ERROR diagnostic slug must be first argument struct K { #[primary_span] @@ -132,7 +131,7 @@ struct L { #[derive(Subdiagnostic)] #[label()] -//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute +//~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident struct M { #[primary_span] span: Span, @@ -141,7 +140,7 @@ struct M { #[derive(Subdiagnostic)] #[label(no_crate_example, code = "...")] -//~^ ERROR `#[label(code = ...)]` is not a valid attribute +//~^ ERROR invalid nested attribute struct N { #[primary_span] span: Span, @@ -150,7 +149,7 @@ struct N { #[derive(Subdiagnostic)] #[label(no_crate_example, applicability = "machine-applicable")] -//~^ ERROR `#[label(applicability = ...)]` is not a valid attribute +//~^ ERROR invalid nested attribute struct O { #[primary_span] span: Span, @@ -222,7 +221,7 @@ enum T { enum U { #[label(code = "...")] //~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute - //~| ERROR `#[label(code = ...)]` is not a valid attribute + //~| ERROR invalid nested attribute A { #[primary_span] span: Span, @@ -323,7 +322,7 @@ struct AD { #[derive(Subdiagnostic)] #[label(no_crate_example, no_crate::example)] -//~^ ERROR `#[label(no_crate::example)]` is not a valid attribute +//~^ ERROR a diagnostic slug must be the first argument to the attribute struct AE { #[primary_span] span: Span, @@ -537,7 +536,7 @@ struct BA { #[derive(Subdiagnostic)] #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] //~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields -//~| ERROR `#[multipart_suggestion(code = ...)]` is not a valid attribute +//~| ERROR invalid nested attribute struct BBa { var: String, } @@ -554,7 +553,7 @@ struct BBb { #[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BBc { #[suggestion_part()] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` + //~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident span1: Span, } @@ -574,10 +573,11 @@ struct BD { //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` span1: Span, #[suggestion_part()] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` + //~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident span2: Span, #[suggestion_part(foo = "bar")] - //~^ ERROR `#[suggestion_part(foo = ...)]` is not a valid attribute + //~^ ERROR `code` is the only valid nested attribute + //~| ERROR expected `,` span4: Span, #[suggestion_part(code = "...")] //~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -669,6 +669,7 @@ enum BL { struct BM { #[suggestion_part(code("foo"))] //~^ ERROR expected exactly one string literal for `code = ...` + //~| ERROR unexpected token span: Span, r#type: String, } @@ -678,6 +679,7 @@ struct BM { struct BN { #[suggestion_part(code("foo", "bar"))] //~^ ERROR expected exactly one string literal for `code = ...` + //~| ERROR unexpected token span: Span, r#type: String, } @@ -687,6 +689,7 @@ struct BN { struct BO { #[suggestion_part(code(3))] //~^ ERROR expected exactly one string literal for `code = ...` + //~| ERROR unexpected token span: Span, r#type: String, } @@ -701,10 +704,13 @@ struct BP { } #[derive(Subdiagnostic)] +//~^ ERROR cannot find value `__code_29` in this scope +//~| NOTE in this expansion +//~| NOTE not found in this scope #[multipart_suggestion(no_crate_example)] struct BQ { #[suggestion_part(code = 3)] - //~^ ERROR `code = "..."`/`code(...)` must contain only string literals + //~^ ERROR expected string literal span: Span, r#type: String, } @@ -779,7 +785,7 @@ struct SuggestionStyleInvalid1 { #[derive(Subdiagnostic)] #[suggestion(no_crate_example, code = "", style = 42)] -//~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute +//~^ ERROR expected `= "xxx"` struct SuggestionStyleInvalid2 { #[primary_span] sub: Span, @@ -787,7 +793,7 @@ struct SuggestionStyleInvalid2 { #[derive(Subdiagnostic)] #[suggestion(no_crate_example, code = "", style)] -//~^ ERROR `#[suggestion(style)]` is not a valid attribute +//~^ ERROR a diagnostic slug must be the first argument to the attribute struct SuggestionStyleInvalid3 { #[primary_span] sub: Span, @@ -795,7 +801,8 @@ struct SuggestionStyleInvalid3 { #[derive(Subdiagnostic)] #[suggestion(no_crate_example, code = "", style("foo"))] -//~^ ERROR `#[suggestion(style(...))]` is not a valid attribute +//~^ ERROR expected `= "xxx"` +//~| ERROr expected `,` struct SuggestionStyleInvalid4 { #[primary_span] sub: Span, diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index 343134af6..4211b91f0 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -26,11 +26,11 @@ error: `#[label = ...]` is not a valid attribute LL | #[label = "..."] | ^^^^^^^^^^^^^^^^ -error: `#[label(bug = ...)]` is not a valid attribute +error: invalid nested attribute --> $DIR/subdiagnostic-derive.rs:84:9 | LL | #[label(bug = "...")] - | ^^^^^^^^^^^ + | ^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:84:1 @@ -38,110 +38,104 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute LL | #[label(bug = "...")] | ^^^^^^^^^^^^^^^^^^^^^ -error: `#[label("...")]` is not a valid attribute +error: unexpected literal in nested attribute, expected ident --> $DIR/subdiagnostic-derive.rs:94:9 | LL | #[label("...")] | ^^^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:94:1 - | -LL | #[label("...")] - | ^^^^^^^^^^^^^^^ - -error: `#[label(slug = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:104:9 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:103:9 | LL | #[label(slug = 4)] - | ^^^^^^^^ + | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:104:1 + --> $DIR/subdiagnostic-derive.rs:103:1 | LL | #[label(slug = 4)] | ^^^^^^^^^^^^^^^^^^ -error: `#[label(slug(...))]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:114:9 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:113:9 | LL | #[label(slug("..."))] - | ^^^^^^^^^^^ + | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:114:1 + --> $DIR/subdiagnostic-derive.rs:113:1 | LL | #[label(slug("..."))] | ^^^^^^^^^^^^^^^^^^^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:134:1 +error: unexpected end of input, unexpected token in nested attribute, expected ident + --> $DIR/subdiagnostic-derive.rs:133:9 | LL | #[label()] - | ^^^^^^^^^^ + | ^ -error: `#[label(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:143:27 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:142:27 | LL | #[label(no_crate_example, code = "...")] - | ^^^^^^^^^^^^ + | ^^^^ -error: `#[label(applicability = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:152:27 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:151:27 | LL | #[label(no_crate_example, applicability = "machine-applicable")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:161:1 + --> $DIR/subdiagnostic-derive.rs:160:1 | LL | #[foo] | ^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:175:5 + --> $DIR/subdiagnostic-derive.rs:174:5 | LL | #[bar] | ^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:187:5 + --> $DIR/subdiagnostic-derive.rs:186:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:199:5 + --> $DIR/subdiagnostic-derive.rs:198:5 | LL | #[bar = 4] | ^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:211:5 + --> $DIR/subdiagnostic-derive.rs:210:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ -error: `#[label(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:223:13 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:222:13 | LL | #[label(code = "...")] - | ^^^^^^^^^^^^ + | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:223:5 + --> $DIR/subdiagnostic-derive.rs:222:5 | LL | #[label(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:252:5 + --> $DIR/subdiagnostic-derive.rs:251:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:249:1 + --> $DIR/subdiagnostic-derive.rs:248:1 | LL | / #[label(no_crate_example)] LL | | @@ -153,13 +147,13 @@ LL | | } | |_^ error: `#[applicability]` is only valid on suggestions - --> $DIR/subdiagnostic-derive.rs:262:5 + --> $DIR/subdiagnostic-derive.rs:261:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:272:5 + --> $DIR/subdiagnostic-derive.rs:271:5 | LL | #[bar] | ^^^^^^ @@ -167,13 +161,13 @@ LL | #[bar] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:283:5 + --> $DIR/subdiagnostic-derive.rs:282:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:294:5 + --> $DIR/subdiagnostic-derive.rs:293:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ @@ -181,7 +175,7 @@ LL | #[bar("...")] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: unexpected unsupported untagged union - --> $DIR/subdiagnostic-derive.rs:310:1 + --> $DIR/subdiagnostic-derive.rs:309:1 | LL | / union AC { LL | | @@ -190,76 +184,74 @@ LL | | b: u64, LL | | } | |_^ -error: `#[label(no_crate::example)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:325:27 +error: a diagnostic slug must be the first argument to the attribute + --> $DIR/subdiagnostic-derive.rs:324:44 | LL | #[label(no_crate_example, no_crate::example)] - | ^^^^^^^^^^^^^^^^^ - | - = help: a diagnostic slug must be the first argument to the attribute + | ^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:338:5 + --> $DIR/subdiagnostic-derive.rs:337:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:335:5 + --> $DIR/subdiagnostic-derive.rs:334:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: subdiagnostic kind not specified - --> $DIR/subdiagnostic-derive.rs:344:8 + --> $DIR/subdiagnostic-derive.rs:343:8 | LL | struct AG { | ^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:381:46 + --> $DIR/subdiagnostic-derive.rs:380:46 | LL | #[suggestion(no_crate_example, code = "...", code = "...")] - | ^^^^^^^^^^^^ + | ^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:381:32 + --> $DIR/subdiagnostic-derive.rs:380:32 | LL | #[suggestion(no_crate_example, code = "...", code = "...")] - | ^^^^^^^^^^^^ + | ^^^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:399:5 + --> $DIR/subdiagnostic-derive.rs:398:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:396:5 + --> $DIR/subdiagnostic-derive.rs:395:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: the `#[applicability]` attribute can only be applied to fields of type `Applicability` - --> $DIR/subdiagnostic-derive.rs:409:5 + --> $DIR/subdiagnostic-derive.rs:408:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:422:1 + --> $DIR/subdiagnostic-derive.rs:421:1 | LL | #[suggestion(no_crate_example)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/subdiagnostic-derive.rs:432:46 + --> $DIR/subdiagnostic-derive.rs:431:62 | LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:450:1 + --> $DIR/subdiagnostic-derive.rs:449:1 | LL | / #[suggestion(no_crate_example, code = "...")] LL | | @@ -269,25 +261,25 @@ LL | | } | |_^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:464:1 + --> $DIR/subdiagnostic-derive.rs:463:1 | LL | #[label] | ^^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:484:39 + --> $DIR/subdiagnostic-derive.rs:483:39 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:503:43 + --> $DIR/subdiagnostic-derive.rs:502:43 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `#[suggestion_part]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:526:5 + --> $DIR/subdiagnostic-derive.rs:525:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ @@ -295,7 +287,7 @@ LL | #[suggestion_part] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead error: `#[suggestion_part(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:529:5 + --> $DIR/subdiagnostic-derive.rs:528:5 | LL | #[suggestion_part(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -303,7 +295,7 @@ LL | #[suggestion_part(code = "...")] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:523:1 + --> $DIR/subdiagnostic-derive.rs:522:1 | LL | / #[suggestion(no_crate_example, code = "...")] LL | | @@ -314,16 +306,16 @@ LL | | var: String, LL | | } | |_^ -error: `#[multipart_suggestion(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:538:42 +error: invalid nested attribute + --> $DIR/subdiagnostic-derive.rs:537:42 | LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] - | ^^^^^^^^^^^^ + | ^^^^ | = help: only `style` and `applicability` are valid nested attributes error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:538:1 + --> $DIR/subdiagnostic-derive.rs:537:1 | LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] LL | | @@ -334,19 +326,19 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:548:5 + --> $DIR/subdiagnostic-derive.rs:547:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:556:5 +error: unexpected end of input, unexpected token in nested attribute, expected ident + --> $DIR/subdiagnostic-derive.rs:555:23 | LL | #[suggestion_part()] - | ^^^^^^^^^^^^^^^^^^^^ + | ^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:565:5 + --> $DIR/subdiagnostic-derive.rs:564:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -354,7 +346,7 @@ LL | #[primary_span] = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:562:1 + --> $DIR/subdiagnostic-derive.rs:561:1 | LL | / #[multipart_suggestion(no_crate_example)] LL | | @@ -366,24 +358,16 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:573:5 + --> $DIR/subdiagnostic-derive.rs:572:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:576:5 - | -LL | #[suggestion_part()] - | ^^^^^^^^^^^^^^^^^^^^ - -error: `#[suggestion_part(foo = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:579:23 +error: `code` is the only valid nested attribute + --> $DIR/subdiagnostic-derive.rs:578:23 | LL | #[suggestion_part(foo = "bar")] - | ^^^^^^^^^^^ - | - = help: `code` is the only valid nested attribute + | ^^^ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:582:5 @@ -397,17 +381,29 @@ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of LL | #[suggestion_part()] | ^^^^^^^^^^^^^^^^^^^^ +error: unexpected end of input, unexpected token in nested attribute, expected ident + --> $DIR/subdiagnostic-derive.rs:575:23 + | +LL | #[suggestion_part()] + | ^ + +error: expected `,` + --> $DIR/subdiagnostic-derive.rs:578:27 + | +LL | #[suggestion_part(foo = "bar")] + | ^ + error: specified multiple times --> $DIR/subdiagnostic-derive.rs:593:37 | LL | #[suggestion_part(code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ | note: previously specified here --> $DIR/subdiagnostic-derive.rs:593:23 | LL | #[suggestion_part(code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` --> $DIR/subdiagnostic-derive.rs:622:5 @@ -416,49 +412,67 @@ LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:670:23 + --> $DIR/subdiagnostic-derive.rs:670:34 | LL | #[suggestion_part(code("foo"))] - | ^^^^^^^^^^^ + | ^ + +error: unexpected token + --> $DIR/subdiagnostic-derive.rs:670:28 + | +LL | #[suggestion_part(code("foo"))] + | ^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:679:23 + --> $DIR/subdiagnostic-derive.rs:680:41 + | +LL | #[suggestion_part(code("foo", "bar"))] + | ^ + +error: unexpected token + --> $DIR/subdiagnostic-derive.rs:680:28 | LL | #[suggestion_part(code("foo", "bar"))] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:688:23 + --> $DIR/subdiagnostic-derive.rs:690:30 | LL | #[suggestion_part(code(3))] - | ^^^^^^^ + | ^ + +error: unexpected token + --> $DIR/subdiagnostic-derive.rs:690:28 + | +LL | #[suggestion_part(code(3))] + | ^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:697:23 + --> $DIR/subdiagnostic-derive.rs:700:29 | LL | #[suggestion_part(code())] - | ^^^^^^ + | ^ -error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/subdiagnostic-derive.rs:706:23 +error: expected string literal + --> $DIR/subdiagnostic-derive.rs:712:30 | LL | #[suggestion_part(code = 3)] - | ^^^^^^^^ + | ^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:748:61 + --> $DIR/subdiagnostic-derive.rs:754:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:748:43 + --> $DIR/subdiagnostic-derive.rs:754:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:757:1 + --> $DIR/subdiagnostic-derive.rs:763:1 | LL | #[suggestion_hidden(no_crate_example, code = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -466,7 +480,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:765:1 + --> $DIR/subdiagnostic-derive.rs:771:1 | LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -474,35 +488,39 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: invalid suggestion style - --> $DIR/subdiagnostic-derive.rs:773:51 + --> $DIR/subdiagnostic-derive.rs:779:51 | LL | #[suggestion(no_crate_example, code = "", style = "foo")] | ^^^^^ | = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` -error: `#[suggestion(style = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:781:43 +error: expected `= "xxx"` + --> $DIR/subdiagnostic-derive.rs:787:49 | LL | #[suggestion(no_crate_example, code = "", style = 42)] - | ^^^^^^^^^^ + | ^ -error: `#[suggestion(style)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:789:43 +error: a diagnostic slug must be the first argument to the attribute + --> $DIR/subdiagnostic-derive.rs:795:48 | LL | #[suggestion(no_crate_example, code = "", style)] - | ^^^^^ + | ^ + +error: expected `= "xxx"` + --> $DIR/subdiagnostic-derive.rs:803:48 | - = help: a diagnostic slug must be the first argument to the attribute +LL | #[suggestion(no_crate_example, code = "", style("foo"))] + | ^ -error: `#[suggestion(style(...))]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:797:43 +error: expected `,` + --> $DIR/subdiagnostic-derive.rs:803:48 | LL | #[suggestion(no_crate_example, code = "", style("foo"))] - | ^^^^^^^^^^^^ + | ^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:808:5 + --> $DIR/subdiagnostic-derive.rs:815:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -511,7 +529,7 @@ LL | #[primary_span] = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:805:1 + --> $DIR/subdiagnostic-derive.rs:812:1 | LL | / #[suggestion(no_crate_example, code = "")] LL | | @@ -529,59 +547,67 @@ LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:161:3 + --> $DIR/subdiagnostic-derive.rs:160:3 | LL | #[foo] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:175:7 + --> $DIR/subdiagnostic-derive.rs:174:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:187:7 + --> $DIR/subdiagnostic-derive.rs:186:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:199:7 + --> $DIR/subdiagnostic-derive.rs:198:7 | LL | #[bar = 4] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:211:7 + --> $DIR/subdiagnostic-derive.rs:210:7 | LL | #[bar("...")] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:272:7 + --> $DIR/subdiagnostic-derive.rs:271:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:283:7 + --> $DIR/subdiagnostic-derive.rs:282:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:294:7 + --> $DIR/subdiagnostic-derive.rs:293:7 | LL | #[bar("...")] | ^^^ error[E0425]: cannot find value `slug` in module `crate::fluent_generated` - --> $DIR/subdiagnostic-derive.rs:124:9 + --> $DIR/subdiagnostic-derive.rs:123:9 | LL | #[label(slug)] | ^^^^ not found in `crate::fluent_generated` -error: aborting due to 81 previous errors +error[E0425]: cannot find value `__code_29` in this scope + --> $DIR/subdiagnostic-derive.rs:706:10 + | +LL | #[derive(Subdiagnostic)] + | ^^^^^^^^^^^^^ not found in this scope + | + = note: this error originates in the derive macro `Subdiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 86 previous errors For more information about this error, try `rustc --explain E0425`. -- cgit v1.2.3