diff options
| author | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-18 11:45:41 -0400 |
|---|---|---|
| committer | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-21 11:39:52 -0400 |
| commit | 19b348fed44342d8addbbb5e8f67cda5dc8d9b95 (patch) | |
| tree | 08bc0d9e7f50ba3a3eb8f227ce9f1e82904a6cb5 /src | |
| parent | 5b8152807cae152d5c7cfb40615e5a817a6cf750 (diff) | |
| download | rust-19b348fed44342d8addbbb5e8f67cda5dc8d9b95.tar.gz rust-19b348fed44342d8addbbb5e8f67cda5dc8d9b95.zip | |
UPDATE - rename DiagnosticHandler trait to IntoDiagnostic
Diffstat (limited to 'src')
4 files changed, 95 insertions, 94 deletions
diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.rs b/src/test/ui-fulldeps/internal-lints/diagnostics.rs index 3b31a290449..1ead987ec41 100644 --- a/src/test/ui-fulldeps/internal-lints/diagnostics.rs +++ b/src/test/ui-fulldeps/internal-lints/diagnostics.rs @@ -12,12 +12,13 @@ extern crate rustc_session; extern crate rustc_span; use rustc_errors::{ - AddSubdiagnostic, SessionDiagnostic, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, Handler, fluent + AddSubdiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder, + ErrorGuaranteed, Handler, fluent }; -use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic}; +use rustc_macros::{DiagnosticHandler, SessionSubdiagnostic}; use rustc_span::Span; -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(parser::expect_path)] struct DeriveSessionDiagnostic { #[primary_span] @@ -33,7 +34,7 @@ struct Note { pub struct UntranslatableInSessionDiagnostic; -impl<'a> SessionDiagnostic<'a, ErrorGuaranteed> for UntranslatableInSessionDiagnostic { +impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for UntranslatableInSessionDiagnostic { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { handler.struct_err("untranslatable diagnostic") //~^ ERROR diagnostics should be created using translatable messages @@ -42,7 +43,7 @@ impl<'a> SessionDiagnostic<'a, ErrorGuaranteed> for UntranslatableInSessionDiagn pub struct TranslatableInSessionDiagnostic; -impl<'a> SessionDiagnostic<'a, ErrorGuaranteed> for TranslatableInSessionDiagnostic { +impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInSessionDiagnostic { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { handler.struct_err(fluent::parser::expect_path) } @@ -67,10 +68,10 @@ impl AddSubdiagnostic for TranslatableInAddSubdiagnostic { pub fn make_diagnostics<'a>(handler: &'a Handler) { let _diag = handler.struct_err(fluent::parser::expect_path); - //~^ ERROR diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls let _diag = handler.struct_err("untranslatable diagnostic"); - //~^ ERROR diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls //~^^ ERROR diagnostics should be created using translatable messages } diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.stderr b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr index e5c5bc2e998..d5833cf3970 100644 --- a/src/test/ui-fulldeps/internal-lints/diagnostics.stderr +++ b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr @@ -16,7 +16,7 @@ error: diagnostics should be created using translatable messages LL | diag.note("untranslatable diagnostic"); | ^^^^ -error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls +error: diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls --> $DIR/diagnostics.rs:70:25 | LL | let _diag = handler.struct_err(fluent::parser::expect_path); @@ -28,7 +28,7 @@ note: the lint level is defined here LL | #![deny(rustc::diagnostic_outside_of_impl)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls +error: diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls --> $DIR/diagnostics.rs:73:25 | LL | let _diag = handler.struct_err("untranslatable diagnostic"); diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index c1c109ac1ea..32ba5be8963 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -1,10 +1,10 @@ // check-fail -// Tests error conditions for specifying diagnostics using #[derive(SessionDiagnostic)] +// Tests error conditions for specifying diagnostics using #[derive(DiagnosticHandler)] // normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" // normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC" // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, -// changing the output of this test. Since SessionDiagnostic is strictly internal to the compiler +// changing the output of this test. Since DiagnosticHandler is strictly internal to the compiler // the test is just ignored on stable and beta: // ignore-beta // ignore-stable @@ -17,7 +17,7 @@ use rustc_span::symbol::Ident; use rustc_span::Span; extern crate rustc_macros; -use rustc_macros::{SessionDiagnostic, LintDiagnostic, SessionSubdiagnostic}; +use rustc_macros::{DiagnosticHandler, LintDiagnostic, SessionSubdiagnostic}; extern crate rustc_middle; use rustc_middle::ty::Ty; @@ -27,70 +27,70 @@ use rustc_errors::{Applicability, MultiSpan}; extern crate rustc_session; -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct Hello {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct HelloWarn {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] -//~^ ERROR `#[derive(SessionDiagnostic)]` can only be used on structs -enum SessionDiagnosticOnEnum { +//~^ ERROR `#[derive(DiagnosticHandler)]` can only be used on structs +enum DiagnosticHandlerOnEnum { Foo, Bar, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[diag = "E0123"] //~^ ERROR `#[diag = ...]` is not a valid attribute struct WrongStructAttrStyle {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[nonsense(typeck::ambiguous_lifetime_bound, 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(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag("E0123")] //~^ ERROR `#[diag("...")]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidLitNestedAttr {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(nonsense, code = "E0123")] //~^ ERROR cannot find value `nonsense` in module `rustc_errors::fluent` struct InvalidNestedStructAttr {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(nonsense("foo"), code = "E0123", slug = "foo")] //~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr1 {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(nonsense = "...", code = "E0123", slug = "foo")] //~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr2 {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(nonsense = 4, code = "E0123", slug = "foo")] //~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute //~^^ ERROR diagnostic slug not specified struct InvalidNestedStructAttr3 {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")] //~^ ERROR `#[diag(slug = ...)]` is not a valid attribute struct InvalidNestedStructAttr4 {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct WrongPlaceField { #[suggestion = "bar"] @@ -98,36 +98,36 @@ struct WrongPlaceField { sp: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] //~^ ERROR specified multiple times //~^^ ERROR specified multiple times struct DiagSpecifiedTwice {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")] //~^ ERROR specified multiple times struct CodeSpecifiedTwice {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[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)] +#[derive(DiagnosticHandler)] struct KindNotProvided {} //~ ERROR diagnostic slug not specified -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(code = "E0456")] //~^ ERROR diagnostic slug not specified struct SlugNotProvided {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound)] struct CodeNotProvided {} -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct MessageWrongType { #[primary_span] @@ -135,7 +135,7 @@ struct MessageWrongType { foo: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct InvalidPathFieldAttr { #[nonsense] @@ -144,7 +144,7 @@ struct InvalidPathFieldAttr { foo: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithField { name: String, @@ -152,7 +152,7 @@ struct ErrorWithField { span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithMessageAppliedToField { #[label(typeck::label)] @@ -160,7 +160,7 @@ struct ErrorWithMessageAppliedToField { name: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNonexistentField { #[suggestion(typeck::suggestion, code = "{name}")] @@ -168,7 +168,7 @@ struct ErrorWithNonexistentField { suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] //~^ ERROR invalid format string: expected `'}'` #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorMissingClosingBrace { @@ -178,7 +178,7 @@ struct ErrorMissingClosingBrace { val: usize, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] //~^ ERROR invalid format string: unmatched `}` #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorMissingOpeningBrace { @@ -188,14 +188,14 @@ struct ErrorMissingOpeningBrace { val: usize, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelOnSpan { #[label(typeck::label)] sp: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelOnNonSpan { #[label(typeck::label)] @@ -203,7 +203,7 @@ struct LabelOnNonSpan { id: u32, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct Suggest { #[suggestion(typeck::suggestion, code = "This is the suggested code")] @@ -213,14 +213,14 @@ struct Suggest { suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithoutCode { #[suggestion(typeck::suggestion)] suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithBadKey { #[suggestion(nonsense = "bar")] @@ -228,7 +228,7 @@ struct SuggestWithBadKey { suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithShorthandMsg { #[suggestion(msg = "bar")] @@ -236,21 +236,21 @@ struct SuggestWithShorthandMsg { suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithoutMsg { #[suggestion(code = "bar")] suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithTypesSwapped { #[suggestion(typeck::suggestion, code = "This is suggested code")] suggestion: (Applicability, Span), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithWrongTypeApplicabilityOnly { #[suggestion(typeck::suggestion, code = "This is suggested code")] @@ -258,14 +258,14 @@ struct SuggestWithWrongTypeApplicabilityOnly { suggestion: Applicability, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithSpanOnly { #[suggestion(typeck::suggestion, code = "This is suggested code")] suggestion: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithDuplicateSpanAndApplicability { #[suggestion(typeck::suggestion, code = "This is suggested code")] @@ -273,7 +273,7 @@ struct SuggestWithDuplicateSpanAndApplicability { suggestion: (Span, Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct SuggestWithDuplicateApplicabilityAndSpan { #[suggestion(typeck::suggestion, code = "This is suggested code")] @@ -281,7 +281,7 @@ struct SuggestWithDuplicateApplicabilityAndSpan { suggestion: (Applicability, Applicability, Span), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct WrongKindOfAnnotation { #[label = "bar"] @@ -289,7 +289,7 @@ struct WrongKindOfAnnotation { z: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct OptionsInErrors { #[label(typeck::label)] @@ -298,7 +298,7 @@ struct OptionsInErrors { opt_sugg: Option<(Span, Applicability)>, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")] struct MoveOutOfBorrowError<'tcx> { name: Ident, @@ -312,7 +312,7 @@ struct MoveOutOfBorrowError<'tcx> { opt_sugg: Option<(Span, Applicability)>, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithLifetime<'a> { #[label(typeck::label)] @@ -320,7 +320,7 @@ struct ErrorWithLifetime<'a> { name: &'a str, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithDefaultLabelAttr<'a> { #[label] @@ -328,7 +328,7 @@ struct ErrorWithDefaultLabelAttr<'a> { name: &'a str, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] //~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ArgFieldWithoutSkip { @@ -337,7 +337,7 @@ struct ArgFieldWithoutSkip { other: Hello, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ArgFieldWithSkip { #[primary_span] @@ -348,91 +348,91 @@ struct ArgFieldWithSkip { other: Hello, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedNote { #[note] span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedNoteCustom { #[note(typeck::note)] span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[note] struct ErrorWithNote { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[note(typeck::note)] struct ErrorWithNoteCustom { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedHelp { #[help] span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithSpannedHelpCustom { #[help(typeck::help)] span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[help] struct ErrorWithHelp { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[help(typeck::help)] struct ErrorWithHelpCustom { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[help] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithHelpWrongOrder { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[help(typeck::help)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithHelpCustomWrongOrder { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[note] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNoteWrongOrder { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[note(typeck::note)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithNoteCustomWrongOrder { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ApplicabilityInBoth { #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")] @@ -440,7 +440,7 @@ struct ApplicabilityInBoth { suggestion: (Span, Applicability), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct InvalidApplicability { #[suggestion(typeck::suggestion, code = "...", applicability = "batman")] @@ -448,14 +448,14 @@ struct InvalidApplicability { suggestion: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ValidApplicability { #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")] suggestion: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct NoApplicability { #[suggestion(typeck::suggestion, code = "...")] @@ -466,14 +466,14 @@ struct NoApplicability { #[note(parser::add_paren)] struct Note; -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound)] struct Subdiagnostic { #[subdiagnostic] note: Note, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct VecField { #[primary_span] @@ -481,7 +481,7 @@ struct VecField { spans: Vec<Span>, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct UnitField { #[primary_span] @@ -492,7 +492,7 @@ struct UnitField { bar: (), } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct OptUnitField { #[primary_span] @@ -503,7 +503,7 @@ struct OptUnitField { bar: Option<()>, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingPath { #[label(typeck::label, foo)] @@ -511,7 +511,7 @@ struct LabelWithTrailingPath { span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingNameValue { #[label(typeck::label, foo = "...")] @@ -519,7 +519,7 @@ struct LabelWithTrailingNameValue { span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct LabelWithTrailingList { #[label(typeck::label, foo("..."))] @@ -540,35 +540,35 @@ struct PrimarySpanOnLint { span: Span, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] struct ErrorWithMultiSpan { #[primary_span] span: MultiSpan, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] #[warning] struct ErrorWithWarn { val: String, } -#[derive(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[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)] +#[derive(DiagnosticHandler)] #[warn_(typeck::ambiguous_lifetime_bound, 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(SessionDiagnostic)] +#[derive(DiagnosticHandler)] #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")] //~^ ERROR `#[lint(...)]` is not a valid attribute //~| ERROR diagnostic slug not specified diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index ab5c28fe473..d9198d4ef80 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -1,9 +1,9 @@ -error: `#[derive(SessionDiagnostic)]` can only be used on structs +error: `#[derive(DiagnosticHandler)]` can only be used on structs --> $DIR/diagnostic-derive.rs:39:1 | LL | / #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")] LL | | -LL | | enum SessionDiagnosticOnEnum { +LL | | enum DiagnosticHandlerOnEnum { LL | | Foo, LL | | Bar, LL | | } @@ -214,22 +214,22 @@ LL | #[suggestion(typeck::suggestion, code = "{name}")] error: invalid format string: expected `'}'` but string was terminated --> $DIR/diagnostic-derive.rs:171:16 | -LL | #[derive(SessionDiagnostic)] +LL | #[derive(DiagnosticHandler)] | - ^ expected `'}'` in format string | | | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` - = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `DiagnosticHandler` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found --> $DIR/diagnostic-derive.rs:181:15 | -LL | #[derive(SessionDiagnostic)] +LL | #[derive(DiagnosticHandler)] | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` - = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `DiagnosticHandler` (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:201:5 @@ -448,7 +448,7 @@ LL | #[diag(nonsense, code = "E0123")] error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied --> $DIR/diagnostic-derive.rs:331:10 | -LL | #[derive(SessionDiagnostic)] +LL | #[derive(DiagnosticHandler)] | ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` | = help: normalized in stderr @@ -457,7 +457,7 @@ note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` | 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) + = note: this error originates in the derive macro `DiagnosticHandler` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 55 previous errors |
