summaryrefslogtreecommitdiffstats
path: root/src/test/ui-fulldeps/session-diagnostic
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs676
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr686
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs430
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr376
4 files changed, 1471 insertions, 697 deletions
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index 0a210cbdc..ca77e483d 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(Diagnostic)]
// 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 Diagnostic 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::{Diagnostic, LintDiagnostic, Subdiagnostic};
extern crate rustc_middle;
use rustc_middle::ty::Ty;
@@ -27,125 +27,120 @@ use rustc_errors::{Applicability, MultiSpan};
extern crate rustc_session;
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct Hello {}
-#[derive(SessionDiagnostic)]
-#[warning(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct HelloWarn {}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-//~^ ERROR `#[derive(SessionDiagnostic)]` can only be used on structs
-enum SessionDiagnosticOnEnum {
+#[derive(Diagnostic)]
+#[diag(compiletest_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(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-#[error = "E0123"]
-//~^ ERROR `#[error = ...]` is not a valid attribute
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[diag = "E0123"]
+//~^ ERROR `#[diag = ...]` is not a valid attribute
struct WrongStructAttrStyle {}
-#[derive(SessionDiagnostic)]
-#[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[nonsense(compiletest_example, code = "E0123")]
//~^ ERROR `#[nonsense(...)]` is not a valid attribute
-//~^^ ERROR diagnostic kind not specified
+//~^^ ERROR diagnostic slug not specified
//~^^^ ERROR cannot find attribute `nonsense` in this scope
struct InvalidStructAttr {}
-#[derive(SessionDiagnostic)]
-#[error("E0123")]
-//~^ ERROR `#[error("...")]` is not a valid attribute
+#[derive(Diagnostic)]
+#[diag("E0123")]
+//~^ ERROR `#[diag("...")]` is not a valid attribute
//~^^ ERROR diagnostic slug not specified
struct InvalidLitNestedAttr {}
-#[derive(SessionDiagnostic)]
-#[error(nonsense, code = "E0123")]
+#[derive(Diagnostic)]
+#[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
+#[derive(Diagnostic)]
+#[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
-//~^^ ERROR diagnostic slug not specified
+#[derive(Diagnostic)]
+#[diag(nonsense = "...", code = "E0123", slug = "foo")]
+//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
+//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
+//~| ERROR diagnostic slug not specified
struct InvalidNestedStructAttr2 {}
-#[derive(SessionDiagnostic)]
-#[error(nonsense = 4, code = "E0123", slug = "foo")]
-//~^ ERROR `#[error(nonsense = ...)]` is not a valid attribute
-//~^^ ERROR diagnostic slug not specified
+#[derive(Diagnostic)]
+#[diag(nonsense = 4, code = "E0123", slug = "foo")]
+//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
+//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
+//~| ERROR 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
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123", slug = "foo")]
+//~^ ERROR `#[diag(slug = ...)]` is not a valid attribute
struct InvalidNestedStructAttr4 {}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct WrongPlaceField {
#[suggestion = "bar"]
//~^ ERROR `#[suggestion = ...]` is not a valid attribute
sp: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0456")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[diag(compiletest_example, code = "E0456")]
//~^ ERROR specified multiple times
//~^^ 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
-//~^^^ ERROR specified multiple times
-struct WarnSpecifiedAfterError {}
-
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, 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
+#[derive(Diagnostic)]
+#[diag(compiletest_example, compiletest_example, code = "E0456")]
+//~^ ERROR `#[diag(compiletest_example)]` is not a valid attribute
struct SlugSpecifiedTwice {}
-#[derive(SessionDiagnostic)]
-struct KindNotProvided {} //~ ERROR diagnostic kind not specified
+#[derive(Diagnostic)]
+struct KindNotProvided {} //~ ERROR diagnostic slug not specified
-#[derive(SessionDiagnostic)]
-#[error(code = "E0456")]
+#[derive(Diagnostic)]
+#[diag(code = "E0456")]
//~^ ERROR diagnostic slug not specified
struct SlugNotProvided {}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound)]
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
struct CodeNotProvided {}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_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(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct InvalidPathFieldAttr {
#[nonsense]
//~^ ERROR `#[nonsense]` is not a valid attribute
@@ -153,201 +148,204 @@ struct InvalidPathFieldAttr {
foo: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithField {
name: String,
- #[label(typeck::label)]
+ #[label(label)]
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithMessageAppliedToField {
- #[label(typeck::label)]
+ #[label(label)]
//~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
name: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithNonexistentField {
- #[suggestion(typeck::suggestion, code = "{name}")]
+ #[suggestion(suggestion, code = "{name}")]
//~^ ERROR `name` doesn't refer to a field on this type
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
+#[derive(Diagnostic)]
//~^ ERROR invalid format string: expected `'}'`
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorMissingClosingBrace {
- #[suggestion(typeck::suggestion, code = "{name")]
+ #[suggestion(suggestion, code = "{name")]
suggestion: (Span, Applicability),
name: String,
val: usize,
}
-#[derive(SessionDiagnostic)]
+#[derive(Diagnostic)]
//~^ ERROR invalid format string: unmatched `}`
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorMissingOpeningBrace {
- #[suggestion(typeck::suggestion, code = "name}")]
+ #[suggestion(suggestion, code = "name}")]
suggestion: (Span, Applicability),
name: String,
val: usize,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct LabelOnSpan {
- #[label(typeck::label)]
+ #[label(label)]
sp: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct LabelOnNonSpan {
- #[label(typeck::label)]
+ #[label(label)]
//~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
id: u32,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct Suggest {
- #[suggestion(typeck::suggestion, code = "This is the suggested code")]
- #[suggestion_short(typeck::suggestion, code = "This is the suggested code")]
- #[suggestion_hidden(typeck::suggestion, code = "This is the suggested code")]
- #[suggestion_verbose(typeck::suggestion, code = "This is the suggested code")]
+ #[suggestion(suggestion, code = "This is the suggested code")]
+ #[suggestion_short(suggestion, code = "This is the suggested code")]
+ #[suggestion_hidden(suggestion, code = "This is the suggested code")]
+ #[suggestion_verbose(suggestion, code = "This is the suggested code")]
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithoutCode {
- #[suggestion(typeck::suggestion)]
+ #[suggestion(suggestion)]
+ //~^ ERROR suggestion without `code = "..."`
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithBadKey {
#[suggestion(nonsense = "bar")]
//~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute
+ //~| ERROR suggestion without `code = "..."`
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithShorthandMsg {
#[suggestion(msg = "bar")]
//~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute
+ //~| ERROR suggestion without `code = "..."`
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithoutMsg {
#[suggestion(code = "bar")]
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithTypesSwapped {
- #[suggestion(typeck::suggestion, code = "This is suggested code")]
+ #[suggestion(suggestion, code = "This is suggested code")]
suggestion: (Applicability, Span),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithWrongTypeApplicabilityOnly {
- #[suggestion(typeck::suggestion, code = "This is suggested code")]
+ #[suggestion(suggestion, code = "This is suggested code")]
//~^ ERROR wrong field type for suggestion
suggestion: Applicability,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithSpanOnly {
- #[suggestion(typeck::suggestion, code = "This is suggested code")]
+ #[suggestion(suggestion, code = "This is suggested code")]
suggestion: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithDuplicateSpanAndApplicability {
- #[suggestion(typeck::suggestion, code = "This is suggested code")]
- //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one `Span`
+ #[suggestion(suggestion, code = "This is suggested code")]
suggestion: (Span, Span, Applicability),
+ //~^ ERROR specified multiple times
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct SuggestWithDuplicateApplicabilityAndSpan {
- #[suggestion(typeck::suggestion, code = "This is suggested code")]
- //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one
+ #[suggestion(suggestion, code = "This is suggested code")]
suggestion: (Applicability, Applicability, Span),
+ //~^ ERROR specified multiple times
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct WrongKindOfAnnotation {
#[label = "bar"]
//~^ ERROR `#[label = ...]` is not a valid attribute
z: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct OptionsInErrors {
- #[label(typeck::label)]
+ #[label(label)]
label: Option<Span>,
- #[suggestion(typeck::suggestion)]
+ #[suggestion(suggestion, code = "...")]
opt_sugg: Option<(Span, Applicability)>,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0456")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0456")]
struct MoveOutOfBorrowError<'tcx> {
name: Ident,
ty: Ty<'tcx>,
#[primary_span]
- #[label(typeck::label)]
+ #[label(label)]
span: Span,
- #[label(typeck::label)]
+ #[label(label)]
other_span: Span,
- #[suggestion(typeck::suggestion, code = "{name}.clone()")]
+ #[suggestion(suggestion, code = "{name}.clone()")]
opt_sugg: Option<(Span, Applicability)>,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithLifetime<'a> {
- #[label(typeck::label)]
+ #[label(label)]
span: Span,
name: &'a str,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithDefaultLabelAttr<'a> {
#[label]
span: Span,
name: &'a str,
}
-#[derive(SessionDiagnostic)]
+#[derive(Diagnostic)]
//~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[diag(compiletest_example, code = "E0123")]
struct ArgFieldWithoutSkip {
#[primary_span]
span: Span,
other: Hello,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ArgFieldWithSkip {
#[primary_span]
span: Span,
@@ -357,212 +355,444 @@ struct ArgFieldWithSkip {
other: Hello,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithSpannedNote {
#[note]
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithSpannedNoteCustom {
- #[note(typeck::note)]
+ #[note(note)]
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
#[note]
struct ErrorWithNote {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-#[note(typeck::note)]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[note(note)]
struct ErrorWithNoteCustom {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithSpannedHelp {
#[help]
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithSpannedHelpCustom {
- #[help(typeck::help)]
+ #[help(help)]
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
#[help]
struct ErrorWithHelp {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-#[help(typeck::help)]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[help(help)]
struct ErrorWithHelpCustom {
val: String,
}
-#[derive(SessionDiagnostic)]
+#[derive(Diagnostic)]
#[help]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithHelpWrongOrder {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[help(typeck::help)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[help(help)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithHelpCustomWrongOrder {
val: String,
}
-#[derive(SessionDiagnostic)]
+#[derive(Diagnostic)]
#[note]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithNoteWrongOrder {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[note(typeck::note)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[note(note)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithNoteCustomWrongOrder {
val: String,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ApplicabilityInBoth {
- #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")]
- //~^ ERROR applicability cannot be set in both the field and attribute
+ #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")]
+ //~^ ERROR specified multiple times
suggestion: (Span, Applicability),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct InvalidApplicability {
- #[suggestion(typeck::suggestion, code = "...", applicability = "batman")]
+ #[suggestion(suggestion, code = "...", applicability = "batman")]
//~^ ERROR invalid applicability
suggestion: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ValidApplicability {
- #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")]
+ #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")]
suggestion: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct NoApplicability {
- #[suggestion(typeck::suggestion, code = "...")]
+ #[suggestion(suggestion, code = "...")]
suggestion: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[note(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[note(parser_add_paren)]
struct Note;
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound)]
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
struct Subdiagnostic {
#[subdiagnostic]
note: Note,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct VecField {
#[primary_span]
#[label]
spans: Vec<Span>,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct UnitField {
#[primary_span]
spans: Span,
#[help]
foo: (),
- #[help(typeck::help)]
+ #[help(help)]
bar: (),
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct OptUnitField {
#[primary_span]
spans: Span,
#[help]
foo: Option<()>,
- #[help(typeck::help)]
+ #[help(help)]
bar: Option<()>,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct LabelWithTrailingPath {
- #[label(typeck::label, foo)]
- //~^ ERROR `#[label(...)]` is not a valid attribute
+ #[label(label, foo)]
+ //~^ ERROR `#[label(foo)]` is not a valid attribute
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct LabelWithTrailingNameValue {
- #[label(typeck::label, foo = "...")]
- //~^ ERROR `#[label(...)]` is not a valid attribute
+ #[label(label, foo = "...")]
+ //~^ ERROR `#[label(foo = ...)]` is not a valid attribute
span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct LabelWithTrailingList {
- #[label(typeck::label, foo("..."))]
- //~^ ERROR `#[label(...)]` is not a valid attribute
+ #[label(label, foo("..."))]
+ //~^ ERROR `#[label(foo(...))]` 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(compiletest_example)]
struct LintsGood {
}
#[derive(LintDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound)]
-//~^ ERROR only `#[lint(..)]` is supported
-struct ErrorsBad {
+#[diag(compiletest_example)]
+struct PrimarySpanOnLint {
+ #[primary_span]
+ //~^ ERROR `#[primary_span]` is not a valid attribute
+ span: Span,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
struct ErrorWithMultiSpan {
#[primary_span]
span: MultiSpan,
}
-#[derive(SessionDiagnostic)]
-#[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-#[warn_]
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[warning]
struct ErrorWithWarn {
val: String,
}
+
+#[derive(Diagnostic)]
+#[error(compiletest_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_(compiletest_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(compiletest_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(compiletest_example, code = "E0123")]
+//~^ ERROR `#[lint(...)]` is not a valid attribute
+//~| 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(compiletest_example, code = "E0123")]
+struct DuplicatedSuggestionCode {
+ #[suggestion(suggestion, code = "...", code = ",,,")]
+ //~^ ERROR specified multiple times
+ suggestion: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+struct InvalidTypeInSuggestionTuple {
+ #[suggestion(suggestion, code = "...")]
+ suggestion: (Span, usize),
+ //~^ ERROR wrong types for suggestion
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+struct MissingApplicabilityInSuggestionTuple {
+ #[suggestion(suggestion, code = "...")]
+ suggestion: (Span,),
+ //~^ ERROR wrong types for suggestion
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+struct MissingCodeInSuggestion {
+ #[suggestion(suggestion)]
+ //~^ ERROR suggestion without `code = "..."`
+ suggestion: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[multipart_suggestion(suggestion)]
+//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
+//~| ERROR cannot find attribute `multipart_suggestion` in this scope
+#[multipart_suggestion()]
+//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
+//~| ERROR cannot find attribute `multipart_suggestion` in this scope
+struct MultipartSuggestion {
+ #[multipart_suggestion(suggestion)]
+ //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
+ //~| ERROR cannot find attribute `multipart_suggestion` in this scope
+ suggestion: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[suggestion(suggestion, code = "...")]
+//~^ ERROR `#[suggestion(...)]` is not a valid attribute
+struct SuggestionOnStruct {
+ #[primary_span]
+ suggestion: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+#[label]
+//~^ ERROR `#[label]` is not a valid attribute
+struct LabelOnStruct {
+ #[primary_span]
+ suggestion: Span,
+}
+
+#[derive(Diagnostic)]
+enum ExampleEnum {
+ #[diag(compiletest_example)]
+ Foo {
+ #[primary_span]
+ sp: Span,
+ #[note]
+ note_sp: Span,
+ },
+ #[diag(compiletest_example)]
+ Bar {
+ #[primary_span]
+ sp: Span,
+ },
+ #[diag(compiletest_example)]
+ Baz,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+struct RawIdentDiagnosticArg {
+ pub r#type: String,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticBad {
+ #[subdiagnostic(bad)]
+//~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute
+ note: Note,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticBadStr {
+ #[subdiagnostic = "bad"]
+//~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute
+ note: Note,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticBadTwice {
+ #[subdiagnostic(bad, bad)]
+//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ note: Note,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticBadLitStr {
+ #[subdiagnostic("bad")]
+//~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute
+ note: Note,
+}
+
+#[derive(LintDiagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticEagerLint {
+ #[subdiagnostic(eager)]
+//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ note: Note,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticEagerCorrect {
+ #[subdiagnostic(eager)]
+ note: Note,
+}
+
+// Check that formatting of `correct` in suggestion doesn't move the binding for that field, making
+// the `set_arg` call a compile error; and that isn't worked around by moving the `set_arg` call
+// after the `span_suggestion` call - which breaks eager translation.
+
+#[derive(Subdiagnostic)]
+#[suggestion_short(
+ use_instead,
+ applicability = "machine-applicable",
+ code = "{correct}"
+)]
+pub(crate) struct SubdiagnosticWithSuggestion {
+ #[primary_span]
+ span: Span,
+ invalid: String,
+ correct: String,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SubdiagnosticEagerSuggestion {
+ #[subdiagnostic(eager)]
+ sub: SubdiagnosticWithSuggestion,
+}
+
+/// with a doc comment on the type..
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+struct WithDocComment {
+ /// ..and the field
+ #[primary_span]
+ span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionsGood {
+ #[suggestion(code("foo", "bar"))]
+ sub: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionsSingleItem {
+ #[suggestion(code("foo"))]
+ sub: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionsNoItem {
+ #[suggestion(code())]
+ //~^ ERROR expected at least one string literal for `code(...)`
+ sub: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionsInvalidItem {
+ #[suggestion(code(foo))]
+ //~^ ERROR `code(...)` must contain only string literals
+ sub: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionsInvalidLiteral {
+ #[suggestion(code = 3)]
+ //~^ ERROR `code = "..."`/`code(...)` must contain only string literals
+ sub: Span,
+}
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index c1080aa24..859c272b6 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -1,423 +1,671 @@
-error: `#[derive(SessionDiagnostic)]` can only be used on structs
+error: unsupported type attribute for diagnostic derive enum
--> $DIR/diagnostic-derive.rs:39:1
|
-LL | / #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
-LL | |
-LL | | enum SessionDiagnosticOnEnum {
-LL | | Foo,
-LL | | Bar,
-LL | | }
- | |_^
+LL | #[diag(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[error = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:48:1
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:42:5
+ |
+LL | Foo,
+ | ^^^
|
-LL | #[error = "E0123"]
- | ^^^^^^^^^^^^^^^^^^
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[nonsense(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:53:1
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:44:5
+ |
+LL | Bar,
+ | ^^^
|
-LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
+
+error: `#[diag = ...]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:50:1
+ |
+LL | #[diag = "E0123"]
+ | ^^^^^^^^^^^^^^^^^
+
+error: `#[nonsense(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:55:1
|
- = help: only `error`, `warning`, `help`, `note` and `warn_` are valid attributes
+LL | #[nonsense(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: diagnostic kind not specified
- --> $DIR/diagnostic-derive.rs:53:1
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:55:1
|
-LL | / #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
+LL | / #[nonsense(compiletest_example, code = "E0123")]
LL | |
LL | |
LL | |
LL | | struct InvalidStructAttr {}
| |___________________________^
|
- = help: use the `#[error(...)]` attribute to create an error
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_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:62:8
|
-LL | #[error("E0123")]
- | ^^^^^^^
+LL | #[diag("E0123")]
+ | ^^^^^^^
|
- = help: first argument of the attribute should be the diagnostic slug
+ = help: a diagnostic slug is required as the first argument
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:60:1
+ --> $DIR/diagnostic-derive.rs:62:1
|
-LL | / #[error("E0123")]
+LL | / #[diag("E0123")]
LL | |
LL | |
LL | | struct InvalidLitNestedAttr {}
| |______________________________^
|
- = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_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:73: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
+ = help: a diagnostic slug is required as the first argument
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:71:1
+ --> $DIR/diagnostic-derive.rs:73:1
|
-LL | / #[error(nonsense("foo"), code = "E0123", slug = "foo")]
+LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
LL | |
LL | |
LL | | struct InvalidNestedStructAttr1 {}
| |__________________________________^
|
- = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_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:79: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
+ = help: only `code` is a valid nested attributes following the slug
+
+error: `#[diag(slug = ...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:79:42
+ |
+LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
+ | ^^^^^^^^^^^^
+ |
+ = help: only `code` is a valid nested attributes following the slug
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:77:1
+ --> $DIR/diagnostic-derive.rs:79:1
|
-LL | / #[error(nonsense = "...", code = "E0123", slug = "foo")]
+LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")]
+LL | |
LL | |
LL | |
LL | | struct InvalidNestedStructAttr2 {}
| |__________________________________^
|
- = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_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:86:8
|
-LL | #[error(nonsense = 4, code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
+LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
+ | ^^^^^^^^^^^^
+
+error: `#[diag(slug = ...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:86:38
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
+ | ^^^^^^^^^^^^
+ |
+ = help: only `code` is a valid nested attributes following the slug
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:83:1
+ --> $DIR/diagnostic-derive.rs:86:1
|
-LL | / #[error(nonsense = 4, code = "E0123", slug = "foo")]
+LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")]
+LL | |
LL | |
LL | |
LL | | struct InvalidNestedStructAttr3 {}
| |__________________________________^
|
- = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_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:93:45
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
+LL | #[diag(compiletest_example, code = "E0123", slug = "foo")]
+ | ^^^^^^^^^^^^
|
= help: only `code` is a valid nested attributes following the slug
error: `#[suggestion = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:96:5
+ --> $DIR/diagnostic-derive.rs:100:5
|
LL | #[suggestion = "bar"]
| ^^^^^^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:103:1
+ --> $DIR/diagnostic-derive.rs:107:8
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[diag(compiletest_example, code = "E0456")]
+ | ^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:102:1
+ --> $DIR/diagnostic-derive.rs:106:8
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[diag(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:103:1
+ --> $DIR/diagnostic-derive.rs:107:36
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[diag(compiletest_example, code = "E0456")]
+ | ^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:102:1
+ --> $DIR/diagnostic-derive.rs:106:36
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[diag(compiletest_example, code = "E0123")]
+ | ^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:103:50
+ --> $DIR/diagnostic-derive.rs:113:52
|
-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:111:1
- |
-LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0293")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: previously specified here
- --> $DIR/diagnostic-derive.rs:110:1
- |
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: specified multiple times
- --> $DIR/diagnostic-derive.rs:111:1
- |
-LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0293")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: previously specified here
- --> $DIR/diagnostic-derive.rs:110:1
- |
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: specified multiple times
- --> $DIR/diagnostic-derive.rs:111:52
- |
-LL | #[warning(typeck::ambiguous_lifetime_bound, code = "E0293")]
+LL | #[diag(compiletest_example, code = "E0456", code = "E0457")]
| ^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:110:50
+ --> $DIR/diagnostic-derive.rs:113:36
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
- | ^^^^^^^
+LL | #[diag(compiletest_example, code = "E0456", code = "E0457")]
+ | ^^^^^^^
-error: specified multiple times
- --> $DIR/diagnostic-derive.rs:118:66
+error: `#[diag(compiletest_example)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:118:29
|
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
- | ^^^^^^^
+LL | #[diag(compiletest_example, compiletest_example, code = "E0456")]
+ | ^^^^^^^^^^^^^^^^^^^
|
-note: previously specified here
- --> $DIR/diagnostic-derive.rs:118:50
- |
-LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
- | ^^^^^^^
+ = help: diagnostic slug must be the first argument
-error: `#[error(typeck::ambiguous_lifetime_bound)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:123:43
- |
-LL | #[error(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: diagnostic kind not specified
- --> $DIR/diagnostic-derive.rs:128:1
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:123:1
|
LL | struct KindNotProvided {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: use the `#[error(...)]` attribute to create an error
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:131:1
+ --> $DIR/diagnostic-derive.rs:126:1
|
-LL | / #[error(code = "E0456")]
+LL | / #[diag(code = "E0456")]
LL | |
LL | | struct SlugNotProvided {}
| |_________________________^
|
- = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/diagnostic-derive.rs:142:5
+ --> $DIR/diagnostic-derive.rs:137:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: `#[nonsense]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:150:5
+ --> $DIR/diagnostic-derive.rs:145:5
|
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:167:5
+ --> $DIR/diagnostic-derive.rs:162:5
|
-LL | #[label(typeck::label)]
- | ^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(label)]
+ | ^^^^^^^^^^^^^^^
error: `name` doesn't refer to a field on this type
- --> $DIR/diagnostic-derive.rs:175:45
+ --> $DIR/diagnostic-derive.rs:170:37
|
-LL | #[suggestion(typeck::suggestion, code = "{name}")]
- | ^^^^^^^^
+LL | #[suggestion(suggestion, code = "{name}")]
+ | ^^^^^^^^
error: invalid format string: expected `'}'` but string was terminated
- --> $DIR/diagnostic-derive.rs:180:16
+ --> $DIR/diagnostic-derive.rs:175:10
|
-LL | #[derive(SessionDiagnostic)]
- | - ^ expected `'}'` in format string
- | |
- | because of this opening brace
+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 `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = 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:190:15
+ --> $DIR/diagnostic-derive.rs:185:10
|
-LL | #[derive(SessionDiagnostic)]
- | ^ unmatched `}` in format string
+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 `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/diagnostic-derive.rs:210:5
+ --> $DIR/diagnostic-derive.rs:205:5
|
-LL | #[label(typeck::label)]
- | ^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(label)]
+ | ^^^^^^^^^^^^^^^
+
+error: suggestion without `code = "..."`
+ --> $DIR/diagnostic-derive.rs:223:5
+ |
+LL | #[suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion(nonsense = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:235:18
+ --> $DIR/diagnostic-derive.rs:231:18
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^^^^^^^^^
|
- = help: only `message`, `code` and `applicability` are valid field attributes
+ = help: only `code` and `applicability` are valid nested attributes
+
+error: suggestion without `code = "..."`
+ --> $DIR/diagnostic-derive.rs:231:5
+ |
+LL | #[suggestion(nonsense = "bar")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion(msg = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:243:18
+ --> $DIR/diagnostic-derive.rs:240:18
|
LL | #[suggestion(msg = "bar")]
| ^^^^^^^^^^^
|
- = help: only `message`, `code` and `applicability` are valid field attributes
+ = help: only `code` and `applicability` are valid nested attributes
+
+error: suggestion without `code = "..."`
+ --> $DIR/diagnostic-derive.rs:240:5
+ |
+LL | #[suggestion(msg = "bar")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: wrong field type for suggestion
- --> $DIR/diagnostic-derive.rs:265:5
+ --> $DIR/diagnostic-derive.rs:263:5
|
-LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
+LL | / #[suggestion(suggestion, code = "This is suggested code")]
LL | |
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:280:5
+error: specified multiple times
+ --> $DIR/diagnostic-derive.rs:279:24
|
-LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
-LL | |
-LL | | suggestion: (Span, Span, Applicability),
- | |___________________________________________^
+LL | suggestion: (Span, Span, Applicability),
+ | ^^^^
+ |
+note: previously specified here
+ --> $DIR/diagnostic-derive.rs:279:18
+ |
+LL | suggestion: (Span, Span, Applicability),
+ | ^^^^
-error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
- --> $DIR/diagnostic-derive.rs:288:5
+error: specified multiple times
+ --> $DIR/diagnostic-derive.rs:287:33
|
-LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
-LL | |
-LL | | suggestion: (Applicability, Applicability, Span),
- | |____________________________________________________^
+LL | suggestion: (Applicability, Applicability, Span),
+ | ^^^^^^^^^^^^^
+ |
+note: previously specified here
+ --> $DIR/diagnostic-derive.rs:287:18
+ |
+LL | suggestion: (Applicability, Applicability, Span),
+ | ^^^^^^^^^^^^^
error: `#[label = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:296:5
+ --> $DIR/diagnostic-derive.rs:294:5
|
LL | #[label = "bar"]
| ^^^^^^^^^^^^^^^^
-error: applicability cannot be set in both the field and attribute
- --> $DIR/diagnostic-derive.rs:447:52
+error: specified multiple times
+ --> $DIR/diagnostic-derive.rs:445:44
+ |
+LL | #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
-LL | #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: previously specified here
+ --> $DIR/diagnostic-derive.rs:447:24
+ |
+LL | suggestion: (Span, Applicability),
+ | ^^^^^^^^^^^^^
error: invalid applicability
- --> $DIR/diagnostic-derive.rs:455:52
+ --> $DIR/diagnostic-derive.rs:453:44
|
-LL | #[suggestion(typeck::suggestion, code = "...", applicability = "batman")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[suggestion(suggestion, code = "...", applicability = "batman")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[label(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:518:5
+error: `#[label(foo)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:516:20
+ |
+LL | #[label(label, foo)]
+ | ^^^
|
-LL | #[label(typeck::label, foo)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: a diagnostic slug must be the first argument to the attribute
-error: `#[label(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:526:5
+error: `#[label(foo = ...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:524:20
|
-LL | #[label(typeck::label, foo = "...")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(label, foo = "...")]
+ | ^^^^^^^^^^^
-error: `#[label(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:534:5
+error: `#[label(foo(...))]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:532:20
|
-LL | #[label(typeck::label, foo("..."))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(label, foo("..."))]
+ | ^^^^^^^^^^
+
+error: `#[primary_span]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:545:5
+ |
+LL | #[primary_span]
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: the `primary_span` field attribute is not valid for lint diagnostics
+
+error: `#[error(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:565:1
+ |
+LL | #[error(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: only `#[error(..)]` and `#[warning(..)]` are supported
- --> $DIR/diagnostic-derive.rs:540:1
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:565:1
|
-LL | / #[lint(typeck::ambiguous_lifetime_bound)]
+LL | / #[error(compiletest_example, code = "E0123")]
+LL | |
+LL | |
LL | |
-LL | | struct LintsBad {
-LL | | }
- | |_^
+LL | | struct ErrorAttribute {}
+ | |________________________^
|
- = help: use the `#[error(...)]` attribute to create a error
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: only `#[lint(..)]` is supported
- --> $DIR/diagnostic-derive.rs:551:1
+error: `#[warn_(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:572:1
|
-LL | / #[error(typeck::ambiguous_lifetime_bound)]
+LL | #[warn_(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:572:1
+ |
+LL | / #[warn_(compiletest_example, code = "E0123")]
+LL | |
+LL | |
LL | |
-LL | | struct ErrorsBad {
-LL | | }
- | |_^
+LL | | struct WarnAttribute {}
+ | |_______________________^
|
- = help: use the `#[lint(...)]` attribute to create a lint
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
+
+error: `#[lint(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:579:1
+ |
+LL | #[lint(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:579:1
+ |
+LL | / #[lint(compiletest_example, code = "E0123")]
+LL | |
+LL | |
+LL | |
+LL | | struct LintAttributeOnSessionDiag {}
+ | |____________________________________^
+ |
+ = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
+
+error: `#[lint(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:586:1
+ |
+LL | #[lint(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[lint(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:586:1
+ |
+LL | #[lint(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: diagnostic slug not specified
+ --> $DIR/diagnostic-derive.rs:586:1
+ |
+LL | / #[lint(compiletest_example, code = "E0123")]
+LL | |
+LL | |
+LL | |
+LL | |
+LL | | struct LintAttributeOnLintDiag {}
+ | |_________________________________^
+ |
+ = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]`
+
+error: specified multiple times
+ --> $DIR/diagnostic-derive.rs:596:44
+ |
+LL | #[suggestion(suggestion, code = "...", code = ",,,")]
+ | ^^^^^^^^^^^^
+ |
+note: previously specified here
+ --> $DIR/diagnostic-derive.rs:596:30
+ |
+LL | #[suggestion(suggestion, code = "...", code = ",,,")]
+ | ^^^^^^^^^^^^
+
+error: wrong types for suggestion
+ --> $DIR/diagnostic-derive.rs:605:24
+ |
+LL | suggestion: (Span, usize),
+ | ^^^^^
+ |
+ = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
+
+error: wrong types for suggestion
+ --> $DIR/diagnostic-derive.rs:613:17
+ |
+LL | suggestion: (Span,),
+ | ^^^^^^^
+ |
+ = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
+
+error: suggestion without `code = "..."`
+ --> $DIR/diagnostic-derive.rs:620:5
+ |
+LL | #[suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[multipart_suggestion(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:627:1
+ |
+LL | #[multipart_suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider creating a `Subdiagnostic` instead
+
+error: `#[multipart_suggestion(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:630:1
+ |
+LL | #[multipart_suggestion()]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider creating a `Subdiagnostic` instead
+
+error: `#[multipart_suggestion(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:634:5
+ |
+LL | #[multipart_suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider creating a `Subdiagnostic` instead
+
+error: `#[suggestion(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:642:1
+ |
+LL | #[suggestion(suggestion, code = "...")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: `#[label]` and `#[suggestion]` can only be applied to fields
+
+error: `#[label]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:651:1
+ |
+LL | #[label]
+ | ^^^^^^^^
+ |
+ = help: `#[label]` and `#[suggestion]` can only be applied to fields
+
+error: `#[subdiagnostic(bad)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:685:21
+ |
+LL | #[subdiagnostic(bad)]
+ | ^^^
+ |
+ = help: `eager` is the only supported nested attribute for `subdiagnostic`
+
+error: `#[subdiagnostic = ...]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:693:5
+ |
+LL | #[subdiagnostic = "bad"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: `eager` is the only supported nested attribute for `subdiagnostic`
+
+error: `#[subdiagnostic(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:701:5
+ |
+LL | #[subdiagnostic(bad, bad)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: `eager` is the only supported nested attribute for `subdiagnostic`
+
+error: `#[subdiagnostic("...")]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:709:21
+ |
+LL | #[subdiagnostic("bad")]
+ | ^^^^^
+ |
+ = help: `eager` is the only supported nested attribute for `subdiagnostic`
+
+error: `#[subdiagnostic(...)]` is not a valid attribute
+ --> $DIR/diagnostic-derive.rs:717:5
+ |
+LL | #[subdiagnostic(eager)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: eager subdiagnostics are not supported on lints
+
+error: expected at least one string literal for `code(...)`
+ --> $DIR/diagnostic-derive.rs:779:18
+ |
+LL | #[suggestion(code())]
+ | ^^^^^^
+
+error: `code(...)` must contain only string literals
+ --> $DIR/diagnostic-derive.rs:787:23
+ |
+LL | #[suggestion(code(foo))]
+ | ^^^
+
+error: `code = "..."`/`code(...)` must contain only string literals
+ --> $DIR/diagnostic-derive.rs:795:18
+ |
+LL | #[suggestion(code = 3)]
+ | ^^^^^^^^
error: cannot find attribute `nonsense` in this scope
- --> $DIR/diagnostic-derive.rs:53:3
+ --> $DIR/diagnostic-derive.rs:55:3
|
-LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
+LL | #[nonsense(compiletest_example, code = "E0123")]
| ^^^^^^^^
error: cannot find attribute `nonsense` in this scope
- --> $DIR/diagnostic-derive.rs:150:7
+ --> $DIR/diagnostic-derive.rs:145:7
|
LL | #[nonsense]
| ^^^^^^^^
+error: cannot find attribute `error` in this scope
+ --> $DIR/diagnostic-derive.rs:565:3
+ |
+LL | #[error(compiletest_example, code = "E0123")]
+ | ^^^^^
+
+error: cannot find attribute `warn_` in this scope
+ --> $DIR/diagnostic-derive.rs:572:3
+ |
+LL | #[warn_(compiletest_example, code = "E0123")]
+ | ^^^^^ help: a built-in attribute with a similar name exists: `warn`
+
+error: cannot find attribute `lint` in this scope
+ --> $DIR/diagnostic-derive.rs:579:3
+ |
+LL | #[lint(compiletest_example, code = "E0123")]
+ | ^^^^ help: a built-in attribute with a similar name exists: `link`
+
+error: cannot find attribute `lint` in this scope
+ --> $DIR/diagnostic-derive.rs:586:3
+ |
+LL | #[lint(compiletest_example, code = "E0123")]
+ | ^^^^ help: a built-in attribute with a similar name exists: `link`
+
+error: cannot find attribute `multipart_suggestion` in this scope
+ --> $DIR/diagnostic-derive.rs:627:3
+ |
+LL | #[multipart_suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: cannot find attribute `multipart_suggestion` in this scope
+ --> $DIR/diagnostic-derive.rs:630:3
+ |
+LL | #[multipart_suggestion()]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: cannot find attribute `multipart_suggestion` in this scope
+ --> $DIR/diagnostic-derive.rs:634:7
+ |
+LL | #[multipart_suggestion(suggestion)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
error[E0425]: cannot find value `nonsense` in module `rustc_errors::fluent`
- --> $DIR/diagnostic-derive.rs:66:9
+ --> $DIR/diagnostic-derive.rs:68: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:340:10
+ --> $DIR/diagnostic-derive.rs:338:10
|
-LL | #[derive(SessionDiagnostic)]
- | ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
+LL | #[derive(Diagnostic)]
+ | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
|
= help: normalized in stderr
note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`
- --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:539:19
+ --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC
|
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 `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 48 previous errors
+error: aborting due to 83 previous errors
Some errors have detailed explanations: E0277, E0425.
For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
index 16da25c40..efec85eb5 100644
--- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
+++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
@@ -1,8 +1,8 @@
// check-fail
-// Tests error conditions for specifying subdiagnostics using #[derive(SessionSubdiagnostic)]
+// 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 SessionSubdiagnostic is strictly internal to the compiler
+// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
// the test is just ignored on stable and beta:
// ignore-beta
// ignore-stable
@@ -17,25 +17,25 @@ extern crate rustc_macros;
use rustc_errors::Applicability;
use rustc_span::Span;
-use rustc_macros::SessionSubdiagnostic;
+use rustc_macros::Subdiagnostic;
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct A {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum B {
- #[label(parser::add_paren)]
+ #[label(parser_add_paren)]
A {
#[primary_span]
span: Span,
var: String,
},
- #[label(parser::add_paren)]
+ #[label(parser_add_paren)]
B {
#[primary_span]
span: Span,
@@ -43,23 +43,23 @@ enum B {
}
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
//~^ ERROR label without `#[primary_span]` field
struct C {
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label]
-//~^ ERROR `#[label]` is not a valid attribute
+//~^ ERROR diagnostic slug must be first argument
struct D {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[foo]
//~^ ERROR `#[foo]` is not a valid attribute
//~^^ ERROR cannot find attribute `foo` in this scope
@@ -69,7 +69,7 @@ struct E {
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label = "..."]
//~^ ERROR `#[label = ...]` is not a valid attribute
struct F {
@@ -78,43 +78,47 @@ struct F {
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label(bug = "...")]
//~^ ERROR `#[label(bug = ...)]` is not a valid attribute
+//~| ERROR diagnostic slug must be first argument
struct G {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label("...")]
//~^ ERROR `#[label("...")]` is not a valid attribute
+//~| ERROR diagnostic slug must be first argument
struct H {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label(slug = 4)]
//~^ ERROR `#[label(slug = ...)]` is not a valid attribute
+//~| ERROR diagnostic slug must be first argument
struct J {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label(slug("..."))]
//~^ ERROR `#[label(slug(...))]` is not a valid attribute
+//~| ERROR diagnostic slug must be first argument
struct K {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label(slug)]
//~^ ERROR cannot find value `slug` in module `rustc_errors::fluent`
//~^^ NOTE not found in `rustc_errors::fluent`
@@ -124,7 +128,7 @@ struct L {
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label()]
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
struct M {
@@ -133,30 +137,30 @@ struct M {
var: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren, code = "...")]
-//~^ ERROR `code` is not a valid nested attribute of a `label` attribute
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren, code = "...")]
+//~^ ERROR `#[label(code = ...)]` is not a valid attribute
struct N {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren, applicability = "machine-applicable")]
-//~^ ERROR `applicability` is not a valid nested attribute of a `label` attribute
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren, applicability = "machine-applicable")]
+//~^ ERROR `#[label(applicability = ...)]` is not a valid attribute
struct O {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[foo]
//~^ ERROR cannot find attribute `foo` in this scope
//~^^ ERROR unsupported type attribute for subdiagnostic enum
enum P {
- #[label(parser::add_paren)]
+ #[label(parser_add_paren)]
A {
#[primary_span]
span: Span,
@@ -164,11 +168,11 @@ enum P {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum Q {
#[bar]
-//~^ ERROR `#[bar]` is not a valid attribute
-//~^^ ERROR cannot find attribute `bar` in this scope
+ //~^ ERROR `#[bar]` is not a valid attribute
+ //~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
@@ -176,11 +180,11 @@ enum Q {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum R {
#[bar = "..."]
-//~^ ERROR `#[bar = ...]` is not a valid attribute
-//~^^ ERROR cannot find attribute `bar` in this scope
+ //~^ ERROR `#[bar = ...]` is not a valid attribute
+ //~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
@@ -188,11 +192,11 @@ enum R {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum S {
#[bar = 4]
-//~^ ERROR `#[bar = ...]` is not a valid attribute
-//~^^ ERROR cannot find attribute `bar` in this scope
+ //~^ ERROR `#[bar = ...]` is not a valid attribute
+ //~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
@@ -200,11 +204,11 @@ enum S {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum T {
#[bar("...")]
-//~^ ERROR `#[bar("...")]` is not a valid attribute
-//~^^ ERROR cannot find attribute `bar` in this scope
+ //~^ ERROR `#[bar(...)]` is not a valid attribute
+ //~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
@@ -212,10 +216,11 @@ enum T {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum U {
#[label(code = "...")]
-//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
+ //~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
+ //~| ERROR `#[label(code = ...)]` is not a valid attribute
A {
#[primary_span]
span: Span,
@@ -223,24 +228,23 @@ enum U {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum V {
- #[label(parser::add_paren)]
+ #[label(parser_add_paren)]
A {
#[primary_span]
span: Span,
var: String,
},
B {
-//~^ ERROR subdiagnostic kind not specified
#[primary_span]
span: Span,
var: String,
}
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
//~^ ERROR label without `#[primary_span]` field
struct W {
#[primary_span]
@@ -248,8 +252,8 @@ struct W {
span: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct X {
#[primary_span]
span: Span,
@@ -258,8 +262,8 @@ struct X {
applicability: Applicability,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct Y {
#[primary_span]
span: Span,
@@ -269,8 +273,8 @@ struct Y {
bar: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct Z {
#[primary_span]
span: Span,
@@ -280,8 +284,8 @@ struct Z {
bar: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct AA {
#[primary_span]
span: Span,
@@ -291,8 +295,8 @@ struct AA {
bar: String,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct AB {
#[primary_span]
span: Span,
@@ -300,53 +304,49 @@ struct AB {
z: Z
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
union AC {
//~^ ERROR unexpected unsupported untagged union
span: u32,
b: u64
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
-//~^ NOTE previously specified here
-//~^^ NOTE previously specified here
-#[label(parser::add_paren)]
-//~^ ERROR specified multiple times
-//~^^ ERROR specified multiple times
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
+#[label(parser_add_paren)]
struct AD {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren, parser::add_paren)]
-//~^ ERROR `#[label(parser::add_paren)]` is not a valid attribute
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren, parser_add_paren)]
+//~^ ERROR `#[label(parser_add_paren)]` is not a valid attribute
struct AE {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[label(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
struct AF {
#[primary_span]
-//~^ NOTE previously specified here
+ //~^ NOTE previously specified here
span_a: Span,
#[primary_span]
-//~^ ERROR specified multiple times
+ //~^ ERROR specified multiple times
span_b: Span,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
struct AG {
-//~^ ERROR subdiagnostic kind not specified
+ //~^ ERROR subdiagnostic kind not specified
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...")]
struct AH {
#[primary_span]
span: Span,
@@ -355,9 +355,9 @@ struct AH {
var: String,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum AI {
- #[suggestion(parser::add_paren, code = "...")]
+ #[suggestion(parser_add_paren, code = "...")]
A {
#[primary_span]
span: Span,
@@ -365,7 +365,7 @@ enum AI {
applicability: Applicability,
var: String,
},
- #[suggestion(parser::add_paren, code = "...")]
+ #[suggestion(parser_add_paren, code = "...")]
B {
#[primary_span]
span: Span,
@@ -375,8 +375,8 @@ enum AI {
}
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...", code = "...")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...", code = "...")]
//~^ ERROR specified multiple times
//~^^ NOTE previously specified here
struct AJ {
@@ -386,40 +386,38 @@ struct AJ {
applicability: Applicability,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...")]
struct AK {
#[primary_span]
span: Span,
#[applicability]
-//~^ NOTE previously specified here
+ //~^ NOTE previously specified here
applicability_a: Applicability,
#[applicability]
-//~^ ERROR specified multiple times
+ //~^ ERROR specified multiple times
applicability_b: Applicability,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...")]
-//~^ ERROR suggestion without `applicability`
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...")]
struct AL {
#[primary_span]
span: Span,
#[applicability]
-//~^ ERROR the `#[applicability]` attribute can only be applied to fields of type `Applicability`
+ //~^ ERROR the `#[applicability]` attribute can only be applied to fields of type `Applicability`
applicability: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...")]
-//~^ ERROR suggestion without `applicability`
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...")]
struct AM {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren)]
//~^ ERROR suggestion without `code = "..."`
struct AN {
#[primary_span]
@@ -428,44 +426,43 @@ struct AN {
applicability: Applicability,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code ="...", applicability = "foo")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code ="...", applicability = "foo")]
//~^ ERROR invalid applicability
struct AO {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
-#[help(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[help(parser_add_paren)]
struct AP {
var: String
}
-#[derive(SessionSubdiagnostic)]
-#[note(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[note(parser_add_paren)]
struct AQ;
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code = "...")]
-//~^ ERROR suggestion without `applicability`
-//~^^ ERROR suggestion without `#[primary_span]` field
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code = "...")]
+//~^ ERROR suggestion without `#[primary_span]` field
struct AR {
var: String,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code ="...", applicability = "machine-applicable")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code ="...", applicability = "machine-applicable")]
struct AS {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
#[label]
//~^ ERROR unsupported type attribute for subdiagnostic enum
enum AT {
- #[label(parser::add_paren)]
+ #[label(parser_add_paren)]
A {
#[primary_span]
span: Span,
@@ -473,25 +470,25 @@ enum AT {
}
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
struct AU {
#[primary_span]
span: Span,
var: String,
}
-#[derive(SessionSubdiagnostic)]
-#[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
//~^ ERROR `var` doesn't refer to a field on this type
struct AV {
#[primary_span]
span: Span,
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum AW {
- #[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
+ #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
A {
#[primary_span]
span: Span,
@@ -499,9 +496,9 @@ enum AW {
}
}
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
enum AX {
- #[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
+ #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
//~^ ERROR `var` doesn't refer to a field on this type
A {
#[primary_span]
@@ -509,14 +506,203 @@ enum AX {
}
}
-#[derive(SessionSubdiagnostic)]
-#[warn_(parser::add_paren)]
-struct AY {
-}
+#[derive(Subdiagnostic)]
+#[warning(parser_add_paren)]
+struct AY {}
-#[derive(SessionSubdiagnostic)]
-#[warn_(parser::add_paren)]
+#[derive(Subdiagnostic)]
+#[warning(parser_add_paren)]
struct AZ {
#[primary_span]
span: Span,
}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parser_add_paren, 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(parser_add_paren, code = "...", applicability = "machine-applicable")]
+//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
+//~| ERROR `#[multipart_suggestion(code = ...)]` is not a valid attribute
+struct BBa {
+ var: String,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+struct BBb {
+ #[suggestion_part]
+ //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
+ span1: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+struct BBc {
+ #[suggestion_part()]
+ //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
+ span1: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+//~^ 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(parser_add_paren)]
+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 `#[suggestion_part(foo = ...)]` is not a valid attribute
+ 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(parser_add_paren, applicability = "machine-applicable")]
+struct BE {
+ #[suggestion_part(code = "...", code = ",,,")]
+ //~^ ERROR specified multiple times
+ //~| NOTE previously specified here
+ span: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+struct BF {
+ #[suggestion_part(code = "(")]
+ first: Span,
+ #[suggestion_part(code = ")")]
+ second: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BG {
+ #[applicability]
+ appl: Applicability,
+ #[suggestion_part(code = "(")]
+ first: Span,
+ #[suggestion_part(code = ")")]
+ second: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren, 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(parser_add_paren, applicability = "machine-applicable")]
+struct BI {
+ #[suggestion_part(code = "")]
+ spans: Vec<Span>,
+}
+
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
+struct BJ {
+ #[primary_span]
+ span: Span,
+ r#type: String,
+}
+
+/// with a doc comment on the type..
+#[derive(Subdiagnostic)]
+#[label(parser_add_paren)]
+struct BK {
+ /// ..and the field
+ #[primary_span]
+ span: Span,
+}
+
+/// with a doc comment on the type..
+#[derive(Subdiagnostic)]
+enum BL {
+ /// ..and the variant..
+ #[label(parser_add_paren)]
+ Foo {
+ /// ..and the field
+ #[primary_span]
+ span: Span,
+ }
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BM {
+ #[suggestion_part(code("foo"))]
+ //~^ ERROR expected exactly one string literal for `code = ...`
+ span: Span,
+ r#type: String,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BN {
+ #[suggestion_part(code("foo", "bar"))]
+ //~^ ERROR expected exactly one string literal for `code = ...`
+ span: Span,
+ r#type: String,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BO {
+ #[suggestion_part(code(3))]
+ //~^ ERROR expected exactly one string literal for `code = ...`
+ span: Span,
+ r#type: String,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BP {
+ #[suggestion_part(code())]
+ //~^ ERROR expected exactly one string literal for `code = ...`
+ span: Span,
+ r#type: String,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parser_add_paren)]
+struct BQ {
+ #[suggestion_part(code = 3)]
+ //~^ ERROR `code = "..."`/`code(...)` must contain only string literals
+ span: Span,
+ r#type: String,
+}
diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
index a289c4fff..a85a8711e 100644
--- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
@@ -1,14 +1,14 @@
error: label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:47:1
|
-LL | / #[label(parser::add_paren)]
+LL | / #[label(parser_add_paren)]
LL | |
LL | | struct C {
LL | | var: String,
LL | | }
| |_^
-error: `#[label]` is not a valid attribute
+error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:54:1
|
LL | #[label]
@@ -31,105 +31,119 @@ error: `#[label(bug = ...)]` is not a valid attribute
|
LL | #[label(bug = "...")]
| ^^^^^^^^^^^
+
+error: diagnostic slug must be first argument of a `#[label(...)]` attribute
+ --> $DIR/subdiagnostic-derive.rs:82:1
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[label(bug = "...")]
+ | ^^^^^^^^^^^^^^^^^^^^^
error: `#[label("...")]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:91:9
+ --> $DIR/subdiagnostic-derive.rs:92:9
|
LL | #[label("...")]
| ^^^^^
+
+error: diagnostic slug must be first argument of a `#[label(...)]` attribute
+ --> $DIR/subdiagnostic-derive.rs:92:1
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[label("...")]
+ | ^^^^^^^^^^^^^^^
error: `#[label(slug = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:100:9
+ --> $DIR/subdiagnostic-derive.rs:102:9
|
LL | #[label(slug = 4)]
| ^^^^^^^^
+
+error: diagnostic slug must be first argument of a `#[label(...)]` attribute
+ --> $DIR/subdiagnostic-derive.rs:102:1
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[label(slug = 4)]
+ | ^^^^^^^^^^^^^^^^^^
error: `#[label(slug(...))]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:109:9
+ --> $DIR/subdiagnostic-derive.rs:112:9
|
LL | #[label(slug("..."))]
| ^^^^^^^^^^^
+
+error: diagnostic slug must be first argument of a `#[label(...)]` attribute
+ --> $DIR/subdiagnostic-derive.rs:112:1
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[label(slug("..."))]
+ | ^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:128:1
+ --> $DIR/subdiagnostic-derive.rs:132:1
|
LL | #[label()]
| ^^^^^^^^^^
-error: `code` is not a valid nested attribute of a `label` attribute
- --> $DIR/subdiagnostic-derive.rs:137:1
+error: `#[label(code = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:141:27
|
-LL | #[label(parser::add_paren, code = "...")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(parser_add_paren, code = "...")]
+ | ^^^^^^^^^^^^
-error: `applicability` is not a valid nested attribute of a `label` attribute
- --> $DIR/subdiagnostic-derive.rs:146:1
+error: `#[label(applicability = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:150:27
|
-LL | #[label(parser::add_paren, applicability = "machine-applicable")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(parser_add_paren, applicability = "machine-applicable")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsupported type attribute for subdiagnostic enum
- --> $DIR/subdiagnostic-derive.rs:155:1
+ --> $DIR/subdiagnostic-derive.rs:159:1
|
LL | #[foo]
| ^^^^^^
error: `#[bar]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:169:5
+ --> $DIR/subdiagnostic-derive.rs:173:5
|
LL | #[bar]
| ^^^^^^
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:181:5
+ --> $DIR/subdiagnostic-derive.rs:185:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:193:5
+ --> $DIR/subdiagnostic-derive.rs:197:5
|
LL | #[bar = 4]
| ^^^^^^^^^^
-error: `#[bar("...")]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:205:11
+error: `#[bar(...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:209:5
|
LL | #[bar("...")]
- | ^^^^^
+ | ^^^^^^^^^^^^^
+
+error: `#[label(code = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:221:13
|
- = help: first argument of the attribute should be the diagnostic slug
+LL | #[label(code = "...")]
+ | ^^^^^^^^^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:217:5
+ --> $DIR/subdiagnostic-derive.rs:221:5
|
LL | #[label(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^
-error: subdiagnostic kind not specified
- --> $DIR/subdiagnostic-derive.rs:234:5
- |
-LL | B {
- | ^
-
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/subdiagnostic-derive.rs:246:5
+ --> $DIR/subdiagnostic-derive.rs:250:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: label without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:243:1
+ --> $DIR/subdiagnostic-derive.rs:247:1
|
-LL | / #[label(parser::add_paren)]
+LL | / #[label(parser_add_paren)]
LL | |
LL | | struct W {
LL | | #[primary_span]
@@ -139,13 +153,13 @@ LL | | }
| |_^
error: `#[applicability]` is only valid on suggestions
- --> $DIR/subdiagnostic-derive.rs:256:5
+ --> $DIR/subdiagnostic-derive.rs:260:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: `#[bar]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:266:5
+ --> $DIR/subdiagnostic-derive.rs:270:5
|
LL | #[bar]
| ^^^^^^
@@ -153,19 +167,21 @@ LL | #[bar]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:277:5
+ --> $DIR/subdiagnostic-derive.rs:281:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:288:5
+ --> $DIR/subdiagnostic-derive.rs:292:5
|
LL | #[bar("...")]
| ^^^^^^^^^^^^^
+ |
+ = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: unexpected unsupported untagged union
- --> $DIR/subdiagnostic-derive.rs:304:1
+ --> $DIR/subdiagnostic-derive.rs:308:1
|
LL | / union AC {
LL | |
@@ -174,35 +190,11 @@ LL | | b: u64
LL | | }
| |_^
-error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:314:1
- |
-LL | #[label(parser::add_paren)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:311:1
- |
-LL | #[label(parser::add_paren)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:314:1
- |
-LL | #[label(parser::add_paren)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:311:1
- |
-LL | #[label(parser::add_paren)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: `#[label(parser::add_paren)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:323:28
+error: `#[label(parser_add_paren)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:323:27
|
-LL | #[label(parser::add_paren, parser::add_paren)]
- | ^^^^^^^^^^^^^^^^^
+LL | #[label(parser_add_paren, parser_add_paren)]
+ | ^^^^^^^^^^^^^^^^
|
= help: a diagnostic slug must be the first argument to the attribute
@@ -225,16 +217,16 @@ LL | struct AG {
| ^^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:379:47
+ --> $DIR/subdiagnostic-derive.rs:379:46
|
-LL | #[suggestion(parser::add_paren, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
+ | ^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:379:33
+ --> $DIR/subdiagnostic-derive.rs:379:32
|
-LL | #[suggestion(parser::add_paren, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
+ | ^^^^^^^^^^^^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:397:5
@@ -249,91 +241,209 @@ LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: the `#[applicability]` attribute can only be applied to fields of type `Applicability`
- --> $DIR/subdiagnostic-derive.rs:408:5
+ --> $DIR/subdiagnostic-derive.rs:407:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
-error: suggestion without `applicability`
- --> $DIR/subdiagnostic-derive.rs:403:1
+error: suggestion without `code = "..."`
+ --> $DIR/subdiagnostic-derive.rs:420:1
|
-LL | / #[suggestion(parser::add_paren, code = "...")]
-LL | |
-LL | | struct AL {
-LL | | #[primary_span]
-... |
-LL | | applicability: Span,
-LL | | }
- | |_^
+LL | #[suggestion(parser_add_paren)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: suggestion without `applicability`
- --> $DIR/subdiagnostic-derive.rs:414:1
+error: invalid applicability
+ --> $DIR/subdiagnostic-derive.rs:430:45
+ |
+LL | #[suggestion(parser_add_paren, code ="...", applicability = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: suggestion without `#[primary_span]` field
+ --> $DIR/subdiagnostic-derive.rs:448:1
|
-LL | / #[suggestion(parser::add_paren, code = "...")]
+LL | / #[suggestion(parser_add_paren, code = "...")]
LL | |
-LL | | struct AM {
-LL | | #[primary_span]
-LL | | span: Span,
+LL | | struct AR {
+LL | | var: String,
LL | | }
| |_^
-error: suggestion without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:422:1
+error: unsupported type attribute for subdiagnostic enum
+ --> $DIR/subdiagnostic-derive.rs:462:1
+ |
+LL | #[label]
+ | ^^^^^^^^
+
+error: `var` doesn't refer to a field on this type
+ --> $DIR/subdiagnostic-derive.rs:482:38
+ |
+LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+ | ^^^^^^^
+
+error: `var` doesn't refer to a field on this type
+ --> $DIR/subdiagnostic-derive.rs:501:42
|
-LL | / #[suggestion(parser::add_paren)]
+LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+ | ^^^^^^^
+
+error: `#[suggestion_part]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:524:5
+ |
+LL | #[suggestion_part]
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
+
+error: `#[suggestion_part(...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:527:5
+ |
+LL | #[suggestion_part(code = "...")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: `#[suggestion_part(...)]` is only valid in multipart suggestions
+
+error: suggestion without `#[primary_span]` field
+ --> $DIR/subdiagnostic-derive.rs:521:1
+ |
+LL | / #[suggestion(parser_add_paren, code = "...")]
LL | |
-LL | | struct AN {
-LL | | #[primary_span]
+LL | | struct BA {
+LL | | #[suggestion_part]
... |
-LL | | applicability: Applicability,
+LL | | var: String,
LL | | }
| |_^
-error: invalid applicability
- --> $DIR/subdiagnostic-derive.rs:432:46
+error: `#[multipart_suggestion(code = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:536:42
|
-LL | #[suggestion(parser::add_paren, code ="...", applicability = "foo")]
- | ^^^^^^^^^^^^^^^^^^^^^
+LL | #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
+ | ^^^^^^^^^^^^
+ |
+ = help: only `applicability` is a valid nested attributes
-error: suggestion without `applicability`
- --> $DIR/subdiagnostic-derive.rs:450:1
+error: multipart suggestion without any `#[suggestion_part(...)]` fields
+ --> $DIR/subdiagnostic-derive.rs:536:1
|
-LL | / #[suggestion(parser::add_paren, code = "...")]
+LL | / #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
LL | |
LL | |
-LL | | struct AR {
+LL | | struct BBa {
LL | | var: String,
LL | | }
| |_^
-error: suggestion without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:450:1
+error: `#[suggestion_part(...)]` attribute without `code = "..."`
+ --> $DIR/subdiagnostic-derive.rs:546:5
|
-LL | / #[suggestion(parser::add_paren, code = "...")]
+LL | #[suggestion_part]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: `#[suggestion_part(...)]` attribute without `code = "..."`
+ --> $DIR/subdiagnostic-derive.rs:554:5
+ |
+LL | #[suggestion_part()]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `#[primary_span]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:563:5
+ |
+LL | #[primary_span]
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
+
+error: multipart suggestion without any `#[suggestion_part(...)]` fields
+ --> $DIR/subdiagnostic-derive.rs:560:1
+ |
+LL | / #[multipart_suggestion(parser_add_paren)]
LL | |
+LL | | struct BC {
+LL | | #[primary_span]
LL | |
-LL | | struct AR {
-LL | | var: String,
+LL | | span: Span,
LL | | }
| |_^
-error: unsupported type attribute for subdiagnostic enum
- --> $DIR/subdiagnostic-derive.rs:465:1
+error: `#[suggestion_part(...)]` attribute without `code = "..."`
+ --> $DIR/subdiagnostic-derive.rs:571:5
|
-LL | #[label]
- | ^^^^^^^^
+LL | #[suggestion_part]
+ | ^^^^^^^^^^^^^^^^^^
-error: `var` doesn't refer to a field on this type
- --> $DIR/subdiagnostic-derive.rs:485:39
+error: `#[suggestion_part(...)]` attribute without `code = "..."`
+ --> $DIR/subdiagnostic-derive.rs:574:5
|
-LL | #[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
- | ^^^^^^^
+LL | #[suggestion_part()]
+ | ^^^^^^^^^^^^^^^^^^^^
-error: `var` doesn't refer to a field on this type
- --> $DIR/subdiagnostic-derive.rs:504:43
+error: `#[suggestion_part(foo = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:577:23
+ |
+LL | #[suggestion_part(foo = "bar")]
+ | ^^^^^^^^^^^
+ |
+ = help: `code` is the only valid nested attribute
+
+error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
+ --> $DIR/subdiagnostic-derive.rs:580:5
+ |
+LL | #[suggestion_part(code = "...")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
+ --> $DIR/subdiagnostic-derive.rs:583:5
+ |
+LL | #[suggestion_part()]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: specified multiple times
+ --> $DIR/subdiagnostic-derive.rs:591:37
+ |
+LL | #[suggestion_part(code = "...", code = ",,,")]
+ | ^^^^^^^^^^^^
+ |
+note: previously specified here
+ --> $DIR/subdiagnostic-derive.rs:591:23
+ |
+LL | #[suggestion_part(code = "...", code = ",,,")]
+ | ^^^^^^^^^^^^
+
+error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
+ --> $DIR/subdiagnostic-derive.rs:620:5
+ |
+LL | #[applicability]
+ | ^^^^^^^^^^^^^^^^
+
+error: expected exactly one string literal for `code = ...`
+ --> $DIR/subdiagnostic-derive.rs:668:23
+ |
+LL | #[suggestion_part(code("foo"))]
+ | ^^^^^^^^^^^
+
+error: expected exactly one string literal for `code = ...`
+ --> $DIR/subdiagnostic-derive.rs:677:23
+ |
+LL | #[suggestion_part(code("foo", "bar"))]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: expected exactly one string literal for `code = ...`
+ --> $DIR/subdiagnostic-derive.rs:686:23
+ |
+LL | #[suggestion_part(code(3))]
+ | ^^^^^^^
+
+error: expected exactly one string literal for `code = ...`
+ --> $DIR/subdiagnostic-derive.rs:695:23
+ |
+LL | #[suggestion_part(code())]
+ | ^^^^^^
+
+error: `code = "..."`/`code(...)` must contain only string literals
+ --> $DIR/subdiagnostic-derive.rs:704:23
|
-LL | #[suggestion(parser::add_paren, code ="{var}", applicability = "machine-applicable")]
- | ^^^^^^^
+LL | #[suggestion_part(code = 3)]
+ | ^^^^^^^^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:63:3
@@ -342,59 +452,59 @@ LL | #[foo]
| ^^^
error: cannot find attribute `foo` in this scope
- --> $DIR/subdiagnostic-derive.rs:155:3
+ --> $DIR/subdiagnostic-derive.rs:159:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:169:7
+ --> $DIR/subdiagnostic-derive.rs:173:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:181:7
+ --> $DIR/subdiagnostic-derive.rs:185:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:193:7
+ --> $DIR/subdiagnostic-derive.rs:197:7
|
LL | #[bar = 4]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:205:7
+ --> $DIR/subdiagnostic-derive.rs:209:7
|
LL | #[bar("...")]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:266:7
+ --> $DIR/subdiagnostic-derive.rs:270:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:277:7
+ --> $DIR/subdiagnostic-derive.rs:281:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:288:7
+ --> $DIR/subdiagnostic-derive.rs:292:7
|
LL | #[bar("...")]
| ^^^
error[E0425]: cannot find value `slug` in module `rustc_errors::fluent`
- --> $DIR/subdiagnostic-derive.rs:118:9
+ --> $DIR/subdiagnostic-derive.rs:122:9
|
LL | #[label(slug)]
| ^^^^ not found in `rustc_errors::fluent`
-error: aborting due to 52 previous errors
+error: aborting due to 72 previous errors
For more information about this error, try `rustc --explain E0425`.