Uitests for subdiagnostics

This commit is contained in:
Jonathan Brouwer 2026-01-30 19:26:57 +01:00
parent 378c6fc6fe
commit 523d9d9200
No known key found for this signature in database
GPG key ID: F13E55D38C971DEF
4 changed files with 1437 additions and 96 deletions

View file

@ -0,0 +1,807 @@
//@ check-fail
// Tests error conditions for specifying inline subdiagnostics using #[derive(Subdiagnostic)]
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
// the test is just ignored on stable and beta:
//@ ignore-stage1
//@ ignore-beta
//@ ignore-stable
#![feature(rustc_private)]
#![crate_type = "lib"]
extern crate rustc_errors;
extern crate rustc_fluent_macro;
extern crate rustc_macros;
extern crate rustc_session;
extern crate rustc_span;
extern crate core;
use rustc_errors::{Applicability, DiagMessage, SubdiagMessage};
use rustc_macros::Subdiagnostic;
use rustc_span::Span;
#[derive(Subdiagnostic)]
#[label("example message")]
struct A {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
enum B {
#[label("example message")]
A {
#[primary_span]
span: Span,
var: String,
},
#[label("example message")]
B {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
#[label("example message")]
//~^ ERROR label without `#[primary_span]` field
struct C {
var: String,
}
#[derive(Subdiagnostic)]
#[label]
//~^ ERROR diagnostic slug must be first argument
struct D {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[foo]
//~^ ERROR `#[foo]` is not a valid attribute
//~^^ ERROR cannot find attribute `foo` in this scope
struct E {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label = "..."]
//~^ ERROR `#[label = ...]` is not a valid attribute
struct F {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label(bug = "...")]
//~^ ERROR no nested attribute expected here
//~| ERROR diagnostic slug must be first argument
struct G {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label(slug = 4)]
//~^ ERROR no nested attribute expected here
//~| ERROR diagnostic slug must be first argument
struct J {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label(slug("..."))]
//~^ ERROR no nested attribute expected here
//~| ERROR diagnostic slug must be first argument
struct K {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label()]
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
struct M {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label("example message", code = "...")]
//~^ ERROR no nested attribute expected here
struct N {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label("example message", applicability = "machine-applicable")]
//~^ ERROR no nested attribute expected here
struct O {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[foo]
//~^ ERROR cannot find attribute `foo` in this scope
//~^^ ERROR unsupported type attribute for subdiagnostic enum
enum P {
#[label("example message")]
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum Q {
#[bar]
//~^ ERROR `#[bar]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum R {
#[bar = "..."]
//~^ ERROR `#[bar = ...]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum S {
#[bar = 4]
//~^ ERROR `#[bar = ...]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum T {
#[bar("...")]
//~^ ERROR `#[bar(...)]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum U {
#[label(code = "...")]
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
//~| ERROR no nested attribute expected here
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum V {
#[label("example message")]
A {
#[primary_span]
span: Span,
var: String,
},
B {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
#[label("example message")]
//~^ ERROR label without `#[primary_span]` field
struct W {
#[primary_span]
//~^ ERROR the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
span: String,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct X {
#[primary_span]
span: Span,
#[applicability]
//~^ ERROR `#[applicability]` is only valid on suggestions
applicability: Applicability,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct Y {
#[primary_span]
span: Span,
#[bar]
//~^ ERROR `#[bar]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
bar: String,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct Z {
#[primary_span]
span: Span,
#[bar = "..."]
//~^ ERROR `#[bar = ...]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
bar: String,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct AA {
#[primary_span]
span: Span,
#[bar("...")]
//~^ ERROR `#[bar(...)]` is not a valid attribute
//~^^ ERROR cannot find attribute `bar` in this scope
bar: String,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct AB {
#[primary_span]
span: Span,
#[skip_arg]
z: Z,
}
#[derive(Subdiagnostic)]
union AC {
//~^ ERROR unexpected unsupported untagged union
span: u32,
b: u64,
}
#[derive(Subdiagnostic)]
#[label("example message")]
#[label("example message")]
struct AD {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[label("example message", no_crate::example)]
//~^ ERROR a diagnostic slug must be the first argument to the attribute
struct AE {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct AF {
#[primary_span]
//~^ NOTE previously specified here
span_a: Span,
#[primary_span]
//~^ ERROR specified multiple times
span_b: Span,
}
#[derive(Subdiagnostic)]
struct AG {
//~^ ERROR subdiagnostic kind not specified
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...")]
struct AH {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
var: String,
}
#[derive(Subdiagnostic)]
enum AI {
#[suggestion("example message", code = "...")]
A {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
var: String,
},
#[suggestion("example message", code = "...")]
B {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
var: String,
},
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...", code = "...")]
//~^ ERROR specified multiple times
//~^^ NOTE previously specified here
struct AJ {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...")]
struct AK {
#[primary_span]
span: Span,
#[applicability]
//~^ NOTE previously specified here
applicability_a: Applicability,
#[applicability]
//~^ ERROR specified multiple times
applicability_b: Applicability,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...")]
struct AL {
#[primary_span]
span: Span,
#[applicability]
//~^ ERROR the `#[applicability]` attribute can only be applied to fields of type `Applicability`
applicability: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...")]
struct AM {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message")]
//~^ ERROR suggestion without `code = "..."`
struct AN {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...", applicability = "foo")]
//~^ ERROR invalid applicability
struct AO {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[help("example message")]
struct AP {
var: String,
}
#[derive(Subdiagnostic)]
#[note("example message")]
struct AQ;
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...")]
//~^ ERROR suggestion without `#[primary_span]` field
struct AR {
var: String,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "...", applicability = "machine-applicable")]
struct AS {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[label]
//~^ ERROR unsupported type attribute for subdiagnostic enum
enum AT {
#[label("example message")]
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
struct AU {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
//~^ ERROR `var` doesn't refer to a field on this type
struct AV {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
enum AW {
#[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
A {
#[primary_span]
span: Span,
var: String,
},
}
#[derive(Subdiagnostic)]
enum AX {
#[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
//~^ ERROR `var` doesn't refer to a field on this type
A {
#[primary_span]
span: Span,
},
}
#[derive(Subdiagnostic)]
#[warning("example message")]
struct AY {}
#[derive(Subdiagnostic)]
#[warning("example message")]
struct AZ {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", 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("example message", code = "...", applicability = "machine-applicable")]
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
//~| ERROR invalid nested attribute
struct BBa {
var: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message", applicability = "machine-applicable")]
struct BBb {
#[suggestion_part]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
span1: Span,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message", applicability = "machine-applicable")]
struct BBc {
#[suggestion_part()]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
span1: Span,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
//~^ 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("example message")]
struct BD {
#[suggestion_part]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
span1: Span,
#[suggestion_part()]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
span2: Span,
#[suggestion_part(foo = "bar")]
//~^ ERROR `code` is the only valid nested attribute
//~| ERROR expected `,`
span4: Span,
#[suggestion_part(code = "...")]
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
s1: String,
#[suggestion_part()]
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
s2: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message", applicability = "machine-applicable")]
struct BE {
#[suggestion_part(code = "...", code = ",,,")]
//~^ ERROR specified multiple times
//~| NOTE previously specified here
span: Span,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message", applicability = "machine-applicable")]
struct BF {
#[suggestion_part(code = "(")]
first: Span,
#[suggestion_part(code = ")")]
second: Span,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BG {
#[applicability]
appl: Applicability,
#[suggestion_part(code = "(")]
first: Span,
#[suggestion_part(code = ")")]
second: Span,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message", 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("example message", applicability = "machine-applicable")]
struct BI {
#[suggestion_part(code = "")]
spans: Vec<Span>,
}
#[derive(Subdiagnostic)]
#[label("example message")]
struct BJ {
#[primary_span]
span: Span,
r#type: String,
}
/// with a doc comment on the type..
#[derive(Subdiagnostic)]
#[label("example message")]
struct BK {
/// ..and the field
#[primary_span]
span: Span,
}
/// with a doc comment on the type..
#[derive(Subdiagnostic)]
enum BL {
/// ..and the variant..
#[label("example message")]
Foo {
/// ..and the field
#[primary_span]
span: Span,
},
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BM {
#[suggestion_part(code("foo"))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR unexpected token, expected `)`
span: Span,
r#type: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BN {
#[suggestion_part(code("foo", "bar"))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR unexpected token, expected `)`
span: Span,
r#type: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BO {
#[suggestion_part(code(3))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR unexpected token, expected `)`
span: Span,
r#type: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BP {
#[suggestion_part(code())]
//~^ ERROR expected exactly one string literal for `code = ...`
span: Span,
r#type: String,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion("example message")]
struct BQ {
#[suggestion_part(code = 3)]
//~^ ERROR expected string literal
span: Span,
r#type: String,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "")]
struct SuggestionStyleDefault {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "short")]
struct SuggestionStyleShort {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "hidden")]
struct SuggestionStyleHidden {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "verbose")]
struct SuggestionStyleVerbose {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "tool-only")]
struct SuggestionStyleToolOnly {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "hidden", style = "normal")]
//~^ ERROR specified multiple times
//~| NOTE previously specified here
struct SuggestionStyleTwice {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion_hidden("example message", code = "")]
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
struct SuggestionStyleOldSyntax {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion_hidden("example message", code = "", style = "normal")]
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
struct SuggestionStyleOldAndNewSyntax {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = "foo")]
//~^ ERROR invalid suggestion style
struct SuggestionStyleInvalid1 {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style = 42)]
//~^ ERROR expected string literal
struct SuggestionStyleInvalid2 {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style)]
//~^ ERROR a diagnostic slug must be the first argument to the attribute
struct SuggestionStyleInvalid3 {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "", style("foo"))]
//~^ ERROR expected `=`
struct SuggestionStyleInvalid4 {
#[primary_span]
sub: Span,
}
#[derive(Subdiagnostic)]
#[suggestion("example message", code = "")]
//~^ ERROR suggestion without `#[primary_span]` field
struct PrimarySpanOnVec {
#[primary_span]
//~^ ERROR `#[primary_span]` is not a valid attribute
//~| NOTE there must be exactly one primary span
sub: Vec<Span>,
}
#[derive(Subdiagnostic)]
struct NestedParent {
#[subdiagnostic]
single_sub: A,
#[subdiagnostic]
option_sub: Option<A>,
#[subdiagnostic]
vec_sub: Vec<A>,
}

View file

@ -0,0 +1,549 @@
error: derive(Diagnostic): label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive-inline.rs:50:1
|
LL | #[label("example message")]
| ^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:57:1
|
LL | #[label]
| ^
error: derive(Diagnostic): `#[foo]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:66:1
|
LL | #[foo]
| ^
error: derive(Diagnostic): `#[label = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:76:1
|
LL | #[label = "..."]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:85:9
|
LL | #[label(bug = "...")]
| ^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:85:1
|
LL | #[label(bug = "...")]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:95:9
|
LL | #[label(slug = 4)]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:95:1
|
LL | #[label(slug = 4)]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:105:9
|
LL | #[label(slug("..."))]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:105:1
|
LL | #[label(slug("..."))]
| ^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:115:1
|
LL | #[label()]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:124:28
|
LL | #[label("example message", code = "...")]
| ^^^^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:133:28
|
LL | #[label("example message", applicability = "machine-applicable")]
| ^^^^^^^^^^^^^
error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive-inline.rs:142:1
|
LL | #[foo]
| ^
error: derive(Diagnostic): `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:156:5
|
LL | #[bar]
| ^
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:168:5
|
LL | #[bar = "..."]
| ^
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:180:5
|
LL | #[bar = 4]
| ^
error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:192:5
|
LL | #[bar("...")]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive-inline.rs:204:13
|
LL | #[label(code = "...")]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive-inline.rs:204:5
|
LL | #[label(code = "...")]
| ^
error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive-inline.rs:233:5
|
LL | #[primary_span]
| ^
error: derive(Diagnostic): label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive-inline.rs:230:1
|
LL | #[label("example message")]
| ^
error: derive(Diagnostic): `#[applicability]` is only valid on suggestions
--> $DIR/subdiagnostic-derive-inline.rs:243:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:253:5
|
LL | #[bar]
| ^
|
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:264:5
|
LL | #[bar = "..."]
| ^
error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:275:5
|
LL | #[bar("...")]
| ^
|
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: unexpected unsupported untagged union
--> $DIR/subdiagnostic-derive-inline.rs:291:1
|
LL | / union AC {
LL | |
LL | | span: u32,
LL | | b: u64,
LL | | }
| |_^
error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive-inline.rs:306:28
|
LL | #[label("example message", no_crate::example)]
| ^^^^^^^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive-inline.rs:319:5
|
LL | #[primary_span]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive-inline.rs:316:5
|
LL | #[primary_span]
| ^
error: derive(Diagnostic): subdiagnostic kind not specified
--> $DIR/subdiagnostic-derive-inline.rs:325:8
|
LL | struct AG {
| ^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive-inline.rs:362:47
|
LL | #[suggestion("example message", code = "...", code = "...")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive-inline.rs:362:33
|
LL | #[suggestion("example message", code = "...", code = "...")]
| ^^^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive-inline.rs:380:5
|
LL | #[applicability]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive-inline.rs:377:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability`
--> $DIR/subdiagnostic-derive-inline.rs:390:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): suggestion without `code = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:403:1
|
LL | #[suggestion("example message")]
| ^
error: derive(Diagnostic): invalid applicability
--> $DIR/subdiagnostic-derive-inline.rs:413:63
|
LL | #[suggestion("example message", code = "...", applicability = "foo")]
| ^^^^^
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive-inline.rs:431:1
|
LL | #[suggestion("example message", code = "...")]
| ^
error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive-inline.rs:445:1
|
LL | #[label]
| ^
error: derive(Diagnostic): `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive-inline.rs:465:40
|
LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: derive(Diagnostic): `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive-inline.rs:484:44
|
LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:507:5
|
LL | #[suggestion_part]
| ^
|
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:510:5
|
LL | #[suggestion_part(code = "...")]
| ^
|
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive-inline.rs:504:1
|
LL | #[suggestion("example message", code = "...")]
| ^
error: derive(Diagnostic): invalid nested attribute
--> $DIR/subdiagnostic-derive-inline.rs:519:43
|
LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")]
| ^^^^
|
= help: only `style` and `applicability` are valid nested attributes
error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive-inline.rs:519:1
|
LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:529:5
|
LL | #[suggestion_part]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:537:5
|
LL | #[suggestion_part()]
| ^
error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:546:5
|
LL | #[primary_span]
| ^
|
= help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive-inline.rs:543:1
|
LL | #[multipart_suggestion("example message")]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:554:5
|
LL | #[suggestion_part]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:557:5
|
LL | #[suggestion_part()]
| ^
error: derive(Diagnostic): `code` is the only valid nested attribute
--> $DIR/subdiagnostic-derive-inline.rs:560:23
|
LL | #[suggestion_part(foo = "bar")]
| ^^^
error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive-inline.rs:564:5
|
LL | #[suggestion_part(code = "...")]
| ^
error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive-inline.rs:567:5
|
LL | #[suggestion_part()]
| ^
error: expected `,`
--> $DIR/subdiagnostic-derive-inline.rs:560:27
|
LL | #[suggestion_part(foo = "bar")]
| ^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive-inline.rs:575:37
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive-inline.rs:575:23
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
--> $DIR/subdiagnostic-derive-inline.rs:604:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive-inline.rs:652:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive-inline.rs:652:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive-inline.rs:662:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive-inline.rs:662:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive-inline.rs:672:28
|
LL | #[suggestion_part(code(3))]
| ^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive-inline.rs:672:28
|
LL | #[suggestion_part(code(3))]
| ^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive-inline.rs:682:28
|
LL | #[suggestion_part(code())]
| ^
error: expected string literal
--> $DIR/subdiagnostic-derive-inline.rs:691:30
|
LL | #[suggestion_part(code = 3)]
| ^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive-inline.rs:733:1
|
LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive-inline.rs:733:1
|
LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")]
| ^
error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:742:1
|
LL | #[suggestion_hidden("example message", code = "")]
| ^
|
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:750:1
|
LL | #[suggestion_hidden("example message", code = "", style = "normal")]
| ^
|
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: derive(Diagnostic): invalid suggestion style
--> $DIR/subdiagnostic-derive-inline.rs:758:52
|
LL | #[suggestion("example message", code = "", style = "foo")]
| ^^^^^
|
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
error: expected string literal
--> $DIR/subdiagnostic-derive-inline.rs:766:52
|
LL | #[suggestion("example message", code = "", style = 42)]
| ^^
error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive-inline.rs:774:44
|
LL | #[suggestion("example message", code = "", style)]
| ^^^^^
error: expected `=`
--> $DIR/subdiagnostic-derive-inline.rs:782:49
|
LL | #[suggestion("example message", code = "", style("foo"))]
| ^
error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive-inline.rs:793:5
|
LL | #[primary_span]
| ^
|
= note: there must be exactly one primary span
= help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive-inline.rs:790:1
|
LL | #[suggestion("example message", code = "")]
| ^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:66:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:142:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:156:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:168:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:180:7
|
LL | #[bar = 4]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:192:7
|
LL | #[bar("...")]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:253:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:264:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive-inline.rs:275:7
|
LL | #[bar("...")]
| ^^^
error: aborting due to 82 previous errors

View file

@ -93,15 +93,6 @@ struct G {
var: String,
}
#[derive(Subdiagnostic)]
#[label("...")]
//~^ ERROR expected identifier
struct H {
#[primary_span]
span: Span,
var: String,
}
#[derive(Subdiagnostic)]
#[label(slug = 4)]
//~^ ERROR no nested attribute expected here

View file

@ -34,116 +34,110 @@ error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(
LL | #[label(bug = "...")]
| ^
error: expected identifier
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:97:9
|
LL | #[label("...")]
| ^^^^^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:106:9
|
LL | #[label(slug = 4)]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:106:1
--> $DIR/subdiagnostic-derive.rs:97:1
|
LL | #[label(slug = 4)]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:116:9
--> $DIR/subdiagnostic-derive.rs:107:9
|
LL | #[label(slug("..."))]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:116:1
--> $DIR/subdiagnostic-derive.rs:107:1
|
LL | #[label(slug("..."))]
| ^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:126:1
--> $DIR/subdiagnostic-derive.rs:117:1
|
LL | #[label()]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:135:27
--> $DIR/subdiagnostic-derive.rs:126:27
|
LL | #[label(no_crate_example, code = "...")]
| ^^^^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:144:27
--> $DIR/subdiagnostic-derive.rs:135:27
|
LL | #[label(no_crate_example, applicability = "machine-applicable")]
| ^^^^^^^^^^^^^
error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive.rs:153:1
--> $DIR/subdiagnostic-derive.rs:144:1
|
LL | #[foo]
| ^
error: derive(Diagnostic): `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:167:5
--> $DIR/subdiagnostic-derive.rs:158:5
|
LL | #[bar]
| ^
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:179:5
--> $DIR/subdiagnostic-derive.rs:170:5
|
LL | #[bar = "..."]
| ^
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:191:5
--> $DIR/subdiagnostic-derive.rs:182:5
|
LL | #[bar = 4]
| ^
error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:203:5
--> $DIR/subdiagnostic-derive.rs:194:5
|
LL | #[bar("...")]
| ^
error: derive(Diagnostic): no nested attribute expected here
--> $DIR/subdiagnostic-derive.rs:215:13
--> $DIR/subdiagnostic-derive.rs:206:13
|
LL | #[label(code = "...")]
| ^^^^
error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:215:5
--> $DIR/subdiagnostic-derive.rs:206:5
|
LL | #[label(code = "...")]
| ^
error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:244:5
--> $DIR/subdiagnostic-derive.rs:235:5
|
LL | #[primary_span]
| ^
error: derive(Diagnostic): label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:241:1
--> $DIR/subdiagnostic-derive.rs:232:1
|
LL | #[label(no_crate_example)]
| ^
error: derive(Diagnostic): `#[applicability]` is only valid on suggestions
--> $DIR/subdiagnostic-derive.rs:254:5
--> $DIR/subdiagnostic-derive.rs:245:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:264:5
--> $DIR/subdiagnostic-derive.rs:255:5
|
LL | #[bar]
| ^
@ -151,13 +145,13 @@ LL | #[bar]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:275:5
--> $DIR/subdiagnostic-derive.rs:266:5
|
LL | #[bar = "..."]
| ^
error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:286:5
--> $DIR/subdiagnostic-derive.rs:277:5
|
LL | #[bar("...")]
| ^
@ -165,7 +159,7 @@ LL | #[bar("...")]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: unexpected unsupported untagged union
--> $DIR/subdiagnostic-derive.rs:302:1
--> $DIR/subdiagnostic-derive.rs:293:1
|
LL | / union AC {
LL | |
@ -175,97 +169,97 @@ LL | | }
| |_^
error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive.rs:317:27
--> $DIR/subdiagnostic-derive.rs:308:27
|
LL | #[label(no_crate_example, no_crate::example)]
| ^^^^^^^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive.rs:330:5
--> $DIR/subdiagnostic-derive.rs:321:5
|
LL | #[primary_span]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:327:5
--> $DIR/subdiagnostic-derive.rs:318:5
|
LL | #[primary_span]
| ^
error: derive(Diagnostic): subdiagnostic kind not specified
--> $DIR/subdiagnostic-derive.rs:336:8
--> $DIR/subdiagnostic-derive.rs:327:8
|
LL | struct AG {
| ^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive.rs:373:46
--> $DIR/subdiagnostic-derive.rs:364:46
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:373:32
--> $DIR/subdiagnostic-derive.rs:364:32
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
| ^^^^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive.rs:391:5
--> $DIR/subdiagnostic-derive.rs:382:5
|
LL | #[applicability]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:388:5
--> $DIR/subdiagnostic-derive.rs:379:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability`
--> $DIR/subdiagnostic-derive.rs:401:5
--> $DIR/subdiagnostic-derive.rs:392:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): suggestion without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:414:1
--> $DIR/subdiagnostic-derive.rs:405:1
|
LL | #[suggestion(no_crate_example)]
| ^
error: derive(Diagnostic): invalid applicability
--> $DIR/subdiagnostic-derive.rs:424:62
--> $DIR/subdiagnostic-derive.rs:415:62
|
LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")]
| ^^^^^
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:442:1
--> $DIR/subdiagnostic-derive.rs:433:1
|
LL | #[suggestion(no_crate_example, code = "...")]
| ^
error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive.rs:456:1
--> $DIR/subdiagnostic-derive.rs:447:1
|
LL | #[label]
| ^
error: derive(Diagnostic): `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:476:39
--> $DIR/subdiagnostic-derive.rs:467:39
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: derive(Diagnostic): `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:495:43
--> $DIR/subdiagnostic-derive.rs:486:43
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:518:5
--> $DIR/subdiagnostic-derive.rs:509:5
|
LL | #[suggestion_part]
| ^
@ -273,7 +267,7 @@ LL | #[suggestion_part]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:521:5
--> $DIR/subdiagnostic-derive.rs:512:5
|
LL | #[suggestion_part(code = "...")]
| ^
@ -281,13 +275,13 @@ LL | #[suggestion_part(code = "...")]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:515:1
--> $DIR/subdiagnostic-derive.rs:506:1
|
LL | #[suggestion(no_crate_example, code = "...")]
| ^
error: derive(Diagnostic): invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:530:42
--> $DIR/subdiagnostic-derive.rs:521:42
|
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
| ^^^^
@ -295,25 +289,25 @@ LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "mac
= help: only `style` and `applicability` are valid nested attributes
error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:530:1
--> $DIR/subdiagnostic-derive.rs:521:1
|
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:540:5
--> $DIR/subdiagnostic-derive.rs:531:5
|
LL | #[suggestion_part]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:548:5
--> $DIR/subdiagnostic-derive.rs:539:5
|
LL | #[suggestion_part()]
| ^
error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:557:5
--> $DIR/subdiagnostic-derive.rs:548:5
|
LL | #[primary_span]
| ^
@ -321,127 +315,127 @@ LL | #[primary_span]
= help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:554:1
--> $DIR/subdiagnostic-derive.rs:545:1
|
LL | #[multipart_suggestion(no_crate_example)]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:565:5
--> $DIR/subdiagnostic-derive.rs:556:5
|
LL | #[suggestion_part]
| ^
error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:568:5
--> $DIR/subdiagnostic-derive.rs:559:5
|
LL | #[suggestion_part()]
| ^
error: derive(Diagnostic): `code` is the only valid nested attribute
--> $DIR/subdiagnostic-derive.rs:571:23
--> $DIR/subdiagnostic-derive.rs:562:23
|
LL | #[suggestion_part(foo = "bar")]
| ^^^
error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:575:5
--> $DIR/subdiagnostic-derive.rs:566:5
|
LL | #[suggestion_part(code = "...")]
| ^
error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:578:5
--> $DIR/subdiagnostic-derive.rs:569:5
|
LL | #[suggestion_part()]
| ^
error: expected `,`
--> $DIR/subdiagnostic-derive.rs:571:27
--> $DIR/subdiagnostic-derive.rs:562:27
|
LL | #[suggestion_part(foo = "bar")]
| ^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive.rs:586:37
--> $DIR/subdiagnostic-derive.rs:577:37
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:586:23
--> $DIR/subdiagnostic-derive.rs:577:23
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
--> $DIR/subdiagnostic-derive.rs:615:5
--> $DIR/subdiagnostic-derive.rs:606:5
|
LL | #[applicability]
| ^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:663:28
--> $DIR/subdiagnostic-derive.rs:654:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive.rs:663:28
--> $DIR/subdiagnostic-derive.rs:654:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:673:28
--> $DIR/subdiagnostic-derive.rs:664:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive.rs:673:28
--> $DIR/subdiagnostic-derive.rs:664:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:683:28
--> $DIR/subdiagnostic-derive.rs:674:28
|
LL | #[suggestion_part(code(3))]
| ^
error: unexpected token, expected `)`
--> $DIR/subdiagnostic-derive.rs:683:28
--> $DIR/subdiagnostic-derive.rs:674:28
|
LL | #[suggestion_part(code(3))]
| ^
error: derive(Diagnostic): expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:693:28
--> $DIR/subdiagnostic-derive.rs:684:28
|
LL | #[suggestion_part(code())]
| ^
error: expected string literal
--> $DIR/subdiagnostic-derive.rs:702:30
--> $DIR/subdiagnostic-derive.rs:693:30
|
LL | #[suggestion_part(code = 3)]
| ^
error: derive(Diagnostic): attribute specified multiple times
--> $DIR/subdiagnostic-derive.rs:744:1
--> $DIR/subdiagnostic-derive.rs:735:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
| ^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:744:1
--> $DIR/subdiagnostic-derive.rs:735:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
| ^
error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:753:1
--> $DIR/subdiagnostic-derive.rs:744:1
|
LL | #[suggestion_hidden(no_crate_example, code = "")]
| ^
@ -449,7 +443,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:761:1
--> $DIR/subdiagnostic-derive.rs:752:1
|
LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
| ^
@ -457,7 +451,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: derive(Diagnostic): invalid suggestion style
--> $DIR/subdiagnostic-derive.rs:769:51
--> $DIR/subdiagnostic-derive.rs:760:51
|
LL | #[suggestion(no_crate_example, code = "", style = "foo")]
| ^^^^^
@ -465,25 +459,25 @@ LL | #[suggestion(no_crate_example, code = "", style = "foo")]
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
error: expected string literal
--> $DIR/subdiagnostic-derive.rs:777:51
--> $DIR/subdiagnostic-derive.rs:768:51
|
LL | #[suggestion(no_crate_example, code = "", style = 42)]
| ^^
error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive.rs:785:43
--> $DIR/subdiagnostic-derive.rs:776:43
|
LL | #[suggestion(no_crate_example, code = "", style)]
| ^^^^^
error: expected `=`
--> $DIR/subdiagnostic-derive.rs:793:48
--> $DIR/subdiagnostic-derive.rs:784:48
|
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
| ^
error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:804:5
--> $DIR/subdiagnostic-derive.rs:795:5
|
LL | #[primary_span]
| ^
@ -492,7 +486,7 @@ LL | #[primary_span]
= help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead
error: derive(Diagnostic): suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:801:1
--> $DIR/subdiagnostic-derive.rs:792:1
|
LL | #[suggestion(no_crate_example, code = "")]
| ^
@ -504,52 +498,52 @@ LL | #[foo]
| ^^^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:153:3
--> $DIR/subdiagnostic-derive.rs:144:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:167:7
--> $DIR/subdiagnostic-derive.rs:158:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:179:7
--> $DIR/subdiagnostic-derive.rs:170:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:191:7
--> $DIR/subdiagnostic-derive.rs:182:7
|
LL | #[bar = 4]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:203:7
--> $DIR/subdiagnostic-derive.rs:194:7
|
LL | #[bar("...")]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:264:7
--> $DIR/subdiagnostic-derive.rs:255:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:275:7
--> $DIR/subdiagnostic-derive.rs:266:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:286:7
--> $DIR/subdiagnostic-derive.rs:277:7
|
LL | #[bar("...")]
| ^^^
error: aborting due to 83 previous errors
error: aborting due to 82 previous errors