diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
commit | 631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch) | |
tree | a1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs | |
parent | Adding debian version 1.69.0+dfsg1-1. (diff) | |
download | rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs')
-rw-r--r-- | tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs | 57 |
1 files changed, 34 insertions, 23 deletions
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), } @@ -514,10 +511,23 @@ struct OptUnitField { } #[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<bool>, +} + +#[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, } |