From 38374315165c83e77008f4457b862fd7aeee7d6d Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Fri, 6 Feb 2026 19:04:39 +0100 Subject: [PATCH] Remove `ui-fulldeps` tests for slugs --- .../fluent-messages/duplicate-a-b.ftl | 1 - .../fluent-messages/duplicate-a.ftl | 1 - .../ui-fulldeps/fluent-messages/duplicate.ftl | 3 - .../fluent-messages/invalid-escape.ftl | 1 - .../fluent-messages/label-with-hyphens.ftl | 2 - .../fluent-messages/many-lines.ftl | 11 - .../fluent-messages/missing-crate-name.ftl | 2 - .../fluent-messages/missing-message-ref.ftl | 1 - .../fluent-messages/missing-message.ftl | 1 - .../fluent-messages/slug-with-hyphens.ftl | 1 - tests/ui-fulldeps/fluent-messages/test.rs | 87 -- tests/ui-fulldeps/fluent-messages/test.stderr | 122 --- tests/ui-fulldeps/fluent-messages/valid.ftl | 1 - .../session-diagnostic/diagnostic-derive.rs | 827 ------------------ .../diagnostic-derive.stderr | 634 -------------- .../session-diagnostic/enforce_slug_naming.rs | 24 - .../enforce_slug_naming.stderr | 11 - .../session-diagnostic/example.ftl | 7 - .../session-diagnostic/invalid-variable.rs | 20 - .../subdiagnostic-derive-2.rs | 37 - .../subdiagnostic-derive-2.stderr | 9 - .../subdiagnostic-derive.rs | 809 ----------------- .../subdiagnostic-derive.stderr | 549 ------------ 23 files changed, 3161 deletions(-) delete mode 100644 tests/ui-fulldeps/fluent-messages/duplicate-a-b.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/duplicate-a.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/duplicate.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/invalid-escape.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/many-lines.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/missing-message.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl delete mode 100644 tests/ui-fulldeps/fluent-messages/test.rs delete mode 100644 tests/ui-fulldeps/fluent-messages/test.stderr delete mode 100644 tests/ui-fulldeps/fluent-messages/valid.ftl delete mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs delete mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr delete mode 100644 tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs delete mode 100644 tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr delete mode 100644 tests/ui-fulldeps/session-diagnostic/example.ftl delete mode 100644 tests/ui-fulldeps/session-diagnostic/invalid-variable.rs delete mode 100644 tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.rs delete mode 100644 tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.stderr delete mode 100644 tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs delete mode 100644 tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr diff --git a/tests/ui-fulldeps/fluent-messages/duplicate-a-b.ftl b/tests/ui-fulldeps/fluent-messages/duplicate-a-b.ftl deleted file mode 100644 index 9407c5170450..000000000000 --- a/tests/ui-fulldeps/fluent-messages/duplicate-a-b.ftl +++ /dev/null @@ -1 +0,0 @@ -a_b_key = Value diff --git a/tests/ui-fulldeps/fluent-messages/duplicate-a.ftl b/tests/ui-fulldeps/fluent-messages/duplicate-a.ftl deleted file mode 100644 index 9407c5170450..000000000000 --- a/tests/ui-fulldeps/fluent-messages/duplicate-a.ftl +++ /dev/null @@ -1 +0,0 @@ -a_b_key = Value diff --git a/tests/ui-fulldeps/fluent-messages/duplicate.ftl b/tests/ui-fulldeps/fluent-messages/duplicate.ftl deleted file mode 100644 index 871550b231a3..000000000000 --- a/tests/ui-fulldeps/fluent-messages/duplicate.ftl +++ /dev/null @@ -1,3 +0,0 @@ -no_crate_a_b_key = Value - -no_crate_a_b_key = Another Value diff --git a/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl b/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl deleted file mode 100644 index e28852ea0050..000000000000 --- a/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl +++ /dev/null @@ -1 +0,0 @@ -no_crate_bad_escape = don't use \n, \', or \" diff --git a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl deleted file mode 100644 index 3088b1f8dc83..000000000000 --- a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl +++ /dev/null @@ -1,2 +0,0 @@ -no_crate_some_slug = hi - .label-has-hyphens = test diff --git a/tests/ui-fulldeps/fluent-messages/many-lines.ftl b/tests/ui-fulldeps/fluent-messages/many-lines.ftl deleted file mode 100644 index 43660ebeacdc..000000000000 --- a/tests/ui-fulldeps/fluent-messages/many-lines.ftl +++ /dev/null @@ -1,11 +0,0 @@ -no_crate_foo = foo - -# This file tests error reporting for -# fluent files with many lines. -# The error message should point to the correct line number -# and include no more context than necessary. - -no_crate_bar = - -no_crate_baz = - baz diff --git a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl b/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl deleted file mode 100644 index 0a64e3894bd5..000000000000 --- a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl +++ /dev/null @@ -1,2 +0,0 @@ -with-hyphens = 1234 -no-crate_foo = abcd diff --git a/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl b/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl deleted file mode 100644 index 4c6514a97700..000000000000 --- a/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl +++ /dev/null @@ -1 +0,0 @@ -no_crate_missing_message_ref = {message} diff --git a/tests/ui-fulldeps/fluent-messages/missing-message.ftl b/tests/ui-fulldeps/fluent-messages/missing-message.ftl deleted file mode 100644 index 61f56fd4d57b..000000000000 --- a/tests/ui-fulldeps/fluent-messages/missing-message.ftl +++ /dev/null @@ -1 +0,0 @@ -no_crate_missing_message = diff --git a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl deleted file mode 100644 index a64c85094f1d..000000000000 --- a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl +++ /dev/null @@ -1 +0,0 @@ -no_crate_this-slug-has-hyphens = hi diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs deleted file mode 100644 index c1f5fe730c76..000000000000 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ /dev/null @@ -1,87 +0,0 @@ -//@ normalize-stderr: "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message" - -#![feature(rustc_private)] -#![crate_type = "lib"] -extern crate rustc_errors; -extern crate rustc_fluent_macro; - -/// Copy of the relevant `DiagMessage` variant constructed by `fluent_messages` as it -/// expects `crate::DiagMessage` to exist. -pub enum DiagMessage { - FluentIdentifier(std::borrow::Cow<'static, str>, Option>), -} - -/// Copy of the relevant `SubdiagMessage` variant constructed by `fluent_messages` as it -/// expects `crate::SubdiagMessage` to exist. -pub enum SubdiagMessage { - FluentAttr(std::borrow::Cow<'static, str>), -} - -mod missing_absolute { - rustc_fluent_macro::fluent_messages! { "/definitely_does_not_exist.ftl" } - //~^ ERROR could not open Fluent resource -} - -mod missing_relative { - rustc_fluent_macro::fluent_messages! { "../definitely_does_not_exist.ftl" } - //~^ ERROR could not open Fluent resource -} - -mod missing_message { - rustc_fluent_macro::fluent_messages! { "./missing-message.ftl" } - //~^ ERROR could not parse Fluent resource -} - -mod duplicate { - rustc_fluent_macro::fluent_messages! { "./duplicate.ftl" } - //~^ ERROR overrides existing message: `no_crate_a_b_key` -} - -mod slug_with_hyphens { - rustc_fluent_macro::fluent_messages! { "./slug-with-hyphens.ftl" } - //~^ ERROR name `no_crate_this-slug-has-hyphens` contains a '-' character -} - -mod label_with_hyphens { - rustc_fluent_macro::fluent_messages! { "./label-with-hyphens.ftl" } - //~^ ERROR attribute `label-has-hyphens` contains a '-' character -} - -mod valid { - rustc_fluent_macro::fluent_messages! { "./valid.ftl" } - - mod test_generated { - use super::{fluent_generated::no_crate_key, DEFAULT_LOCALE_RESOURCE}; - } -} - -mod missing_crate_name { - rustc_fluent_macro::fluent_messages! { "./missing-crate-name.ftl" } - //~^ ERROR name `no-crate_foo` contains a '-' character - //~| ERROR name `with-hyphens` contains a '-' character - //~| ERROR name `with-hyphens` does not start with the crate name - - mod test_generated { - use super::{ - fluent_generated::{no_crate_foo, with_hyphens}, - DEFAULT_LOCALE_RESOURCE, - }; - } -} - -mod missing_message_ref { - rustc_fluent_macro::fluent_messages! { "./missing-message-ref.ftl" } - //~^ ERROR referenced message `message` does not exist -} - -mod bad_escape { - rustc_fluent_macro::fluent_messages! { "./invalid-escape.ftl" } - //~^ ERROR invalid escape `\n` - //~| ERROR invalid escape `\"` - //~| ERROR invalid escape `\'` -} - -mod many_lines { - rustc_fluent_macro::fluent_messages! { "./many-lines.ftl" } - //~^ ERROR could not parse Fluent resource -} diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr deleted file mode 100644 index 0b3bb14ce513..000000000000 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ /dev/null @@ -1,122 +0,0 @@ -error: could not open Fluent resource: os-specific message - --> $DIR/test.rs:21:44 - | -LL | rustc_fluent_macro::fluent_messages! { "/definitely_does_not_exist.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: could not open Fluent resource: os-specific message - --> $DIR/test.rs:26:44 - | -LL | rustc_fluent_macro::fluent_messages! { "../definitely_does_not_exist.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: could not parse Fluent resource - --> $DIR/test.rs:31:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./missing-message.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: see additional errors emitted - -error: expected a message field for "no_crate_missing_message" - --> ./missing-message.ftl:1:1 - | -1 | no_crate_missing_message = - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - -error: overrides existing message: `no_crate_a_b_key` - --> $DIR/test.rs:36:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./duplicate.ftl" } - | ^^^^^^^^^^^^^^^^^ - -error: name `no_crate_this-slug-has-hyphens` contains a '-' character - --> $DIR/test.rs:41:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./slug-with-hyphens.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: replace any '-'s with '_'s - -error: attribute `label-has-hyphens` contains a '-' character - --> $DIR/test.rs:46:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./label-with-hyphens.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: replace any '-'s with '_'s - -error: name `with-hyphens` contains a '-' character - --> $DIR/test.rs:59:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./missing-crate-name.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: replace any '-'s with '_'s - -error: name `with-hyphens` does not start with the crate name - --> $DIR/test.rs:59:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./missing-crate-name.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: prepend `no_crate_` to the slug name: `no_crate_with_hyphens` - -error: name `no-crate_foo` contains a '-' character - --> $DIR/test.rs:59:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./missing-crate-name.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: replace any '-'s with '_'s - -error: referenced message `message` does not exist (in message `no_crate_missing_message_ref`) - --> $DIR/test.rs:73:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./missing-message-ref.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: you may have meant to use a variable reference (`{$message}`) - -error: invalid escape `\n` in Fluent resource - --> $DIR/test.rs:78:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./invalid-escape.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: Fluent does not interpret these escape sequences () - -error: invalid escape `\"` in Fluent resource - --> $DIR/test.rs:78:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./invalid-escape.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: Fluent does not interpret these escape sequences () - -error: invalid escape `\'` in Fluent resource - --> $DIR/test.rs:78:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./invalid-escape.ftl" } - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: Fluent does not interpret these escape sequences () - -error: could not parse Fluent resource - --> $DIR/test.rs:85:44 - | -LL | rustc_fluent_macro::fluent_messages! { "./many-lines.ftl" } - | ^^^^^^^^^^^^^^^^^^ - | - = help: see additional errors emitted - -error: expected a message field for "no_crate_bar" - --> ./many-lines.ftl:8:1 - | -8 | no_crate_bar = - | ^^^^^^^^^^^^^^ - | - -error: aborting due to 14 previous errors - diff --git a/tests/ui-fulldeps/fluent-messages/valid.ftl b/tests/ui-fulldeps/fluent-messages/valid.ftl deleted file mode 100644 index 598473adb680..000000000000 --- a/tests/ui-fulldeps/fluent-messages/valid.ftl +++ /dev/null @@ -1 +0,0 @@ -no_crate_key = Valid! diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs deleted file mode 100644 index 798eca68b1c9..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ /dev/null @@ -1,827 +0,0 @@ -//@ check-fail -// Tests error conditions for specifying diagnostics using #[derive(Diagnostic)] -//@ normalize-stderr: "the following other types implement trait `IntoDiagArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" -//@ normalize-stderr: "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC" - -// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, -// changing the output of this test. Since Diagnostic is strictly internal to the compiler -// the test is just ignored on stable and beta: -//@ ignore-stage1 -//@ ignore-beta -//@ ignore-stable - -#![feature(rustc_private)] -#![crate_type = "lib"] - -extern crate rustc_span; -use rustc_span::symbol::Ident; -use rustc_span::Span; - -extern crate rustc_fluent_macro; -extern crate rustc_macros; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; - -extern crate rustc_middle; -use rustc_middle::ty::Ty; - -extern crate rustc_errors; -use rustc_errors::{Applicability, DiagMessage, ErrCode, MultiSpan, SubdiagMessage}; - -extern crate rustc_session; - -extern crate core; - -rustc_fluent_macro::fluent_messages! { "./example.ftl" } - -// E0123 and E0456 are no longer used, so we define our own constants here just for this test. -const E0123: ErrCode = ErrCode::from_u32(0123); -const E0456: ErrCode = ErrCode::from_u32(0456); - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct Hello {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct HelloWarn {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -//~^ ERROR unsupported type attribute for diagnostic derive enum -enum DiagnosticOnEnum { - Foo, - //~^ ERROR diagnostic slug not specified - Bar, - //~^ ERROR diagnostic slug not specified -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[diag = "E0123"] -//~^ ERROR expected parentheses: #[diag(...)] -struct WrongStructAttrStyle {} - -#[derive(Diagnostic)] -#[nonsense(no_crate_example, code = E0123)] -//~^ ERROR `#[nonsense(...)]` is not a valid attribute -//~^^ ERROR diagnostic slug not specified -//~^^^ ERROR cannot find attribute `nonsense` in this scope -struct InvalidStructAttr {} - -#[derive(Diagnostic)] -#[diag(code = E0123)] -//~^ ERROR diagnostic slug not specified -struct InvalidLitNestedAttr {} - -#[derive(Diagnostic)] -#[diag(nonsense, code = E0123)] -//~^ ERROR cannot find value `nonsense` in module `crate::fluent_generated` -struct InvalidNestedStructAttr {} - -#[derive(Diagnostic)] -#[diag(nonsense("foo"), code = E0123, slug = "foo")] -//~^ ERROR derive(Diagnostic): diagnostic slug not specified -struct InvalidNestedStructAttr1 {} - -#[derive(Diagnostic)] -#[diag(nonsense = "...", code = E0123, slug = "foo")] -//~^ ERROR diagnostic slug not specified -struct InvalidNestedStructAttr2 {} - -#[derive(Diagnostic)] -#[diag(nonsense = 4, code = E0123, slug = "foo")] -//~^ ERROR diagnostic slug not specified -struct InvalidNestedStructAttr3 {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123, slug = "foo")] -//~^ ERROR unknown argument -struct InvalidNestedStructAttr4 {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct WrongPlaceField { - #[suggestion = "bar"] - //~^ ERROR `#[suggestion = ...]` is not a valid attribute - sp: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[diag(no_crate_example, code = E0456)] -//~^ ERROR specified multiple times -struct DiagSpecifiedTwice {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123, code = E0456)] -//~^ ERROR specified multiple times -struct CodeSpecifiedTwice {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, no_crate::example, code = E0123)] -//~^ ERROR diagnostic slug must be the first argument -struct SlugSpecifiedTwice {} - -#[derive(Diagnostic)] -struct KindNotProvided {} //~ ERROR diagnostic slug not specified - -#[derive(Diagnostic)] -#[diag(code = E0123)] -//~^ ERROR diagnostic slug not specified -struct SlugNotProvided {} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct CodeNotProvided {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct MessageWrongType { - #[primary_span] - //~^ ERROR `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - foo: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct InvalidPathFieldAttr { - #[nonsense] - //~^ ERROR `#[nonsense]` is not a valid attribute - //~^^ ERROR cannot find attribute `nonsense` in this scope - foo: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithField { - name: String, - #[label(no_crate_label)] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithMessageAppliedToField { - #[label(no_crate_label)] - //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - name: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithNonexistentField { - #[suggestion(no_crate_suggestion, code = "{name}")] - //~^ ERROR `name` doesn't refer to a field on this type - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -//~^ ERROR invalid format string: expected `}` -#[diag(no_crate_example, code = E0123)] -struct ErrorMissingClosingBrace { - #[suggestion(no_crate_suggestion, code = "{name")] - suggestion: (Span, Applicability), - name: String, - val: usize, -} - -#[derive(Diagnostic)] -//~^ ERROR invalid format string: unmatched `}` -#[diag(no_crate_example, code = E0123)] -struct ErrorMissingOpeningBrace { - #[suggestion(no_crate_suggestion, code = "name}")] - suggestion: (Span, Applicability), - name: String, - val: usize, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct LabelOnSpan { - #[label(no_crate_label)] - sp: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct LabelOnNonSpan { - #[label(no_crate_label)] - //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - id: u32, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct Suggest { - #[suggestion(no_crate_suggestion, code = "This is the suggested code")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "normal")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "short")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "hidden")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "verbose")] - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithoutCode { - #[suggestion(no_crate_suggestion)] - //~^ ERROR suggestion without `code = "..."` - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithBadKey { - #[suggestion(nonsense = "bar")] - //~^ ERROR invalid nested attribute - //~| ERROR suggestion without `code = "..."` - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithShorthandMsg { - #[suggestion(msg = "bar")] - //~^ ERROR invalid nested attribute - //~| ERROR suggestion without `code = "..."` - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithoutMsg { - #[suggestion(code = "bar")] - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithTypesSwapped { - #[suggestion(no_crate_suggestion, code = "This is suggested code")] - suggestion: (Applicability, Span), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithWrongTypeApplicabilityOnly { - #[suggestion(no_crate_suggestion, code = "This is suggested code")] - //~^ ERROR wrong field type for suggestion - suggestion: Applicability, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithSpanOnly { - #[suggestion(no_crate_suggestion, code = "This is suggested code")] - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithDuplicateSpanAndApplicability { - #[suggestion(no_crate_suggestion, code = "This is suggested code")] - suggestion: (Span, Span, Applicability), - //~^ ERROR specified multiple times -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct SuggestWithDuplicateApplicabilityAndSpan { - #[suggestion(no_crate_suggestion, code = "This is suggested code")] - suggestion: (Applicability, Applicability, Span), - //~^ ERROR specified multiple times -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct WrongKindOfAnnotation { - #[label = "bar"] - //~^ ERROR `#[label = ...]` is not a valid attribute - z: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct OptionsInErrors { - #[label(no_crate_label)] - label: Option, - #[suggestion(no_crate_suggestion, code = "...")] - opt_sugg: Option<(Span, Applicability)>, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct MoveOutOfBorrowError<'tcx> { - name: Ident, - ty: Ty<'tcx>, - #[primary_span] - #[label(no_crate_label)] - span: Span, - #[label(no_crate_label)] - other_span: Span, - #[suggestion(no_crate_suggestion, code = "{name}.clone()")] - opt_sugg: Option<(Span, Applicability)>, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithLifetime<'a> { - #[label(no_crate_label)] - span: Span, - name: &'a str, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithDefaultLabelAttr<'a> { - #[label] - span: Span, - name: &'a str, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ArgFieldWithoutSkip { - #[primary_span] - span: Span, - other: Hello, - //~^ ERROR the trait bound `Hello: IntoDiagArg` is not satisfied -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ArgFieldWithSkip { - #[primary_span] - span: Span, - // `Hello` does not implement `IntoDiagArg` so this would result in an error if - // not for `#[skip_arg]`. - #[skip_arg] - other: Hello, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithSpannedNote { - #[note] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithSpannedNoteCustom { - #[note(no_crate_note)] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[note] -struct ErrorWithNote { - val: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[note(no_crate_note)] -struct ErrorWithNoteCustom { - val: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithSpannedHelp { - #[help] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithSpannedHelpCustom { - #[help(no_crate_help)] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[help] -struct ErrorWithHelp { - val: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[help(no_crate_help)] -struct ErrorWithHelpCustom { - val: String, -} - -#[derive(Diagnostic)] -#[help] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithHelpWrongOrder { - val: String, -} - -#[derive(Diagnostic)] -#[help(no_crate_help)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithHelpCustomWrongOrder { - val: String, -} - -#[derive(Diagnostic)] -#[note] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithNoteWrongOrder { - val: String, -} - -#[derive(Diagnostic)] -#[note(no_crate_note)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithNoteCustomWrongOrder { - val: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ApplicabilityInBoth { - #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] - //~^ ERROR specified multiple times - suggestion: (Span, Applicability), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct InvalidApplicability { - #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] - //~^ ERROR invalid applicability - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ValidApplicability { - #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct NoApplicability { - #[suggestion(no_crate_suggestion, code = "...")] - suggestion: Span, -} - -#[derive(Subdiagnostic)] -#[note(no_crate_example)] -struct Note; - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct Subdiagnostic { - #[subdiagnostic] - note: Note, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct VecField { - #[primary_span] - #[label] - spans: Vec, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct UnitField { - #[primary_span] - spans: Span, - #[help] - foo: (), - #[help(no_crate_help)] - bar: (), -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct OptUnitField { - #[primary_span] - spans: Span, - #[help] - foo: Option<()>, - #[help(no_crate_help)] - 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 a diagnostic slug must be the first argument to the attribute - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct LabelWithTrailingNameValue { - #[label(no_crate_label, foo = "...")] - //~^ ERROR no nested attribute expected here - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct LabelWithTrailingList { - #[label(no_crate_label, foo("..."))] - //~^ ERROR no nested attribute expected here - span: Span, -} - -#[derive(LintDiagnostic)] -#[diag(no_crate_example)] -struct LintsGood {} - -#[derive(LintDiagnostic)] -#[diag(no_crate_example)] -struct PrimarySpanOnLint { - #[primary_span] - //~^ ERROR `#[primary_span]` is not a valid attribute - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct ErrorWithMultiSpan { - #[primary_span] - span: MultiSpan, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[warning] -struct ErrorWithWarn { - val: String, -} - -#[derive(Diagnostic)] -#[error(no_crate_example, code = E0123)] -//~^ ERROR `#[error(...)]` is not a valid attribute -//~| ERROR diagnostic slug not specified -//~| ERROR cannot find attribute `error` in this scope -struct ErrorAttribute {} - -#[derive(Diagnostic)] -#[warn_(no_crate_example, code = E0123)] -//~^ ERROR `#[warn_(...)]` is not a valid attribute -//~| ERROR diagnostic slug not specified -//~| ERROR cannot find attribute `warn_` in this scope -struct WarnAttribute {} - -#[derive(Diagnostic)] -#[lint(no_crate_example, code = E0123)] -//~^ ERROR `#[lint(...)]` is not a valid attribute -//~| ERROR diagnostic slug not specified -//~| ERROR cannot find attribute `lint` in this scope -struct LintAttributeOnSessionDiag {} - -#[derive(LintDiagnostic)] -#[lint(no_crate_example, code = E0123)] -//~^ ERROR `#[lint(...)]` is not a valid attribute -//~| ERROR diagnostic slug not specified -//~| ERROR cannot find attribute `lint` in this scope -struct LintAttributeOnLintDiag {} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct DuplicatedSuggestionCode { - #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - //~^ ERROR specified multiple times - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct InvalidTypeInSuggestionTuple { - #[suggestion(no_crate_suggestion, code = "...")] - suggestion: (Span, usize), - //~^ ERROR wrong types for suggestion -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct MissingApplicabilityInSuggestionTuple { - #[suggestion(no_crate_suggestion, code = "...")] - suggestion: (Span,), - //~^ ERROR wrong types for suggestion -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct MissingCodeInSuggestion { - #[suggestion(no_crate_suggestion)] - //~^ ERROR suggestion without `code = "..."` - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[multipart_suggestion(no_crate_suggestion)] -//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute -//~| ERROR cannot find attribute `multipart_suggestion` in this scope -#[multipart_suggestion()] -//~^ ERROR cannot find attribute `multipart_suggestion` in this scope -//~| ERROR `#[multipart_suggestion(...)]` is not a valid attribute -struct MultipartSuggestion { - #[multipart_suggestion(no_crate_suggestion)] - //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute - //~| ERROR cannot find attribute `multipart_suggestion` in this scope - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[suggestion(no_crate_suggestion, code = "...")] -//~^ ERROR `#[suggestion(...)]` is not a valid attribute -struct SuggestionOnStruct { - #[primary_span] - suggestion: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -#[label] -//~^ ERROR `#[label]` is not a valid attribute -struct LabelOnStruct { - #[primary_span] - suggestion: Span, -} - -#[derive(Diagnostic)] -enum ExampleEnum { - #[diag(no_crate_example)] - Foo { - #[primary_span] - sp: Span, - #[note] - note_sp: Span, - }, - #[diag(no_crate_example)] - Bar { - #[primary_span] - sp: Span, - }, - #[diag(no_crate_example)] - Baz, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct RawIdentDiagnosticArg { - pub r#type: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticBad { - #[subdiagnostic(bad)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - note: Note, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticBadStr { - #[subdiagnostic = "bad"] - //~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute - note: Note, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticBadTwice { - #[subdiagnostic(bad, bad)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - note: Note, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticBadLitStr { - #[subdiagnostic("bad")] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - note: Note, -} - -#[derive(LintDiagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticEagerLint { - #[subdiagnostic(eager)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - note: Note, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticEagerFormerlyCorrect { - #[subdiagnostic(eager)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - note: Note, -} - -// Check that formatting of `correct` in suggestion doesn't move the binding for that field, making -// the `arg` call a compile error; and that isn't worked around by moving the `arg` call -// after the `span_suggestion` call - which breaks eager translation. - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, applicability = "machine-applicable", code = "{correct}")] -pub(crate) struct SubdiagnosticWithSuggestion { - #[primary_span] - span: Span, - invalid: String, - correct: String, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SubdiagnosticEagerSuggestion { - #[subdiagnostic(eager)] - //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute - sub: SubdiagnosticWithSuggestion, -} - -/// with a doc comment on the type.. -#[derive(Diagnostic)] -#[diag(no_crate_example, code = E0123)] -struct WithDocComment { - /// ..and the field - #[primary_span] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionsGood { - #[suggestion(code("foo", "bar"))] - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionsSingleItem { - #[suggestion(code("foo"))] - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionsNoItem { - #[suggestion(code())] - //~^ ERROR expected at least one string literal for `code(...)` - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionsInvalidItem { - #[suggestion(code(foo))] - //~^ ERROR `code(...)` must contain only string literals - //~| ERROR unexpected token, expected `)` - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionsInvalidLiteral { - #[suggestion(code = 3)] - //~^ ERROR expected string literal - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionStyleGood { - #[suggestion(code = "", style = "hidden")] - sub: Span, -} - -#[derive(Diagnostic)] -#[diag(no_crate_example)] -struct SuggestionOnVec { - #[suggestion(no_crate_suggestion, code = "")] - //~^ ERROR `#[suggestion(...)]` is not a valid attribute - sub: Vec, -} diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr deleted file mode 100644 index 9ecb6c15767e..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ /dev/null @@ -1,634 +0,0 @@ -error: derive(Diagnostic): unsupported type attribute for diagnostic derive enum - --> $DIR/diagnostic-derive.rs:49:1 - | -LL | #[diag(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:52:5 - | -LL | Foo, - | ^^^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:54:5 - | -LL | Bar, - | ^^^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: expected parentheses: #[diag(...)] - --> $DIR/diagnostic-derive.rs:60:8 - | -LL | #[diag = "E0123"] - | ^ - -error: derive(Diagnostic): `#[nonsense(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:65:1 - | -LL | #[nonsense(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:65:1 - | -LL | #[nonsense(no_crate_example, code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:72:1 - | -LL | #[diag(code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:82:1 - | -LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:87:1 - | -LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:92:1 - | -LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): unknown argument - --> $DIR/diagnostic-derive.rs:97:40 - | -LL | #[diag(no_crate_example, code = E0123, slug = "foo")] - | ^^^^ - | - = note: only the `code` parameter is valid after the slug - -error: derive(Diagnostic): `#[suggestion = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:104:5 - | -LL | #[suggestion = "bar"] - | ^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:111:26 - | -LL | #[diag(no_crate_example, code = E0456)] - | ^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:110:26 - | -LL | #[diag(no_crate_example, code = E0123)] - | ^^^^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:116:40 - | -LL | #[diag(no_crate_example, code = E0123, code = E0456)] - | ^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:116:26 - | -LL | #[diag(no_crate_example, code = E0123, code = E0456)] - | ^^^^ - -error: derive(Diagnostic): diagnostic slug must be the first argument - --> $DIR/diagnostic-derive.rs:121:26 - | -LL | #[diag(no_crate_example, no_crate::example, code = E0123)] - | ^^^^^^^^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:126:1 - | -LL | struct KindNotProvided {} - | ^^^^^^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:129:1 - | -LL | #[diag(code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:140:5 - | -LL | #[primary_span] - | ^ - -error: derive(Diagnostic): `#[nonsense]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:148:5 - | -LL | #[nonsense] - | ^ - -error: derive(Diagnostic): the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:165:5 - | -LL | #[label(no_crate_label)] - | ^ - -error: derive(Diagnostic): `name` doesn't refer to a field on this type - --> $DIR/diagnostic-derive.rs:173:46 - | -LL | #[suggestion(no_crate_suggestion, code = "{name}")] - | ^^^^^^^^ - -error: invalid format string: expected `}` but string was terminated - --> $DIR/diagnostic-derive.rs:178:10 - | -LL | #[derive(Diagnostic)] - | ^^^^^^^^^^ expected `}` in format string - | - = note: if you intended to print `{`, you can escape it using `{{` - = 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:188:10 - | -LL | #[derive(Diagnostic)] - | ^^^^^^^^^^ unmatched `}` in format string - | - = note: if you intended to print `}`, you can escape it using `}}` - = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: derive(Diagnostic): the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:208:5 - | -LL | #[label(no_crate_label)] - | ^ - -error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:227:5 - | -LL | #[suggestion(no_crate_suggestion)] - | ^ - -error: derive(Diagnostic): invalid nested attribute - --> $DIR/diagnostic-derive.rs:235:18 - | -LL | #[suggestion(nonsense = "bar")] - | ^^^^^^^^ - | - = help: only `style`, `code` and `applicability` are valid nested attributes - -error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:235:5 - | -LL | #[suggestion(nonsense = "bar")] - | ^ - -error: derive(Diagnostic): invalid nested attribute - --> $DIR/diagnostic-derive.rs:244:18 - | -LL | #[suggestion(msg = "bar")] - | ^^^ - | - = help: only `style`, `code` and `applicability` are valid nested attributes - -error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:244:5 - | -LL | #[suggestion(msg = "bar")] - | ^ - -error: derive(Diagnostic): wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:267:5 - | -LL | #[suggestion(no_crate_suggestion, code = "This is suggested code")] - | ^ - | - = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:283:24 - | -LL | suggestion: (Span, Span, Applicability), - | ^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:283:18 - | -LL | suggestion: (Span, Span, Applicability), - | ^^^^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:291:33 - | -LL | suggestion: (Applicability, Applicability, Span), - | ^^^^^^^^^^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:291:18 - | -LL | suggestion: (Applicability, Applicability, Span), - | ^^^^^^^^^^^^^ - -error: derive(Diagnostic): `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:298:5 - | -LL | #[label = "bar"] - | ^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:449:5 - | -LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] - | ^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:451:24 - | -LL | suggestion: (Span, Applicability), - | ^^^^^^^^^^^^^ - -error: derive(Diagnostic): invalid applicability - --> $DIR/diagnostic-derive.rs:457:69 - | -LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] - | ^^^^^^^^ - -error: derive(Diagnostic): the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()` - --> $DIR/diagnostic-derive.rs:524:5 - | -LL | #[help(no_crate_help)] - | ^ - -error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute - --> $DIR/diagnostic-derive.rs:533:29 - | -LL | #[label(no_crate_label, foo)] - | ^^^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/diagnostic-derive.rs:541:29 - | -LL | #[label(no_crate_label, foo = "...")] - | ^^^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/diagnostic-derive.rs:549:29 - | -LL | #[label(no_crate_label, foo("..."))] - | ^^^ - -error: derive(Diagnostic): `#[primary_span]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:561:5 - | -LL | #[primary_span] - | ^ - | - = help: the `primary_span` field attribute is not valid for lint diagnostics - -error: derive(Diagnostic): `#[error(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:581:1 - | -LL | #[error(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:581:1 - | -LL | #[error(no_crate_example, code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): `#[warn_(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:588:1 - | -LL | #[warn_(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:588:1 - | -LL | #[warn_(no_crate_example, code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:595:1 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:595:1 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:602:1 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^ - -error: derive(Diagnostic): diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:602:1 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^ - | - = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/diagnostic-derive.rs:611:53 - | -LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:611:39 - | -LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] - | ^^^^ - -error: derive(Diagnostic): wrong types for suggestion - --> $DIR/diagnostic-derive.rs:620:24 - | -LL | suggestion: (Span, usize), - | ^^^^^ - | - = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` - -error: derive(Diagnostic): wrong types for suggestion - --> $DIR/diagnostic-derive.rs:628:17 - | -LL | suggestion: (Span,), - | ^^^^^^^ - | - = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` - -error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:635:5 - | -LL | #[suggestion(no_crate_suggestion)] - | ^ - -error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:642:1 - | -LL | #[multipart_suggestion(no_crate_suggestion)] - | ^ - | - = help: consider creating a `Subdiagnostic` instead - -error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:645:1 - | -LL | #[multipart_suggestion()] - | ^ - | - = help: consider creating a `Subdiagnostic` instead - -error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:649:5 - | -LL | #[multipart_suggestion(no_crate_suggestion)] - | ^ - | - = help: consider creating a `Subdiagnostic` instead - -error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:657:1 - | -LL | #[suggestion(no_crate_suggestion, code = "...")] - | ^ - | - = help: `#[label]` and `#[suggestion]` can only be applied to fields - -error: derive(Diagnostic): `#[label]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:666:1 - | -LL | #[label] - | ^ - | - = help: `#[label]` and `#[suggestion]` can only be applied to fields - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:700:5 - | -LL | #[subdiagnostic(bad)] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:708:5 - | -LL | #[subdiagnostic = "bad"] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:716:5 - | -LL | #[subdiagnostic(bad, bad)] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:724:5 - | -LL | #[subdiagnostic("bad")] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:732:5 - | -LL | #[subdiagnostic(eager)] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:740:5 - | -LL | #[subdiagnostic(eager)] - | ^ - -error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:761:5 - | -LL | #[subdiagnostic(eager)] - | ^ - -error: derive(Diagnostic): expected at least one string literal for `code(...)` - --> $DIR/diagnostic-derive.rs:792:23 - | -LL | #[suggestion(code())] - | ^ - -error: derive(Diagnostic): `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:800:23 - | -LL | #[suggestion(code(foo))] - | ^^^ - -error: unexpected token, expected `)` - --> $DIR/diagnostic-derive.rs:800:23 - | -LL | #[suggestion(code(foo))] - | ^^^ - -error: expected string literal - --> $DIR/diagnostic-derive.rs:809:25 - | -LL | #[suggestion(code = 3)] - | ^ - -error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:824:5 - | -LL | #[suggestion(no_crate_suggestion, code = "")] - | ^ - | - = note: `#[suggestion(...)]` applied to `Vec` field is ambiguous - = help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]` - = help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]` - -error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:65:3 - | -LL | #[nonsense(no_crate_example, code = E0123)] - | ^^^^^^^^ - -error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:148:7 - | -LL | #[nonsense] - | ^^^^^^^^ - -error: cannot find attribute `error` in this scope - --> $DIR/diagnostic-derive.rs:581:3 - | -LL | #[error(no_crate_example, code = E0123)] - | ^^^^^ - | -help: `error` is an attribute that can be used by the derive macro `Error`, you might be missing a `derive` attribute - | -LL + #[derive(Error)] -LL | struct ErrorAttribute {} - | - -error: cannot find attribute `warn_` in this scope - --> $DIR/diagnostic-derive.rs:588:3 - | -LL | #[warn_(no_crate_example, code = E0123)] - | ^^^^^ - | -help: a built-in attribute with a similar name exists - | -LL - #[warn_(no_crate_example, code = E0123)] -LL + #[warn(no_crate_example, code = E0123)] - | - -error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:595:3 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ - | -help: a built-in attribute with a similar name exists - | -LL - #[lint(no_crate_example, code = E0123)] -LL + #[link(no_crate_example, code = E0123)] - | - -error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:602:3 - | -LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ - | -help: a built-in attribute with a similar name exists - | -LL - #[lint(no_crate_example, code = E0123)] -LL + #[link(no_crate_example, code = E0123)] - | - -error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:642:3 - | -LL | #[multipart_suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^ - | -help: `multipart_suggestion` is an attribute that can be used by the derive macro `Subdiagnostic`, you might be missing a `derive` attribute - | -LL + #[derive(Subdiagnostic)] -LL | struct MultipartSuggestion { - | - -error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:645:3 - | -LL | #[multipart_suggestion()] - | ^^^^^^^^^^^^^^^^^^^^ - | -help: `multipart_suggestion` is an attribute that can be used by the derive macro `Subdiagnostic`, you might be missing a `derive` attribute - | -LL + #[derive(Subdiagnostic)] -LL | struct MultipartSuggestion { - | - -error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:649:7 - | -LL | #[multipart_suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: `multipart_suggestion` is an attribute that can be used by the derive macro `Subdiagnostic`, you might be missing a `derive` attribute - -error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated` - --> $DIR/diagnostic-derive.rs:77:8 - | -LL | #[diag(nonsense, code = E0123)] - | ^^^^^^^^ not found in `crate::fluent_generated` - -error[E0277]: the trait bound `Hello: IntoDiagArg` is not satisfied - --> $DIR/diagnostic-derive.rs:347:12 - | -LL | #[derive(Diagnostic)] - | ---------- required by a bound introduced by this call -... -LL | other: Hello, - | ^^^^^ unsatisfied trait bound - | -help: the nightly-only, unstable trait `IntoDiagArg` is not implemented for `Hello` - --> $DIR/diagnostic-derive.rs:42:1 - | -LL | struct Hello {} - | ^^^^^^^^^^^^ - = help: normalized in stderr -note: required by a bound in `Diag::<'a, G>::arg` - --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC - ::: $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC - | - = note: in this macro invocation - = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 80 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/enforce_slug_naming.rs b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs deleted file mode 100644 index 6402b00ef0a9..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ rustc-env:CARGO_CRATE_NAME=rustc_dummy - -#![feature(rustc_private)] -#![crate_type = "lib"] - -extern crate rustc_span; -use rustc_span::symbol::Ident; -use rustc_span::Span; - -extern crate rustc_macros; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; - -extern crate rustc_middle; -use rustc_middle::ty::Ty; - -extern crate rustc_errors; -use rustc_errors::{Applicability, MultiSpan}; - -extern crate rustc_session; - -#[derive(Diagnostic)] -#[diag(compiletest_example, code = E0123)] -//~^ ERROR diagnostic slug and crate name do not match -struct Hello {} diff --git a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr deleted file mode 100644 index 4f54239f0fa3..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: derive(Diagnostic): diagnostic slug and crate name do not match - --> $DIR/enforce_slug_naming.rs:22:8 - | -LL | #[diag(compiletest_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: slug is `compiletest_example` but the crate name is `rustc_dummy` - = help: expected a slug starting with `dummy_...` - -error: aborting due to 1 previous error - diff --git a/tests/ui-fulldeps/session-diagnostic/example.ftl b/tests/ui-fulldeps/session-diagnostic/example.ftl deleted file mode 100644 index 1d1ba8e1bd5c..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/example.ftl +++ /dev/null @@ -1,7 +0,0 @@ -no_crate_example = this is an example message used in testing - .note = with a note - .help = with a help - .suggestion = with a suggestion - .label = with a label - -no_crate_bad_reference = {$r} does not exist diff --git a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs deleted file mode 100644 index cbe9e3f4ef4c..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ run-fail -//@ compile-flags: --test -// test that messages referencing non-existent fields cause test failures - -#![feature(rustc_private)] -#![crate_type = "lib"] - -extern crate rustc_driver; -extern crate rustc_fluent_macro; -extern crate rustc_macros; -extern crate rustc_errors; -use rustc_macros::Diagnostic; -use rustc_errors::{DiagMessage, SubdiagMessage}; -extern crate rustc_session; - -rustc_fluent_macro::fluent_messages! { "./example.ftl" } - -#[derive(Diagnostic)] -#[diag(no_crate_bad_reference)] -struct BadRef; diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.rs deleted file mode 100644 index f42fe1689842..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.rs +++ /dev/null @@ -1,37 +0,0 @@ -//@ check-fail -// Tests error conditions for specifying subdiagnostics using #[derive(Subdiagnostic)]. -// This test is split off from the main `subdiagnostic-derive`, -// because this error is generated post-expansion. - -// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, -// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler -// the test is just ignored on stable and beta: -//@ ignore-stage1 -//@ ignore-beta -//@ ignore-stable - -#![feature(rustc_private)] -#![crate_type = "lib"] - -extern crate rustc_errors; -extern crate rustc_fluent_macro; -extern crate rustc_macros; -extern crate rustc_session; -extern crate rustc_span; -extern crate core; - -use rustc_errors::{Applicability, DiagMessage, SubdiagMessage}; -use rustc_macros::Subdiagnostic; -use rustc_span::Span; - -rustc_fluent_macro::fluent_messages! { "./example.ftl" } - -#[derive(Subdiagnostic)] -#[label(slug)] -//~^ ERROR cannot find value `slug` in module `crate::fluent_generated` -//~^^ NOTE not found in `crate::fluent_generated` -struct L { - #[primary_span] - span: Span, - var: String, -} diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.stderr deleted file mode 100644 index 37566e39fcd6..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find value `slug` in module `crate::fluent_generated` - --> $DIR/subdiagnostic-derive-2.rs:30:9 - | -LL | #[label(slug)] - | ^^^^ not found in `crate::fluent_generated` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs deleted file mode 100644 index c06ea451b9bf..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ /dev/null @@ -1,809 +0,0 @@ -//@ check-fail -// Tests error conditions for specifying subdiagnostics using #[derive(Subdiagnostic)] - -// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, -// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler -// the test is just ignored on stable and beta: -//@ ignore-stage1 -//@ ignore-beta -//@ ignore-stable - -#![feature(rustc_private)] -#![crate_type = "lib"] - -extern crate rustc_errors; -extern crate rustc_fluent_macro; -extern crate rustc_macros; -extern crate rustc_session; -extern crate rustc_span; -extern crate core; - -use rustc_errors::{Applicability, DiagMessage, SubdiagMessage}; -use rustc_macros::Subdiagnostic; -use rustc_span::Span; - -rustc_fluent_macro::fluent_messages! { "./example.ftl" } - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct A { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -enum B { - #[label(no_crate_example)] - A { - #[primary_span] - span: Span, - var: String, - }, - #[label(no_crate_example)] - B { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -//~^ ERROR label without `#[primary_span]` field -struct C { - var: String, -} - -#[derive(Subdiagnostic)] -#[label] -//~^ ERROR diagnostic slug must be first argument -struct D { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[foo] -//~^ ERROR `#[foo]` is not a valid attribute -//~^^ ERROR cannot find attribute `foo` in this scope -struct E { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label = "..."] -//~^ ERROR `#[label = ...]` is not a valid attribute -struct F { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label(bug = "...")] -//~^ ERROR no nested attribute expected here -//~| ERROR diagnostic slug must be first argument -struct G { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label(slug = 4)] -//~^ ERROR no nested attribute expected here -//~| ERROR diagnostic slug must be first argument -struct J { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label(slug("..."))] -//~^ ERROR no nested attribute expected here -//~| ERROR diagnostic slug must be first argument -struct K { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label()] -//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute -struct M { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example, code = "...")] -//~^ ERROR no nested attribute expected here -struct N { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example, applicability = "machine-applicable")] -//~^ ERROR no nested attribute expected here -struct O { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[foo] -//~^ ERROR cannot find attribute `foo` in this scope -//~^^ ERROR unsupported type attribute for subdiagnostic enum -enum P { - #[label(no_crate_example)] - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum Q { - #[bar] - //~^ ERROR `#[bar]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum R { - #[bar = "..."] - //~^ ERROR `#[bar = ...]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum S { - #[bar = 4] - //~^ ERROR `#[bar = ...]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum T { - #[bar("...")] - //~^ ERROR `#[bar(...)]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum U { - #[label(code = "...")] - //~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute - //~| ERROR no nested attribute expected here - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum V { - #[label(no_crate_example)] - A { - #[primary_span] - span: Span, - var: String, - }, - B { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -//~^ ERROR label without `#[primary_span]` field -struct W { - #[primary_span] - //~^ ERROR the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - span: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct X { - #[primary_span] - span: Span, - #[applicability] - //~^ ERROR `#[applicability]` is only valid on suggestions - applicability: Applicability, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct Y { - #[primary_span] - span: Span, - #[bar] - //~^ ERROR `#[bar]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - bar: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct Z { - #[primary_span] - span: Span, - #[bar = "..."] - //~^ ERROR `#[bar = ...]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - bar: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct AA { - #[primary_span] - span: Span, - #[bar("...")] - //~^ ERROR `#[bar(...)]` is not a valid attribute - //~^^ ERROR cannot find attribute `bar` in this scope - bar: String, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct AB { - #[primary_span] - span: Span, - #[skip_arg] - z: Z, -} - -#[derive(Subdiagnostic)] -union AC { - //~^ ERROR unexpected unsupported untagged union - span: u32, - b: u64, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -#[label(no_crate_example)] -struct AD { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example, no_crate::example)] -//~^ ERROR a diagnostic slug must be the first argument to the attribute -struct AE { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct AF { - #[primary_span] - //~^ NOTE previously specified here - span_a: Span, - #[primary_span] - //~^ ERROR specified multiple times - span_b: Span, -} - -#[derive(Subdiagnostic)] -struct AG { - //~^ ERROR subdiagnostic kind not specified - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -struct AH { - #[primary_span] - span: Span, - #[applicability] - applicability: Applicability, - var: String, -} - -#[derive(Subdiagnostic)] -enum AI { - #[suggestion(no_crate_example, code = "...")] - A { - #[primary_span] - span: Span, - #[applicability] - applicability: Applicability, - var: String, - }, - #[suggestion(no_crate_example, code = "...")] - B { - #[primary_span] - span: Span, - #[applicability] - applicability: Applicability, - var: String, - }, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...", code = "...")] -//~^ ERROR specified multiple times -//~^^ NOTE previously specified here -struct AJ { - #[primary_span] - span: Span, - #[applicability] - applicability: Applicability, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -struct AK { - #[primary_span] - span: Span, - #[applicability] - //~^ NOTE previously specified here - applicability_a: Applicability, - #[applicability] - //~^ ERROR specified multiple times - applicability_b: Applicability, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -struct AL { - #[primary_span] - span: Span, - #[applicability] - //~^ ERROR the `#[applicability]` attribute can only be applied to fields of type `Applicability` - applicability: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -struct AM { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example)] -//~^ ERROR suggestion without `code = "..."` -struct AN { - #[primary_span] - span: Span, - #[applicability] - applicability: Applicability, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...", applicability = "foo")] -//~^ ERROR invalid applicability -struct AO { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[help(no_crate_example)] -struct AP { - var: String, -} - -#[derive(Subdiagnostic)] -#[note(no_crate_example)] -struct AQ; - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -//~^ ERROR suggestion without `#[primary_span]` field -struct AR { - var: String, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] -struct AS { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[label] -//~^ ERROR unsupported type attribute for subdiagnostic enum -enum AT { - #[label(no_crate_example)] - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] -struct AU { - #[primary_span] - span: Span, - var: String, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] -//~^ ERROR `var` doesn't refer to a field on this type -struct AV { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -enum AW { - #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] - A { - #[primary_span] - span: Span, - var: String, - }, -} - -#[derive(Subdiagnostic)] -enum AX { - #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] - //~^ ERROR `var` doesn't refer to a field on this type - A { - #[primary_span] - span: Span, - }, -} - -#[derive(Subdiagnostic)] -#[warning(no_crate_example)] -struct AY {} - -#[derive(Subdiagnostic)] -#[warning(no_crate_example)] -struct AZ { - #[primary_span] - span: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "...")] -//~^ ERROR suggestion without `#[primary_span]` field -struct BA { - #[suggestion_part] - //~^ ERROR `#[suggestion_part]` is not a valid attribute - span: Span, - #[suggestion_part(code = "...")] - //~^ ERROR `#[suggestion_part(...)]` is not a valid attribute - span2: Span, - #[applicability] - applicability: Applicability, - var: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] -//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields -//~| ERROR invalid nested attribute -struct BBa { - var: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BBb { - #[suggestion_part] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` - span1: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BBc { - #[suggestion_part()] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` - span1: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields -struct BC { - #[primary_span] - //~^ ERROR `#[primary_span]` is not a valid attribute - span: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BD { - #[suggestion_part] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` - span1: Span, - #[suggestion_part()] - //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` - span2: Span, - #[suggestion_part(foo = "bar")] - //~^ 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` - s1: String, - #[suggestion_part()] - //~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - s2: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BE { - #[suggestion_part(code = "...", code = ",,,")] - //~^ ERROR specified multiple times - //~| NOTE previously specified here - span: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BF { - #[suggestion_part(code = "(")] - first: Span, - #[suggestion_part(code = ")")] - second: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BG { - #[applicability] - appl: Applicability, - #[suggestion_part(code = "(")] - first: Span, - #[suggestion_part(code = ")")] - second: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BH { - #[applicability] - //~^ ERROR `#[applicability]` has no effect - appl: Applicability, - #[suggestion_part(code = "(")] - first: Span, - #[suggestion_part(code = ")")] - second: Span, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] -struct BI { - #[suggestion_part(code = "")] - spans: Vec, -} - -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct BJ { - #[primary_span] - span: Span, - r#type: String, -} - -/// with a doc comment on the type.. -#[derive(Subdiagnostic)] -#[label(no_crate_example)] -struct BK { - /// ..and the field - #[primary_span] - span: Span, -} - -/// with a doc comment on the type.. -#[derive(Subdiagnostic)] -enum BL { - /// ..and the variant.. - #[label(no_crate_example)] - Foo { - /// ..and the field - #[primary_span] - span: Span, - }, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BM { - #[suggestion_part(code("foo"))] - //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR unexpected token, expected `)` - span: Span, - r#type: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BN { - #[suggestion_part(code("foo", "bar"))] - //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR unexpected token, expected `)` - span: Span, - r#type: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BO { - #[suggestion_part(code(3))] - //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR unexpected token, expected `)` - span: Span, - r#type: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BP { - #[suggestion_part(code())] - //~^ ERROR expected exactly one string literal for `code = ...` - span: Span, - r#type: String, -} - -#[derive(Subdiagnostic)] -#[multipart_suggestion(no_crate_example)] -struct BQ { - #[suggestion_part(code = 3)] - //~^ ERROR expected string literal - span: Span, - r#type: String, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "")] -struct SuggestionStyleDefault { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "short")] -struct SuggestionStyleShort { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "hidden")] -struct SuggestionStyleHidden { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "verbose")] -struct SuggestionStyleVerbose { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "tool-only")] -struct SuggestionStyleToolOnly { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] -//~^ ERROR specified multiple times -//~| NOTE previously specified here -struct SuggestionStyleTwice { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion_hidden(no_crate_example, code = "")] -//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute -struct SuggestionStyleOldSyntax { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion_hidden(no_crate_example, code = "", style = "normal")] -//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute -struct SuggestionStyleOldAndNewSyntax { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "foo")] -//~^ ERROR invalid suggestion style -struct SuggestionStyleInvalid1 { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = 42)] -//~^ ERROR expected string literal -struct SuggestionStyleInvalid2 { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style)] -//~^ ERROR a diagnostic slug must be the first argument to the attribute -struct SuggestionStyleInvalid3 { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style("foo"))] -//~^ ERROR expected `=` -struct SuggestionStyleInvalid4 { - #[primary_span] - sub: Span, -} - -#[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "")] -//~^ ERROR suggestion without `#[primary_span]` field -struct PrimarySpanOnVec { - #[primary_span] - //~^ ERROR `#[primary_span]` is not a valid attribute - //~| NOTE there must be exactly one primary span - sub: Vec, -} - -#[derive(Subdiagnostic)] -struct NestedParent { - #[subdiagnostic] - single_sub: A, - #[subdiagnostic] - option_sub: Option, - #[subdiagnostic] - vec_sub: Vec, -} diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr deleted file mode 100644 index 9f18f7ffabcc..000000000000 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ /dev/null @@ -1,549 +0,0 @@ -error: derive(Diagnostic): label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:52:1 - | -LL | #[label(no_crate_example)] - | ^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:59:1 - | -LL | #[label] - | ^ - -error: derive(Diagnostic): `#[foo]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:68:1 - | -LL | #[foo] - | ^ - -error: derive(Diagnostic): `#[label = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:78:1 - | -LL | #[label = "..."] - | ^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:87:9 - | -LL | #[label(bug = "...")] - | ^^^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:87:1 - | -LL | #[label(bug = "...")] - | ^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:97:9 - | -LL | #[label(slug = 4)] - | ^^^^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:97:1 - | -LL | #[label(slug = 4)] - | ^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:107:9 - | -LL | #[label(slug("..."))] - | ^^^^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:107:1 - | -LL | #[label(slug("..."))] - | ^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:117:1 - | -LL | #[label()] - | ^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:126:27 - | -LL | #[label(no_crate_example, code = "...")] - | ^^^^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:135:27 - | -LL | #[label(no_crate_example, applicability = "machine-applicable")] - | ^^^^^^^^^^^^^ - -error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:144:1 - | -LL | #[foo] - | ^ - -error: derive(Diagnostic): `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:158:5 - | -LL | #[bar] - | ^ - -error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:170:5 - | -LL | #[bar = "..."] - | ^ - -error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:182:5 - | -LL | #[bar = 4] - | ^ - -error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:194:5 - | -LL | #[bar("...")] - | ^ - -error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive.rs:206:13 - | -LL | #[label(code = "...")] - | ^^^^ - -error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:206:5 - | -LL | #[label(code = "...")] - | ^ - -error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:235:5 - | -LL | #[primary_span] - | ^ - -error: derive(Diagnostic): label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:232:1 - | -LL | #[label(no_crate_example)] - | ^ - -error: derive(Diagnostic): `#[applicability]` is only valid on suggestions - --> $DIR/subdiagnostic-derive.rs:245:5 - | -LL | #[applicability] - | ^ - -error: derive(Diagnostic): `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:255:5 - | -LL | #[bar] - | ^ - | - = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes - -error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:266:5 - | -LL | #[bar = "..."] - | ^ - -error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:277:5 - | -LL | #[bar("...")] - | ^ - | - = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes - -error: unexpected unsupported untagged union - --> $DIR/subdiagnostic-derive.rs:293:1 - | -LL | / union AC { -LL | | -LL | | span: u32, -LL | | b: u64, -LL | | } - | |_^ - -error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute - --> $DIR/subdiagnostic-derive.rs:308:27 - | -LL | #[label(no_crate_example, no_crate::example)] - | ^^^^^^^^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive.rs:321:5 - | -LL | #[primary_span] - | ^ - | -note: previously specified here - --> $DIR/subdiagnostic-derive.rs:318:5 - | -LL | #[primary_span] - | ^ - -error: derive(Diagnostic): subdiagnostic kind not specified - --> $DIR/subdiagnostic-derive.rs:327:8 - | -LL | struct AG { - | ^^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive.rs:364:46 - | -LL | #[suggestion(no_crate_example, code = "...", code = "...")] - | ^^^^ - | -note: previously specified here - --> $DIR/subdiagnostic-derive.rs:364:32 - | -LL | #[suggestion(no_crate_example, code = "...", code = "...")] - | ^^^^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive.rs:382:5 - | -LL | #[applicability] - | ^ - | -note: previously specified here - --> $DIR/subdiagnostic-derive.rs:379:5 - | -LL | #[applicability] - | ^ - -error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability` - --> $DIR/subdiagnostic-derive.rs:392:5 - | -LL | #[applicability] - | ^ - -error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:405:1 - | -LL | #[suggestion(no_crate_example)] - | ^ - -error: derive(Diagnostic): invalid applicability - --> $DIR/subdiagnostic-derive.rs:415:62 - | -LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] - | ^^^^^ - -error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:433:1 - | -LL | #[suggestion(no_crate_example, code = "...")] - | ^ - -error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:447:1 - | -LL | #[label] - | ^ - -error: derive(Diagnostic): `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:467:39 - | -LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] - | ^^^^^^^ - -error: derive(Diagnostic): `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:486:43 - | -LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] - | ^^^^^^^ - -error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:509:5 - | -LL | #[suggestion_part] - | ^ - | - = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead - -error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:512:5 - | -LL | #[suggestion_part(code = "...")] - | ^ - | - = help: `#[suggestion_part(...)]` is only valid in multipart suggestions - -error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:506:1 - | -LL | #[suggestion(no_crate_example, code = "...")] - | ^ - -error: derive(Diagnostic): invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:521:42 - | -LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] - | ^^^^ - | - = help: only `style` and `applicability` are valid nested attributes - -error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:521:1 - | -LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] - | ^ - -error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:531:5 - | -LL | #[suggestion_part] - | ^ - -error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:539:5 - | -LL | #[suggestion_part()] - | ^ - -error: derive(Diagnostic): `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:548:5 - | -LL | #[primary_span] - | ^ - | - = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` - -error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:545:1 - | -LL | #[multipart_suggestion(no_crate_example)] - | ^ - -error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:556:5 - | -LL | #[suggestion_part] - | ^ - -error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:559:5 - | -LL | #[suggestion_part()] - | ^ - -error: derive(Diagnostic): `code` is the only valid nested attribute - --> $DIR/subdiagnostic-derive.rs:562:23 - | -LL | #[suggestion_part(foo = "bar")] - | ^^^ - -error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:566:5 - | -LL | #[suggestion_part(code = "...")] - | ^ - -error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:569:5 - | -LL | #[suggestion_part()] - | ^ - -error: expected `,` - --> $DIR/subdiagnostic-derive.rs:562:27 - | -LL | #[suggestion_part(foo = "bar")] - | ^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive.rs:577:37 - | -LL | #[suggestion_part(code = "...", code = ",,,")] - | ^^^^ - | -note: previously specified here - --> $DIR/subdiagnostic-derive.rs:577:23 - | -LL | #[suggestion_part(code = "...", code = ",,,")] - | ^^^^ - -error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` - --> $DIR/subdiagnostic-derive.rs:606:5 - | -LL | #[applicability] - | ^ - -error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:654:28 - | -LL | #[suggestion_part(code("foo"))] - | ^^^^^ - -error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive.rs:654:28 - | -LL | #[suggestion_part(code("foo"))] - | ^^^^^ - -error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:664:28 - | -LL | #[suggestion_part(code("foo", "bar"))] - | ^^^^^ - -error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive.rs:664:28 - | -LL | #[suggestion_part(code("foo", "bar"))] - | ^^^^^ - -error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:674:28 - | -LL | #[suggestion_part(code(3))] - | ^ - -error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive.rs:674:28 - | -LL | #[suggestion_part(code(3))] - | ^ - -error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:684:28 - | -LL | #[suggestion_part(code())] - | ^ - -error: expected string literal - --> $DIR/subdiagnostic-derive.rs:693:30 - | -LL | #[suggestion_part(code = 3)] - | ^ - -error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive.rs:735:1 - | -LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^ - | -note: previously specified here - --> $DIR/subdiagnostic-derive.rs:735:1 - | -LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^ - -error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:744:1 - | -LL | #[suggestion_hidden(no_crate_example, code = "")] - | ^ - | - = help: Use `#[suggestion(..., style = "hidden")]` instead - -error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:752:1 - | -LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] - | ^ - | - = help: Use `#[suggestion(..., style = "hidden")]` instead - -error: derive(Diagnostic): invalid suggestion style - --> $DIR/subdiagnostic-derive.rs:760:51 - | -LL | #[suggestion(no_crate_example, code = "", style = "foo")] - | ^^^^^ - | - = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` - -error: expected string literal - --> $DIR/subdiagnostic-derive.rs:768:51 - | -LL | #[suggestion(no_crate_example, code = "", style = 42)] - | ^^ - -error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute - --> $DIR/subdiagnostic-derive.rs:776:43 - | -LL | #[suggestion(no_crate_example, code = "", style)] - | ^^^^^ - -error: expected `=` - --> $DIR/subdiagnostic-derive.rs:784:48 - | -LL | #[suggestion(no_crate_example, code = "", style("foo"))] - | ^ - -error: derive(Diagnostic): `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:795:5 - | -LL | #[primary_span] - | ^ - | - = note: there must be exactly one primary span - = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead - -error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:792:1 - | -LL | #[suggestion(no_crate_example, code = "")] - | ^ - -error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:68:3 - | -LL | #[foo] - | ^^^ - -error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:144:3 - | -LL | #[foo] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:158:7 - | -LL | #[bar] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:170:7 - | -LL | #[bar = "..."] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:182:7 - | -LL | #[bar = 4] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:194:7 - | -LL | #[bar("...")] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:255:7 - | -LL | #[bar] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:266:7 - | -LL | #[bar = "..."] - | ^^^ - -error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:277:7 - | -LL | #[bar("...")] - | ^^^ - -error: aborting due to 82 previous errors -