mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rustfmt diagnostic derive tests
This commit is contained in:
parent
368c4a35b9
commit
29334b951a
@ -536,8 +536,7 @@ struct LabelWithTrailingList {
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(compiletest_example)]
|
||||
struct LintsGood {
|
||||
}
|
||||
struct LintsGood {}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(compiletest_example)]
|
||||
@ -731,11 +730,7 @@ struct SubdiagnosticEagerCorrect {
|
||||
// after the `span_suggestion` call - which breaks eager translation.
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_short(
|
||||
use_instead,
|
||||
applicability = "machine-applicable",
|
||||
code = "{correct}"
|
||||
)]
|
||||
#[suggestion_short(use_instead, applicability = "machine-applicable", code = "{correct}")]
|
||||
pub(crate) struct SubdiagnosticWithSuggestion {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
|
@ -373,7 +373,7 @@ LL | #[label(label, foo("..."))]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: `#[primary_span]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:545:5
|
||||
--> $DIR/diagnostic-derive.rs:544:5
|
||||
|
|
||||
LL | #[primary_span]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -381,13 +381,13 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:564:1
|
||||
|
|
||||
LL | #[error(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:565:1
|
||||
--> $DIR/diagnostic-derive.rs:564:1
|
||||
|
|
||||
LL | / #[error(compiletest_example, code = "E0123")]
|
||||
LL | |
|
||||
@ -399,13 +399,13 @@ LL | | struct ErrorAttribute {}
|
||||
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
|
||||
|
||||
error: `#[warn_(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:572:1
|
||||
--> $DIR/diagnostic-derive.rs:571:1
|
||||
|
|
||||
LL | #[warn_(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:572:1
|
||||
--> $DIR/diagnostic-derive.rs:571:1
|
||||
|
|
||||
LL | / #[warn_(compiletest_example, code = "E0123")]
|
||||
LL | |
|
||||
@ -417,13 +417,13 @@ LL | | struct WarnAttribute {}
|
||||
= 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
|
||||
--> $DIR/diagnostic-derive.rs:578:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:579:1
|
||||
--> $DIR/diagnostic-derive.rs:578:1
|
||||
|
|
||||
LL | / #[lint(compiletest_example, code = "E0123")]
|
||||
LL | |
|
||||
@ -435,19 +435,19 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:585:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[lint(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:586:1
|
||||
--> $DIR/diagnostic-derive.rs:585:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:586:1
|
||||
--> $DIR/diagnostic-derive.rs:585:1
|
||||
|
|
||||
LL | / #[lint(compiletest_example, code = "E0123")]
|
||||
LL | |
|
||||
@ -460,19 +460,19 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:595:44
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/diagnostic-derive.rs:596:30
|
||||
--> $DIR/diagnostic-derive.rs:595:30
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: wrong types for suggestion
|
||||
--> $DIR/diagnostic-derive.rs:605:24
|
||||
--> $DIR/diagnostic-derive.rs:604:24
|
||||
|
|
||||
LL | suggestion: (Span, usize),
|
||||
| ^^^^^
|
||||
@ -480,7 +480,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:612:17
|
||||
|
|
||||
LL | suggestion: (Span,),
|
||||
| ^^^^^^^
|
||||
@ -488,13 +488,13 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:619:5
|
||||
|
|
||||
LL | #[suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[multipart_suggestion(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:627:1
|
||||
--> $DIR/diagnostic-derive.rs:626:1
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -502,7 +502,7 @@ LL | #[multipart_suggestion(suggestion)]
|
||||
= help: consider creating a `Subdiagnostic` instead
|
||||
|
||||
error: `#[multipart_suggestion(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:630:1
|
||||
--> $DIR/diagnostic-derive.rs:629:1
|
||||
|
|
||||
LL | #[multipart_suggestion()]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -510,7 +510,7 @@ LL | #[multipart_suggestion()]
|
||||
= help: consider creating a `Subdiagnostic` instead
|
||||
|
||||
error: `#[multipart_suggestion(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:634:5
|
||||
--> $DIR/diagnostic-derive.rs:633:5
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -518,7 +518,7 @@ LL | #[multipart_suggestion(suggestion)]
|
||||
= help: consider creating a `Subdiagnostic` instead
|
||||
|
||||
error: `#[suggestion(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:642:1
|
||||
--> $DIR/diagnostic-derive.rs:641:1
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -526,7 +526,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:650:1
|
||||
|
|
||||
LL | #[label]
|
||||
| ^^^^^^^^
|
||||
@ -534,7 +534,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:684:21
|
||||
|
|
||||
LL | #[subdiagnostic(bad)]
|
||||
| ^^^
|
||||
@ -542,7 +542,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:692:5
|
||||
|
|
||||
LL | #[subdiagnostic = "bad"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -550,7 +550,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:700:5
|
||||
|
|
||||
LL | #[subdiagnostic(bad, bad)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -558,7 +558,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:708:21
|
||||
|
|
||||
LL | #[subdiagnostic("bad")]
|
||||
| ^^^^^
|
||||
@ -566,7 +566,7 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:716:5
|
||||
|
|
||||
LL | #[subdiagnostic(eager)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -574,19 +574,19 @@ 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
|
||||
--> $DIR/diagnostic-derive.rs:774:18
|
||||
|
|
||||
LL | #[suggestion(code())]
|
||||
| ^^^^^^
|
||||
|
||||
error: `code(...)` must contain only string literals
|
||||
--> $DIR/diagnostic-derive.rs:787:23
|
||||
--> $DIR/diagnostic-derive.rs:782:23
|
||||
|
|
||||
LL | #[suggestion(code(foo))]
|
||||
| ^^^
|
||||
|
||||
error: `code = "..."`/`code(...)` must contain only string literals
|
||||
--> $DIR/diagnostic-derive.rs:795:18
|
||||
--> $DIR/diagnostic-derive.rs:790:18
|
||||
|
|
||||
LL | #[suggestion(code = 3)]
|
||||
| ^^^^^^^^
|
||||
@ -604,43 +604,43 @@ LL | #[nonsense]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot find attribute `error` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:565:3
|
||||
--> $DIR/diagnostic-derive.rs:564:3
|
||||
|
|
||||
LL | #[error(compiletest_example, code = "E0123")]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find attribute `warn_` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:572:3
|
||||
--> $DIR/diagnostic-derive.rs:571: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
|
||||
--> $DIR/diagnostic-derive.rs:578: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
|
||||
--> $DIR/diagnostic-derive.rs:585: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
|
||||
--> $DIR/diagnostic-derive.rs:626:3
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `multipart_suggestion` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:630:3
|
||||
--> $DIR/diagnostic-derive.rs:629:3
|
||||
|
|
||||
LL | #[multipart_suggestion()]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `multipart_suggestion` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:634:7
|
||||
--> $DIR/diagnostic-derive.rs:633:7
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -11,13 +11,13 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
extern crate rustc_errors;
|
||||
extern crate rustc_macros;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
extern crate rustc_macros;
|
||||
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_span::Span;
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::Span;
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
@ -40,7 +40,7 @@ enum B {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -165,7 +165,7 @@ enum P {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -177,7 +177,7 @@ enum Q {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -189,7 +189,7 @@ enum R {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -201,7 +201,7 @@ enum S {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -213,7 +213,7 @@ enum T {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -225,7 +225,7 @@ enum U {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -240,7 +240,7 @@ enum V {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -301,14 +301,14 @@ struct AB {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[skip_arg]
|
||||
z: Z
|
||||
z: Z,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
union AC {
|
||||
//~^ ERROR unexpected unsupported untagged union
|
||||
span: u32,
|
||||
b: u64
|
||||
b: u64,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -372,7 +372,7 @@ enum AI {
|
||||
#[applicability]
|
||||
applicability: Applicability,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -437,7 +437,7 @@ struct AO {
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(parser_add_paren)]
|
||||
struct AP {
|
||||
var: String
|
||||
var: String,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -467,7 +467,7 @@ enum AT {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -493,7 +493,7 @@ enum AW {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -503,7 +503,7 @@ enum AX {
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
@ -659,7 +659,7 @@ enum BL {
|
||||
/// ..and the field
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
|
@ -186,7 +186,7 @@ error: unexpected unsupported untagged union
|
||||
LL | / union AC {
|
||||
LL | |
|
||||
LL | | span: u32,
|
||||
LL | | b: u64
|
||||
LL | | b: u64,
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
@ -253,7 +253,7 @@ LL | #[suggestion(parser_add_paren)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid applicability
|
||||
--> $DIR/subdiagnostic-derive.rs:430:45
|
||||
--> $DIR/subdiagnostic-derive.rs:430:46
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "...", applicability = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -275,13 +275,13 @@ LL | #[label]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `var` doesn't refer to a field on this type
|
||||
--> $DIR/subdiagnostic-derive.rs:482:38
|
||||
--> $DIR/subdiagnostic-derive.rs:482:39
|
||||
|
|
||||
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
|
||||
--> $DIR/subdiagnostic-derive.rs:501:43
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
| ^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user