diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2022-08-19 15:40:48 +0200 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2022-08-21 09:17:43 +0200 |
| commit | 7f3a6fd7f6c04635f3d541201199f127f2a2e65e (patch) | |
| tree | 4b9be1a4a7d5610f9ad2b58054724d900de1ee42 /src | |
| parent | bd0d3f745d40c9de9c5dbc24dc7f8fb64ceb5575 (diff) | |
| download | rust-7f3a6fd7f6c04635f3d541201199f127f2a2e65e.tar.gz rust-7f3a6fd7f6c04635f3d541201199f127f2a2e65e.zip | |
Replace #[lint/warning/error] with #[diag]
Diffstat (limited to 'src')
3 files changed, 286 insertions, 213 deletions
diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.rs b/src/test/ui-fulldeps/internal-lints/diagnostics.rs index d6f63d44ba6..33192433bbf 100644 --- a/src/test/ui-fulldeps/internal-lints/diagnostics.rs +++ b/src/test/ui-fulldeps/internal-lints/diagnostics.rs @@ -16,7 +16,7 @@ use rustc_session::{parse::ParseSess, SessionDiagnostic}; use rustc_span::Span; #[derive(SessionDiagnostic)] -#[error(parser::expect_path)] +#[diag(parser::expect_path)] struct DeriveSessionDiagnostic { #[primary_span] span: Span, diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 842fdee9221..aaa8caa64f3 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -28,15 +28,15 @@ use rustc_errors::{Applicability, MultiSpan}; extern crate rustc_session; #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct Hello {} #[derive(SessionDiagnostic)] -#[warning(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct HelloWarn {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] //~^ ERROR `#[derive(SessionDiagnostic)]` can only be used on structs enum SessionDiagnosticOnEnum { Foo, @@ -44,9 +44,9 @@ enum SessionDiagnosticOnEnum { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] -#[error = "E0123"] -//~^ ERROR `#[error = ...]` is not a valid attribute +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag = "E0123"] +//~^ ERROR `#[diag = ...]` is not a valid attribute struct WrongStructAttrStyle {} #[derive(SessionDiagnostic)] @@ -57,41 +57,41 @@ struct WrongStructAttrStyle {} struct InvalidStructAttr {} #[derive(SessionDiagnostic)] -#[error("E0123")] -//~^ ERROR `#[error("...")]` is not a valid attribute +#[diag("E0123")] +//~^ ERROR `#[diag("...")]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidLitNestedAttr {} #[derive(SessionDiagnostic)] -#[error(nonsense, code = "E0123")] +#[diag(nonsense, code = "E0123")] //~^ ERROR cannot find value `nonsense` in module `rustc_errors::fluent` struct InvalidNestedStructAttr {} #[derive(SessionDiagnostic)] -#[error(nonsense("foo"), code = "E0123", slug = "foo")] -//~^ ERROR `#[error(nonsense(...))]` is not a valid attribute +#[diag(nonsense("foo"), code = "E0123", slug = "foo")] +//~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr1 {} #[derive(SessionDiagnostic)] -#[error(nonsense = "...", code = "E0123", slug = "foo")] -//~^ ERROR `#[error(nonsense = ...)]` is not a valid attribute +#[diag(nonsense = "...", code = "E0123", slug = "foo")] +//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr2 {} #[derive(SessionDiagnostic)] -#[error(nonsense = 4, code = "E0123", slug = "foo")] -//~^ ERROR `#[error(nonsense = ...)]` is not a valid attribute +#[diag(nonsense = 4, code = "E0123", slug = "foo")] +//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr3 {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")] -//~^ ERROR `#[error(slug = ...)]` is not a valid attribute +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")] +//~^ ERROR `#[diag(slug = ...)]` is not a valid attribute struct InvalidNestedStructAttr4 {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct WrongPlaceField { #[suggestion = "bar"] //~^ ERROR `#[suggestion = ...]` is not a valid attribute @@ -99,43 +99,36 @@ struct WrongPlaceField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] -#[error(typeck::ambiguous_lifetime_bound, code = "E0456")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] //~^ ERROR specified multiple times //~^^ ERROR specified multiple times -struct ErrorSpecifiedTwice {} +struct DiagSpecifiedTwice {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] -#[warning(typeck::ambiguous_lifetime_bound, code = "E0293")] -//~^ ERROR specified multiple times -//~^^ ERROR specified multiple times -struct WarnSpecifiedAfterError {} - -#[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] //~^ ERROR specified multiple times struct CodeSpecifiedTwice {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")] -//~^ ERROR `#[error(typeck::ambiguous_lifetime_bound)]` is not a valid attribute +#[diag(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")] +//~^ ERROR `#[diag(typeck::ambiguous_lifetime_bound)]` is not a valid attribute struct SlugSpecifiedTwice {} #[derive(SessionDiagnostic)] struct KindNotProvided {} //~ ERROR diagnostic slug not specified #[derive(SessionDiagnostic)] -#[error(code = "E0456")] +#[diag(code = "E0456")] //~^ ERROR diagnostic slug not specified struct SlugNotProvided {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound)] +#[diag(typeck::ambiguous_lifetime_bound)] struct CodeNotProvided {} #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct MessageWrongType { #[primary_span] //~^ ERROR `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -143,7 +136,7 @@ struct MessageWrongType { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct InvalidPathFieldAttr { #[nonsense] //~^ ERROR `#[nonsense]` is not a valid attribute @@ -152,7 +145,7 @@ struct InvalidPathFieldAttr { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithField { name: String, #[label(typeck::label)] @@ -160,7 +153,7 @@ struct ErrorWithField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithMessageAppliedToField { #[label(typeck::label)] //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -168,7 +161,7 @@ struct ErrorWithMessageAppliedToField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNonexistentField { #[suggestion(typeck::suggestion, code = "{name}")] //~^ ERROR `name` doesn't refer to a field on this type @@ -177,7 +170,7 @@ struct ErrorWithNonexistentField { #[derive(SessionDiagnostic)] //~^ ERROR invalid format string: expected `'}'` -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorMissingClosingBrace { #[suggestion(typeck::suggestion, code = "{name")] suggestion: (Span, Applicability), @@ -187,7 +180,7 @@ struct ErrorMissingClosingBrace { #[derive(SessionDiagnostic)] //~^ ERROR invalid format string: unmatched `}` -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorMissingOpeningBrace { #[suggestion(typeck::suggestion, code = "name}")] suggestion: (Span, Applicability), @@ -196,14 +189,14 @@ struct ErrorMissingOpeningBrace { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelOnSpan { #[label(typeck::label)] sp: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelOnNonSpan { #[label(typeck::label)] //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -211,7 +204,7 @@ struct LabelOnNonSpan { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct Suggest { #[suggestion(typeck::suggestion, code = "This is the suggested code")] #[suggestion_short(typeck::suggestion, code = "This is the suggested code")] @@ -221,14 +214,14 @@ struct Suggest { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithoutCode { #[suggestion(typeck::suggestion)] suggestion: (Span, Applicability), } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithBadKey { #[suggestion(nonsense = "bar")] //~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute @@ -236,7 +229,7 @@ struct SuggestWithBadKey { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithShorthandMsg { #[suggestion(msg = "bar")] //~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute @@ -244,21 +237,21 @@ struct SuggestWithShorthandMsg { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithoutMsg { #[suggestion(code = "bar")] suggestion: (Span, Applicability), } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithTypesSwapped { #[suggestion(typeck::suggestion, code = "This is suggested code")] suggestion: (Applicability, Span), } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithWrongTypeApplicabilityOnly { #[suggestion(typeck::suggestion, code = "This is suggested code")] //~^ ERROR wrong field type for suggestion @@ -266,14 +259,14 @@ struct SuggestWithWrongTypeApplicabilityOnly { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithSpanOnly { #[suggestion(typeck::suggestion, code = "This is suggested code")] suggestion: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithDuplicateSpanAndApplicability { #[suggestion(typeck::suggestion, code = "This is suggested code")] //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one `Span` @@ -281,7 +274,7 @@ struct SuggestWithDuplicateSpanAndApplicability { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithDuplicateApplicabilityAndSpan { #[suggestion(typeck::suggestion, code = "This is suggested code")] //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one @@ -289,7 +282,7 @@ struct SuggestWithDuplicateApplicabilityAndSpan { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct WrongKindOfAnnotation { #[label = "bar"] //~^ ERROR `#[label = ...]` is not a valid attribute @@ -297,7 +290,7 @@ struct WrongKindOfAnnotation { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct OptionsInErrors { #[label(typeck::label)] label: Option<Span>, @@ -306,7 +299,7 @@ struct OptionsInErrors { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0456")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] struct MoveOutOfBorrowError<'tcx> { name: Ident, ty: Ty<'tcx>, @@ -320,7 +313,7 @@ struct MoveOutOfBorrowError<'tcx> { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithLifetime<'a> { #[label(typeck::label)] span: Span, @@ -328,7 +321,7 @@ struct ErrorWithLifetime<'a> { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithDefaultLabelAttr<'a> { #[label] span: Span, @@ -337,7 +330,7 @@ struct ErrorWithDefaultLabelAttr<'a> { #[derive(SessionDiagnostic)] //~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ArgFieldWithoutSkip { #[primary_span] span: Span, @@ -345,7 +338,7 @@ struct ArgFieldWithoutSkip { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ArgFieldWithSkip { #[primary_span] span: Span, @@ -356,56 +349,56 @@ struct ArgFieldWithSkip { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedNote { #[note] span: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedNoteCustom { #[note(typeck::note)] span: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[note] struct ErrorWithNote { val: String, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[note(typeck::note)] struct ErrorWithNoteCustom { val: String, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedHelp { #[help] span: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedHelpCustom { #[help(typeck::help)] span: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[help] struct ErrorWithHelp { val: String, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[help(typeck::help)] struct ErrorWithHelpCustom { val: String, @@ -413,34 +406,34 @@ struct ErrorWithHelpCustom { #[derive(SessionDiagnostic)] #[help] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithHelpWrongOrder { val: String, } #[derive(SessionDiagnostic)] #[help(typeck::help)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithHelpCustomWrongOrder { val: String, } #[derive(SessionDiagnostic)] #[note] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNoteWrongOrder { val: String, } #[derive(SessionDiagnostic)] #[note(typeck::note)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNoteCustomWrongOrder { val: String, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ApplicabilityInBoth { #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")] //~^ ERROR applicability cannot be set in both the field and attribute @@ -448,7 +441,7 @@ struct ApplicabilityInBoth { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct InvalidApplicability { #[suggestion(typeck::suggestion, code = "...", applicability = "batman")] //~^ ERROR invalid applicability @@ -456,14 +449,14 @@ struct InvalidApplicability { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ValidApplicability { #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")] suggestion: Span, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct NoApplicability { #[suggestion(typeck::suggestion, code = "...")] suggestion: Span, @@ -474,14 +467,14 @@ struct NoApplicability { struct Note; #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound)] +#[diag(typeck::ambiguous_lifetime_bound)] struct Subdiagnostic { #[subdiagnostic] note: Note, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct VecField { #[primary_span] #[label] @@ -489,7 +482,7 @@ struct VecField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct UnitField { #[primary_span] spans: Span, @@ -500,7 +493,7 @@ struct UnitField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct OptUnitField { #[primary_span] spans: Span, @@ -511,7 +504,7 @@ struct OptUnitField { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingPath { #[label(typeck::label, foo)] //~^ ERROR `#[label(...)]` is not a valid attribute @@ -519,7 +512,7 @@ struct LabelWithTrailingPath { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingNameValue { #[label(typeck::label, foo = "...")] //~^ ERROR `#[label(...)]` is not a valid attribute @@ -527,32 +520,20 @@ struct LabelWithTrailingNameValue { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingList { #[label(typeck::label, foo("..."))] //~^ ERROR `#[label(...)]` is not a valid attribute span: Span, } -#[derive(SessionDiagnostic)] -#[lint(typeck::ambiguous_lifetime_bound)] -//~^ ERROR only `#[error(..)]` and `#[warning(..)]` are supported -struct LintsBad { -} - #[derive(LintDiagnostic)] -#[lint(typeck::ambiguous_lifetime_bound)] +#[diag(typeck::ambiguous_lifetime_bound)] struct LintsGood { } #[derive(LintDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound)] -//~^ ERROR only `#[lint(..)]` is supported -struct ErrorsBad { -} - -#[derive(LintDiagnostic)] -#[lint(typeck::ambiguous_lifetime_bound)] +#[diag(typeck::ambiguous_lifetime_bound)] struct PrimarySpanOnLint { #[primary_span] //~^ ERROR `#[primary_span]` is not a valid attribute @@ -560,15 +541,43 @@ struct PrimarySpanOnLint { } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithMultiSpan { #[primary_span] span: MultiSpan, } #[derive(SessionDiagnostic)] -#[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +#[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[warn_] struct ErrorWithWarn { val: String, } + +#[derive(SessionDiagnostic)] +#[error(typeck::ambiguous_lifetime_bound, 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(SessionDiagnostic)] +#[warning(typeck::ambiguous_lifetime_bound, code = "E0123")] +//~^ ERROR `#[warning(...)]` is not a valid attribute +//~| ERROR diagnostic slug not specified +//~| ERROR cannot find attribute `warning` in this scope +struct WarningAttribute {} + +#[derive(SessionDiagnostic)] +#[lint(typeck::ambiguous_lifetime_bound, 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(typeck::ambiguous_lifetime_bound, code = "E0123")] +//~^ ERROR `#[lint(...)]` is not a valid attribute +//~| ERROR diagnostic slug not specified +//~| ERROR cannot find attribute `lint` in this scope +struct LintAttributeOnLintDiag {} diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 081139c7a70..866b1a1de99 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -1,7 +1,7 @@ error: `#[derive(SessionDiagnostic)]` can only be used on structs --> $DIR/diagnostic-derive.rs:39:1 | -LL | / #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +LL | / #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] LL | | LL | | enum SessionDiagnosticOnEnum { LL | | Foo, @@ -9,11 +9,11 @@ LL | | Bar, LL | | } | |_^ -error: `#[error = ...]` is not a valid attribute +error: `#[diag = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:48:1 | -LL | #[error = "E0123"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[diag = "E0123"] + | ^^^^^^^^^^^^^^^^^ error: `#[nonsense(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:53:1 @@ -35,18 +35,18 @@ LL | | struct InvalidStructAttr {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` -error: `#[error("...")]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:60:9 +error: `#[diag("...")]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:60:8 | -LL | #[error("E0123")] - | ^^^^^^^ +LL | #[diag("E0123")] + | ^^^^^^^ | = help: first argument of the attribute should be the diagnostic slug error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:60:1 | -LL | / #[error("E0123")] +LL | / #[diag("E0123")] LL | | LL | | LL | | struct InvalidLitNestedAttr {} @@ -54,18 +54,18 @@ LL | | struct InvalidLitNestedAttr {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` -error: `#[error(nonsense(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:71:9 +error: `#[diag(nonsense(...))]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:71:8 | -LL | #[error(nonsense("foo"), code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^^^^ +LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")] + | ^^^^^^^^^^^^^^^ | = help: first argument of the attribute should be the diagnostic slug error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:71:1 | -LL | / #[error(nonsense("foo"), code = "E0123", slug = "foo")] +LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")] LL | | LL | | LL | | struct InvalidNestedStructAttr1 {} @@ -73,18 +73,18 @@ LL | | struct InvalidNestedStructAttr1 {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` -error: `#[error(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:77:9 +error: `#[diag(nonsense = ...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:77:8 | -LL | #[error(nonsense = "...", code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^^^^^ +LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] + | ^^^^^^^^^^^^^^^^ | = help: first argument of the attribute should be the diagnostic slug error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:77:1 | -LL | / #[error(nonsense = "...", code = "E0123", slug = "foo")] +LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")] LL | | LL | | LL | | struct InvalidNestedStructAttr2 {} @@ -92,18 +92,18 @@ LL | | struct InvalidNestedStructAttr2 {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` -error: `#[error(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:83:9 +error: `#[diag(nonsense = ...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:83:8 | -LL | #[error(nonsense = 4, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ +LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] + | ^^^^^^^^^^^^ | = help: first argument of the attribute should be the diagnostic slug error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:83:1 | -LL | / #[error(nonsense = 4, code = "E0123", slug = "foo")] +LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")] LL | | LL | | LL | | struct InvalidNestedStructAttr3 {} @@ -111,11 +111,11 @@ LL | | struct InvalidNestedStructAttr3 {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` -error: `#[error(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:89:59 +error: `#[diag(slug = ...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:89:58 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")] + | ^^^^^^^^^^^^ | = help: only `code` is a valid nested attributes following the slug @@ -128,71 +128,47 @@ LL | #[suggestion = "bar"] error: specified multiple times --> $DIR/diagnostic-derive.rs:103:1 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here --> $DIR/diagnostic-derive.rs:102:1 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: specified multiple times - --> $DIR/diagnostic-derive.rs:103:50 - | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456")] - | ^^^^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:102:50 - | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] - | ^^^^^^^ - -error: specified multiple times - --> $DIR/diagnostic-derive.rs:110:1 - | -LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0293")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: previously specified here - --> $DIR/diagnostic-derive.rs:109:1 - | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:110:52 + --> $DIR/diagnostic-derive.rs:103:49 | -LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0293")] - | ^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] + | ^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:109:50 + --> $DIR/diagnostic-derive.rs:102:49 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] - | ^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:116:66 + --> $DIR/diagnostic-derive.rs:109:65 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] - | ^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] + | ^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:116:50 + --> $DIR/diagnostic-derive.rs:109:49 | -LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] - | ^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] + | ^^^^^^^ -error: `#[error(typeck::ambiguous_lifetime_bound)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:121:43 +error: `#[diag(typeck::ambiguous_lifetime_bound)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:114:42 | -LL | #[error(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diag(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:126:1 + --> $DIR/diagnostic-derive.rs:119:1 | LL | struct KindNotProvided {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -200,9 +176,9 @@ LL | struct KindNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:129:1 + --> $DIR/diagnostic-derive.rs:122:1 | -LL | / #[error(code = "E0456")] +LL | / #[diag(code = "E0456")] LL | | LL | | struct SlugNotProvided {} | |_________________________^ @@ -210,13 +186,13 @@ LL | | struct SlugNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:140:5 + --> $DIR/diagnostic-derive.rs:133:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: `#[nonsense]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:148:5 + --> $DIR/diagnostic-derive.rs:141:5 | LL | #[nonsense] | ^^^^^^^^^^^ @@ -224,19 +200,19 @@ LL | #[nonsense] = help: only `skip_arg`, `primary_span`, `label`, `note`, `help` and `subdiagnostic` are valid field attributes error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:165:5 + --> $DIR/diagnostic-derive.rs:158:5 | LL | #[label(typeck::label)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: `name` doesn't refer to a field on this type - --> $DIR/diagnostic-derive.rs:173:45 + --> $DIR/diagnostic-derive.rs:166:45 | LL | #[suggestion(typeck::suggestion, code = "{name}")] | ^^^^^^^^ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/diagnostic-derive.rs:178:16 + --> $DIR/diagnostic-derive.rs:171:16 | LL | #[derive(SessionDiagnostic)] | - ^ expected `'}'` in format string @@ -247,7 +223,7 @@ LL | #[derive(SessionDiagnostic)] = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found - --> $DIR/diagnostic-derive.rs:188:15 + --> $DIR/diagnostic-derive.rs:181:15 | LL | #[derive(SessionDiagnostic)] | ^ unmatched `}` in format string @@ -256,13 +232,13 @@ LL | #[derive(SessionDiagnostic)] = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:208:5 + --> $DIR/diagnostic-derive.rs:201:5 | LL | #[label(typeck::label)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:233:18 + --> $DIR/diagnostic-derive.rs:226:18 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^ @@ -270,7 +246,7 @@ LL | #[suggestion(nonsense = "bar")] = help: only `message`, `code` and `applicability` are valid field attributes error: `#[suggestion(msg = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:241:18 + --> $DIR/diagnostic-derive.rs:234:18 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^ @@ -278,7 +254,7 @@ LL | #[suggestion(msg = "bar")] = help: only `message`, `code` and `applicability` are valid field attributes error: wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:263:5 + --> $DIR/diagnostic-derive.rs:256:5 | LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")] LL | | @@ -288,7 +264,7 @@ LL | | suggestion: Applicability, = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` error: type of field annotated with `#[suggestion(...)]` contains more than one `Span` - --> $DIR/diagnostic-derive.rs:278:5 + --> $DIR/diagnostic-derive.rs:271:5 | LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")] LL | | @@ -296,7 +272,7 @@ LL | | suggestion: (Span, Span, Applicability), | |___________________________________________^ error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability - --> $DIR/diagnostic-derive.rs:286:5 + --> $DIR/diagnostic-derive.rs:279:5 | LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")] LL | | @@ -304,64 +280,128 @@ LL | | suggestion: (Applicability, Applicability, Span), | |____________________________________________________^ error: `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:294:5 + --> $DIR/diagnostic-derive.rs:287:5 | LL | #[label = "bar"] | ^^^^^^^^^^^^^^^^ error: applicability cannot be set in both the field and attribute - --> $DIR/diagnostic-derive.rs:445:52 + --> $DIR/diagnostic-derive.rs:438:52 | LL | #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/diagnostic-derive.rs:453:52 + --> $DIR/diagnostic-derive.rs:446:52 | LL | #[suggestion(typeck::suggestion, code = "...", applicability = "batman")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[label(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:516:5 + --> $DIR/diagnostic-derive.rs:509:5 | LL | #[label(typeck::label, foo)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[label(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:524:5 + --> $DIR/diagnostic-derive.rs:517:5 | LL | #[label(typeck::label, foo = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[label(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:532:5 + --> $DIR/diagnostic-derive.rs:525:5 | LL | #[label(typeck::label, foo("..."))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: only `#[error(..)]` and `#[warning(..)]` are supported - --> $DIR/diagnostic-derive.rs:538:1 +error: `#[primary_span]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:538:5 | -LL | #[lint(typeck::ambiguous_lifetime_bound)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[primary_span] + | ^^^^^^^^^^^^^^^ | - = help: use the `#[error(...)]` attribute to create a error + = help: the `primary_span` field attribute is not valid for lint diagnostics -error: only `#[lint(..)]` is supported - --> $DIR/diagnostic-derive.rs:549:1 +error: `#[error(...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:558:1 | -LL | #[error(typeck::ambiguous_lifetime_bound)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: use the `#[lint(...)]` attribute to create a lint + = help: `error`, `warning` and `lint` have been replaced by `diag` -error: `#[primary_span]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:557:5 +error: diagnostic slug not specified + --> $DIR/diagnostic-derive.rs:558:1 | -LL | #[primary_span] - | ^^^^^^^^^^^^^^^ +LL | / #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] +LL | | +LL | | +LL | | +LL | | struct ErrorAttribute {} + | |________________________^ | - = help: the `primary_span` field attribute is not valid for lint diagnostics + = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` + +error: `#[warning(...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:565:1 + | +LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: `error`, `warning` and `lint` have been replaced by `diag` + +error: diagnostic slug not specified + --> $DIR/diagnostic-derive.rs:565:1 + | +LL | / #[warning(typeck::ambiguous_lifetime_bound, code = "E0123")] +LL | | +LL | | +LL | | +LL | | struct WarningAttribute {} + | |__________________________^ + | + = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` + +error: `#[lint(...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:572:1 + | +LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: `error`, `warning` and `lint` have been replaced by `diag` + +error: diagnostic slug not specified + --> $DIR/diagnostic-derive.rs:572:1 + | +LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] +LL | | +LL | | +LL | | +LL | | struct LintAttributeOnSessionDiag {} + | |____________________________________^ + | + = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]` + +error: `#[lint(...)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:579:1 + | +LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: `error`, `warning` and `lint` have been replaced by `diag` + +error: diagnostic slug not specified + --> $DIR/diagnostic-derive.rs:579:1 + | +LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] +LL | | +LL | | +LL | | +LL | | struct LintAttributeOnLintDiag {} + | |_________________________________^ + | + = help: specify the slug as the first argument to the attribute, such as `#[diag(typeck::example_error)]` error: cannot find attribute `nonsense` in this scope --> $DIR/diagnostic-derive.rs:53:3 @@ -370,19 +410,43 @@ LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")] | ^^^^^^^^ error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:148:7 + --> $DIR/diagnostic-derive.rs:141:7 | LL | #[nonsense] | ^^^^^^^^ +error: cannot find attribute `error` in this scope + --> $DIR/diagnostic-derive.rs:558:3 + | +LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^ + +error: cannot find attribute `warning` in this scope + --> $DIR/diagnostic-derive.rs:565:3 + | +LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^^^^ + +error: cannot find attribute `lint` in this scope + --> $DIR/diagnostic-derive.rs:572:3 + | +LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^ help: a built-in attribute with a similar name exists: `link` + +error: cannot find attribute `lint` in this scope + --> $DIR/diagnostic-derive.rs:579:3 + | +LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] + | ^^^^ help: a built-in attribute with a similar name exists: `link` + error[E0425]: cannot find value `nonsense` in module `rustc_errors::fluent` - --> $DIR/diagnostic-derive.rs:66:9 + --> $DIR/diagnostic-derive.rs:66:8 | -LL | #[error(nonsense, code = "E0123")] - | ^^^^^^^^ not found in `rustc_errors::fluent` +LL | #[diag(nonsense, code = "E0123")] + | ^^^^^^^^ not found in `rustc_errors::fluent` error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:338:10 + --> $DIR/diagnostic-derive.rs:331:10 | LL | #[derive(SessionDiagnostic)] | ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` @@ -395,7 +459,7 @@ LL | arg: impl IntoDiagnosticArg, | ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg` = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 47 previous errors +error: aborting due to 55 previous errors Some errors have detailed explanations: E0277, E0425. For more information about an error, try `rustc --explain E0277`. |
