diff options
Diffstat (limited to 'tests')
22 files changed, 662 insertions, 364 deletions
diff --git a/tests/rustdoc-gui/go-to-collapsed-elem.goml b/tests/rustdoc-gui/go-to-collapsed-elem.goml index 279048e37c1..ec423125236 100644 --- a/tests/rustdoc-gui/go-to-collapsed-elem.goml +++ b/tests/rustdoc-gui/go-to-collapsed-elem.goml @@ -9,13 +9,32 @@ property: ("#implementations-list .implementors-toggle", {"open": "false"}) click: "//*[@class='sidebar']//a[@href='#method.must_use']" assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) -// Now we do the same through search result. -// First we reload the page without the anchor in the URL. +define-function: ("collapsed-from-search", (), block { + // Now we do the same through search result. + // First we reload the page without the anchor in the URL. + goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + // Then we collapse the section again... + property: ("#implementations-list .implementors-toggle", {"open": "false"}) + // Then we run the search. + write: (".search-input", "foo::must_use") + wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" + click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" + assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) +}) + +call-function: ("collapsed-from-search", {}) + +// Now running the same check but with mobile. +size: (600, 600) goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" -// Then we collapse the section again... +// We check that the implementors block is expanded. +assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) +// We now collapse the implementors block. property: ("#implementations-list .implementors-toggle", {"open": "false"}) -// Then we run the search. -write: (".search-input", "foo::must_use") -wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" -click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" +// First we expand the mobile menu. +click: ".sidebar-menu-toggle" +// Then we click on the link to the method to ensure it'll expand the implementors block. +click: "//*[@class='sidebar shown']//a[@href='#method.must_use']" assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) + +call-function: ("collapsed-from-search", {}) diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 3151c712566..61724c11745 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), } @@ -530,7 +527,7 @@ struct BoolField { #[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, } @@ -538,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, } @@ -546,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, } @@ -643,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 @@ -698,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, } @@ -714,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, } @@ -722,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, } @@ -797,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 513b675e5dd..cd14c7496b3 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,81 +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: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `bool` or `()` - --> $DIR/diagnostic-derive.rs:523:5 + --> $DIR/diagnostic-derive.rs:520:5 | LL | #[help(no_crate_help)] | ^^^^^^^^^^^^^^^^^^^^^^ -error: `#[label(foo)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:532:29 +error: a diagnostic slug must be the first argument to the attribute + --> $DIR/diagnostic-derive.rs:529:32 | LL | #[label(no_crate_label, foo)] - | ^^^ - | - = help: a diagnostic slug must be the first argument to the attribute + | ^ -error: `#[label(foo = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:540: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:548: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:560:5 + --> $DIR/diagnostic-derive.rs:557:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -387,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:580:1 + --> $DIR/diagnostic-derive.rs:577:1 | LL | #[error(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:580:1 + --> $DIR/diagnostic-derive.rs:577:1 | LL | / #[error(no_crate_example, code = "E0123")] LL | | @@ -405,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:587:1 + --> $DIR/diagnostic-derive.rs:584:1 | LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:587:1 + --> $DIR/diagnostic-derive.rs:584:1 | LL | / #[warn_(no_crate_example, code = "E0123")] LL | | @@ -423,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:594:1 + --> $DIR/diagnostic-derive.rs:591:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:594:1 + --> $DIR/diagnostic-derive.rs:591:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -441,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:601: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:601:1 + --> $DIR/diagnostic-derive.rs:598:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:601:1 + --> $DIR/diagnostic-derive.rs:598:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -466,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:611:53 + --> $DIR/diagnostic-derive.rs:608:53 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:611:39 + --> $DIR/diagnostic-derive.rs:608:39 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ + | ^^^^ error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:620:24 + --> $DIR/diagnostic-derive.rs:617:24 | LL | suggestion: (Span, usize), | ^^^^^ @@ -486,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:628:17 + --> $DIR/diagnostic-derive.rs:625:17 | LL | suggestion: (Span,), | ^^^^^^^ @@ -494,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:635:5 + --> $DIR/diagnostic-derive.rs:632:5 | LL | #[suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:642:1 + --> $DIR/diagnostic-derive.rs:639:1 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -508,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:645:1 - | -LL | #[multipart_suggestion()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider creating a `Subdiagnostic` instead - -error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:649: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:657:1 + --> $DIR/diagnostic-derive.rs:654:1 | LL | #[suggestion(no_crate_suggestion, code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -532,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:666: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:700: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:708:5 + --> $DIR/diagnostic-derive.rs:705:5 | LL | #[subdiagnostic = "bad"] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:716: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:724: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:732:5 + --> $DIR/diagnostic-derive.rs:729:5 | LL | #[subdiagnostic(eager)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -578,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:790:18 + --> $DIR/diagnostic-derive.rs:787:23 | LL | #[suggestion(code())] - | ^^^^^^ + | ^ error: `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:798:23 + --> $DIR/diagnostic-derive.rs:795:23 | LL | #[suggestion(code(foo))] | ^^^ -error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:806:18 +error: unexpected token + --> $DIR/diagnostic-derive.rs:795:23 + | +LL | #[suggestion(code(foo))] + | ^^^ + +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:821:5 + --> $DIR/diagnostic-derive.rs:819:5 | LL | #[suggestion(no_crate_suggestion, code = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -612,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:580: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:587: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:594: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:601: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:642: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:645:3 + --> $DIR/diagnostic-derive.rs:642:3 | LL | #[multipart_suggestion()] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:649: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` @@ -676,7 +651,7 @@ note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 85 previous errors +error: aborting due to 84 previous errors Some errors have detailed explanations: E0277, E0425. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index c882f7792d5..1d928ca93f9 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 343134af6bc..4211b91f04a 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`. diff --git a/tests/ui/argument-suggestions/issue-109425.fixed b/tests/ui/argument-suggestions/issue-109425.fixed new file mode 100644 index 00000000000..143ddf99586 --- /dev/null +++ b/tests/ui/argument-suggestions/issue-109425.fixed @@ -0,0 +1,20 @@ +// run-rustfix + +fn f() {} +fn i(_: u32) {} +fn is(_: u32, _: &str) {} +fn s(_: &str) {} + +fn main() { + // code expected suggestion + f(); // f() + //~^ error: this function takes 0 arguments but 2 arguments were supplied + i(0,); // i(0,) + //~^ error: this function takes 1 argument but 3 arguments were supplied + i(0); // i(0) + //~^ error: this function takes 1 argument but 3 arguments were supplied + is(0, ""); // is(0, "") + //~^ error: this function takes 2 arguments but 4 arguments were supplied + s(""); // s("") + //~^ error: this function takes 1 argument but 3 arguments were supplied +} diff --git a/tests/ui/argument-suggestions/issue-109425.rs b/tests/ui/argument-suggestions/issue-109425.rs new file mode 100644 index 00000000000..a845c419555 --- /dev/null +++ b/tests/ui/argument-suggestions/issue-109425.rs @@ -0,0 +1,20 @@ +// run-rustfix + +fn f() {} +fn i(_: u32) {} +fn is(_: u32, _: &str) {} +fn s(_: &str) {} + +fn main() { + // code expected suggestion + f(0, 1,); // f() + //~^ error: this function takes 0 arguments but 2 arguments were supplied + i(0, 1, 2,); // i(0,) + //~^ error: this function takes 1 argument but 3 arguments were supplied + i(0, 1, 2); // i(0) + //~^ error: this function takes 1 argument but 3 arguments were supplied + is(0, 1, 2, ""); // is(0, "") + //~^ error: this function takes 2 arguments but 4 arguments were supplied + s(0, 1, ""); // s("") + //~^ error: this function takes 1 argument but 3 arguments were supplied +} diff --git a/tests/ui/argument-suggestions/issue-109425.stderr b/tests/ui/argument-suggestions/issue-109425.stderr new file mode 100644 index 00000000000..1514f1cb487 --- /dev/null +++ b/tests/ui/argument-suggestions/issue-109425.stderr @@ -0,0 +1,98 @@ +error[E0061]: this function takes 0 arguments but 2 arguments were supplied + --> $DIR/issue-109425.rs:10:5 + | +LL | f(0, 1,); // f() + | ^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/issue-109425.rs:3:4 + | +LL | fn f() {} + | ^ +help: remove the extra arguments + | +LL - f(0, 1,); // f() +LL + f(); // f() + | + +error[E0061]: this function takes 1 argument but 3 arguments were supplied + --> $DIR/issue-109425.rs:12:5 + | +LL | i(0, 1, 2,); // i(0,) + | ^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/issue-109425.rs:4:4 + | +LL | fn i(_: u32) {} + | ^ ------ +help: remove the extra arguments + | +LL - i(0, 1, 2,); // i(0,) +LL + i(0,); // i(0,) + | + +error[E0061]: this function takes 1 argument but 3 arguments were supplied + --> $DIR/issue-109425.rs:14:5 + | +LL | i(0, 1, 2); // i(0) + | ^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/issue-109425.rs:4:4 + | +LL | fn i(_: u32) {} + | ^ ------ +help: remove the extra arguments + | +LL - i(0, 1, 2); // i(0) +LL + i(0); // i(0) + | + +error[E0061]: this function takes 2 arguments but 4 arguments were supplied + --> $DIR/issue-109425.rs:16:5 + | +LL | is(0, 1, 2, ""); // is(0, "") + | ^^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/issue-109425.rs:5:4 + | +LL | fn is(_: u32, _: &str) {} + | ^^ ------ ------- +help: remove the extra arguments + | +LL - is(0, 1, 2, ""); // is(0, "") +LL + is(0, ""); // is(0, "") + | + +error[E0061]: this function takes 1 argument but 3 arguments were supplied + --> $DIR/issue-109425.rs:18:5 + | +LL | s(0, 1, ""); // s("") + | ^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/issue-109425.rs:6:4 + | +LL | fn s(_: &str) {} + | ^ ------- +help: remove the extra arguments + | +LL - s(0, 1, ""); // s("") +LL + s(""); // s("") + | + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/inference/need_type_info/concrete-impl.rs b/tests/ui/inference/need_type_info/concrete-impl.rs index 72e0e74f323..fc79e6201bd 100644 --- a/tests/ui/inference/need_type_info/concrete-impl.rs +++ b/tests/ui/inference/need_type_info/concrete-impl.rs @@ -7,10 +7,13 @@ struct Two; struct Struct; impl Ambiguous<One> for Struct {} +//~^ NOTE multiple `impl`s satisfying `Struct: Ambiguous<_>` found impl Ambiguous<Two> for Struct {} fn main() { <Struct as Ambiguous<_>>::method(); //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `A` //~| ERROR type annotations needed + //~| NOTE infer type of the type parameter `A` } diff --git a/tests/ui/inference/need_type_info/concrete-impl.stderr b/tests/ui/inference/need_type_info/concrete-impl.stderr index aa32969950d..74c3f6cd5cf 100644 --- a/tests/ui/inference/need_type_info/concrete-impl.stderr +++ b/tests/ui/inference/need_type_info/concrete-impl.stderr @@ -1,20 +1,21 @@ error[E0282]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 + --> $DIR/concrete-impl.rs:14:5 | LL | <Struct as Ambiguous<_>>::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous` error[E0283]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 + --> $DIR/concrete-impl.rs:14:5 | LL | <Struct as Ambiguous<_>>::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous` | note: multiple `impl`s satisfying `Struct: Ambiguous<_>` found --> $DIR/concrete-impl.rs:9:1 | LL | impl Ambiguous<One> for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | LL | impl Ambiguous<Two> for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/inference/need_type_info/issue-109905.rs b/tests/ui/inference/need_type_info/issue-109905.rs new file mode 100644 index 00000000000..99d10a5eae0 --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-109905.rs @@ -0,0 +1,25 @@ +// Test that we show the correct type parameter that couldn't be inferred and that we don't +// end up stating nonsense like "type parameter `'a`" which we used to do. + +trait Trait<'a, T> { + fn m(self); +} + +impl<'a, A> Trait<'a, A> for () { + fn m(self) {} +} + +fn qualified() { + <() as Trait<'static, _>>::m(()); + //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `T` + +} + +fn unqualified() { + Trait::<'static, _>::m(()); + //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `T` +} + +fn main() {} diff --git a/tests/ui/inference/need_type_info/issue-109905.stderr b/tests/ui/inference/need_type_info/issue-109905.stderr new file mode 100644 index 00000000000..fcdd50f1422 --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-109905.stderr @@ -0,0 +1,15 @@ +error[E0282]: type annotations needed + --> $DIR/issue-109905.rs:13:5 + | +LL | <() as Trait<'static, _>>::m(()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` + +error[E0282]: type annotations needed + --> $DIR/issue-109905.rs:20:5 + | +LL | Trait::<'static, _>::m(()); + | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/parser/issues/issue-110014.rs b/tests/ui/parser/issues/issue-110014.rs new file mode 100644 index 00000000000..69d8f402bb6 --- /dev/null +++ b/tests/ui/parser/issues/issue-110014.rs @@ -0,0 +1,3 @@ +fn`2222222222222222222222222222222222222222() {} +//~^ ERROR unknown start of token: ` +//~^^ ERROR expected identifier, found `2222222222222222222222222222222222222222` diff --git a/tests/ui/parser/issues/issue-110014.stderr b/tests/ui/parser/issues/issue-110014.stderr new file mode 100644 index 00000000000..7f1dd592e12 --- /dev/null +++ b/tests/ui/parser/issues/issue-110014.stderr @@ -0,0 +1,19 @@ +error: unknown start of token: ` + --> $DIR/issue-110014.rs:1:3 + | +LL | fn`2222222222222222222222222222222222222222() {} + | ^ + | +help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not + | +LL | fn'2222222222222222222222222222222222222222() {} + | ~ + +error: expected identifier, found `2222222222222222222222222222222222222222` + --> $DIR/issue-110014.rs:1:4 + | +LL | fn`2222222222222222222222222222222222222222() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected identifier + +error: aborting due to 2 previous errors + diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs index fdc4d536981..2f1cffa2fa9 100644 --- a/tests/ui/recursion/issue-95134.rs +++ b/tests/ui/recursion/issue-95134.rs @@ -1,7 +1,7 @@ // build-fail // known-bug: #95134 // compile-flags: -Copt-level=0 -// failure-status: 101 +// dont-check-failure-status // dont-check-compiler-stderr pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { diff --git a/tests/ui/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfc-2008-non-exhaustive/struct.stderr index 2cb9ba0d1d1..39b1ef1e078 100644 --- a/tests/ui/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/struct.stderr @@ -10,14 +10,11 @@ error[E0603]: tuple struct constructor `TupleStruct` is private LL | let ts_explicit = structs::TupleStruct(640, 480); | ^^^^^^^^^^^ private tuple struct constructor | - ::: $DIR/auxiliary/structs.rs:12:24 - | -LL | pub struct TupleStruct(pub u16, pub u16); - | ---------------- a constructor is private if any of the fields is private - | note: the tuple struct constructor `TupleStruct` is defined here --> $DIR/auxiliary/structs.rs:12:1 | +LL | #[non_exhaustive] + | ----------------- cannot be constructed because it is `#[non_exhaustive]` LL | pub struct TupleStruct(pub u16, pub u16); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -30,6 +27,8 @@ LL | let us_explicit = structs::UnitStruct; note: the unit struct `UnitStruct` is defined here --> $DIR/auxiliary/structs.rs:9:1 | +LL | #[non_exhaustive] + | ----------------- cannot be constructed because it is `#[non_exhaustive]` LL | pub struct UnitStruct; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfc-2008-non-exhaustive/variant.stderr index 720b7b119ce..4083f57a9cd 100644 --- a/tests/ui/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/variant.stderr @@ -8,7 +8,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: unit variant `Unit` is private --> $DIR/variant.rs:14:47 @@ -20,7 +22,9 @@ note: the unit variant `Unit` is defined here --> $DIR/auxiliary/variants.rs:4:23 | LL | #[non_exhaustive] Unit, - | ^^^^ + | ----------------- ^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: unit variant `Unit` is private --> $DIR/variant.rs:18:32 @@ -32,7 +36,9 @@ note: the unit variant `Unit` is defined here --> $DIR/auxiliary/variants.rs:4:23 | LL | #[non_exhaustive] Unit, - | ^^^^ + | ----------------- ^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: tuple variant `Tuple` is private --> $DIR/variant.rs:20:32 @@ -44,7 +50,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: tuple variant `Tuple` is private --> $DIR/variant.rs:26:35 @@ -56,7 +64,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0639]: cannot create non-exhaustive variant using struct expression --> $DIR/variant.rs:8:26 diff --git a/tests/ui/suggestions/issue-109291.rs b/tests/ui/suggestions/issue-109291.rs new file mode 100644 index 00000000000..1947b16a32e --- /dev/null +++ b/tests/ui/suggestions/issue-109291.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); + //~^ ERROR no function or associated item name +} diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr new file mode 100644 index 00000000000..4ef5948d9bf --- /dev/null +++ b/tests/ui/suggestions/issue-109291.stderr @@ -0,0 +1,12 @@ +error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope + --> $DIR/issue-109291.rs:2:65 + | +LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); + | ^^^^^^^^^^^^^^ + | | + | function or associated item not found in `Backtrace` + | help: there is an associated function with a similar name: `force_capture` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/suggestions/issue-109396.stderr b/tests/ui/suggestions/issue-109396.stderr index eca160e2fab..d4956872a39 100644 --- a/tests/ui/suggestions/issue-109396.stderr +++ b/tests/ui/suggestions/issue-109396.stderr @@ -25,7 +25,7 @@ note: function defined here help: remove the extra arguments | LL - file.as_raw_fd(), -LL + , +LL + ); | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr new file mode 100644 index 00000000000..6a926534e07 --- /dev/null +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr @@ -0,0 +1,18 @@ +error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely + --> $DIR/auto-with-drop_tracking_mir.rs:24:13 + | +LL | is_send(foo()); + | ------- ^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `impl Future<Output = ()>` +note: required by a bound in `is_send` + --> $DIR/auto-with-drop_tracking_mir.rs:23:24 + | +LL | fn is_send(_: impl Send) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs new file mode 100644 index 00000000000..a5db7c4636b --- /dev/null +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -0,0 +1,26 @@ +// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir +// edition: 2021 +// revisions: pass fail +//[pass] check-pass + +#![feature(negative_impls)] + +struct NotSync; +impl !Sync for NotSync {} + +async fn foo() { + #[cfg(pass)] + let x = &(); + #[cfg(fail)] + let x = &NotSync; + bar().await; + drop(x); +} + +async fn bar() {} + +fn main() { + fn is_send(_: impl Send) {} + is_send(foo()); + //[fail]~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely +} |
