mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Fix tests
This commit is contained in:
parent
fe212eca76
commit
d494502f64
@ -165,40 +165,48 @@ impl<'a> LintDiagnosticDerive<'a> {
|
||||
fn make_check(slug: &syn::Path) -> TokenStream {
|
||||
quote! {
|
||||
const _: () = {
|
||||
let krate = env!("CARGO_MANIFEST_DIR").as_bytes();
|
||||
const krate_str: &str = match option_env!("CARGO_CRATE_NAME") {
|
||||
Some(c) => c,
|
||||
None => "",
|
||||
};
|
||||
const krate: &[u8] = krate_str.as_bytes();
|
||||
|
||||
let mut start = 0;
|
||||
while !(krate[start] == b'r'
|
||||
&& krate[start + 1] == b'u'
|
||||
&& krate[start + 2] == b's'
|
||||
&& krate[start + 3] == b't'
|
||||
&& krate[start + 4] == b'c'
|
||||
&& krate[start + 5] == b'_')
|
||||
if krate.len() > 6
|
||||
&& krate[0] == b'r'
|
||||
&& krate[1] == b'u'
|
||||
&& krate[2] == b's'
|
||||
&& krate[3] == b't'
|
||||
&& krate[4] == b'c'
|
||||
&& krate[5] == b'_'
|
||||
{
|
||||
if krate.len() == start + 5 {
|
||||
panic!(concat!("crate does not contain \"rustc_\": ", env!("CARGO_MANIFEST_DIR")));
|
||||
}
|
||||
start += 1;
|
||||
}
|
||||
start += 6;
|
||||
let slug = stringify!(#slug).as_bytes();
|
||||
|
||||
let slug = stringify!(#slug).as_bytes();
|
||||
|
||||
let mut pos = 0;
|
||||
loop {
|
||||
let b = slug[pos];
|
||||
if krate.len() == start + pos {
|
||||
if b != b'_' {
|
||||
panic!(concat!("slug \"", stringify!(#slug), "\" does not match the crate (", env!("CARGO_MANIFEST_DIR") ,") it is in"));
|
||||
let mut pos = 0;
|
||||
loop {
|
||||
let b = slug[pos];
|
||||
if krate.len() == pos + 6 {
|
||||
if b != b'_' {
|
||||
panic!(concat!(
|
||||
"slug \"",
|
||||
stringify!(#slug),
|
||||
"\" does not match the crate it is in"
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break
|
||||
}
|
||||
let a = krate[start+pos];
|
||||
let a = krate[pos + 6];
|
||||
|
||||
if a != b {
|
||||
panic!(concat!("slug \"", stringify!(#slug), "\" does not match the crate (", env!("CARGO_MANIFEST_DIR") ,") it is in"));
|
||||
if a != b {
|
||||
panic!(concat!(
|
||||
"slug \"",
|
||||
stringify!(#slug),
|
||||
"\" does not match the crate it is in"
|
||||
));
|
||||
}
|
||||
pos += 1;
|
||||
}
|
||||
pos += 1;
|
||||
} else {
|
||||
// Crate does not start with "rustc_"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ struct NoApplicability {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(parser_add_paren)]
|
||||
#[note(parse_add_paren)]
|
||||
struct Note;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
@ -20,7 +20,7 @@ use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::Span;
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -29,13 +29,13 @@ struct A {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
enum B {
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
var: String,
|
||||
},
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
B {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -44,7 +44,7 @@ enum B {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
//~^ ERROR label without `#[primary_span]` field
|
||||
struct C {
|
||||
var: String,
|
||||
@ -138,7 +138,7 @@ struct M {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren, code = "...")]
|
||||
#[label(parse_add_paren, code = "...")]
|
||||
//~^ ERROR `#[label(code = ...)]` is not a valid attribute
|
||||
struct N {
|
||||
#[primary_span]
|
||||
@ -147,7 +147,7 @@ struct N {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[label(parse_add_paren, applicability = "machine-applicable")]
|
||||
//~^ ERROR `#[label(applicability = ...)]` is not a valid attribute
|
||||
struct O {
|
||||
#[primary_span]
|
||||
@ -160,7 +160,7 @@ struct O {
|
||||
//~^ ERROR cannot find attribute `foo` in this scope
|
||||
//~^^ ERROR unsupported type attribute for subdiagnostic enum
|
||||
enum P {
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -230,7 +230,7 @@ enum U {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
enum V {
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -244,7 +244,7 @@ enum V {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
//~^ ERROR label without `#[primary_span]` field
|
||||
struct W {
|
||||
#[primary_span]
|
||||
@ -253,7 +253,7 @@ struct W {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct X {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -263,7 +263,7 @@ struct X {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct Y {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -274,7 +274,7 @@ struct Y {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct Z {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -285,7 +285,7 @@ struct Z {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct AA {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -296,7 +296,7 @@ struct AA {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct AB {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -312,23 +312,23 @@ union AC {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct AD {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren, parser_add_paren)]
|
||||
//~^ ERROR `#[label(parser_add_paren)]` is not a valid attribute
|
||||
#[label(parse_add_paren, parse_add_paren)]
|
||||
//~^ ERROR `#[label(parse_add_paren)]` is not a valid attribute
|
||||
struct AE {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct AF {
|
||||
#[primary_span]
|
||||
//~^ NOTE previously specified here
|
||||
@ -346,7 +346,7 @@ struct AG {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
struct AH {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -357,7 +357,7 @@ struct AH {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
enum AI {
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -365,7 +365,7 @@ enum AI {
|
||||
applicability: Applicability,
|
||||
var: String,
|
||||
},
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
B {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -376,7 +376,7 @@ enum AI {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...", code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...", code = "...")]
|
||||
//~^ ERROR specified multiple times
|
||||
//~^^ NOTE previously specified here
|
||||
struct AJ {
|
||||
@ -387,7 +387,7 @@ struct AJ {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
struct AK {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -400,7 +400,7 @@ struct AK {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
struct AL {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -410,14 +410,14 @@ struct AL {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
struct AM {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren)]
|
||||
#[suggestion(parse_add_paren)]
|
||||
//~^ ERROR suggestion without `code = "..."`
|
||||
struct AN {
|
||||
#[primary_span]
|
||||
@ -427,7 +427,7 @@ struct AN {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...", applicability = "foo")]
|
||||
#[suggestion(parse_add_paren, code = "...", applicability = "foo")]
|
||||
//~^ ERROR invalid applicability
|
||||
struct AO {
|
||||
#[primary_span]
|
||||
@ -435,24 +435,24 @@ struct AO {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(parser_add_paren)]
|
||||
#[help(parse_add_paren)]
|
||||
struct AP {
|
||||
var: String,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(parser_add_paren)]
|
||||
#[note(parse_add_paren)]
|
||||
struct AQ;
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
//~^ ERROR suggestion without `#[primary_span]` field
|
||||
struct AR {
|
||||
var: String,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
#[suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
struct AS {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -462,7 +462,7 @@ struct AS {
|
||||
#[label]
|
||||
//~^ ERROR unsupported type attribute for subdiagnostic enum
|
||||
enum AT {
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -471,7 +471,7 @@ enum AT {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
struct AU {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -479,7 +479,7 @@ struct AU {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
//~^ ERROR `var` doesn't refer to a field on this type
|
||||
struct AV {
|
||||
#[primary_span]
|
||||
@ -488,7 +488,7 @@ struct AV {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
enum AW {
|
||||
#[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
A {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -498,7 +498,7 @@ enum AW {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
enum AX {
|
||||
#[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
//~^ ERROR `var` doesn't refer to a field on this type
|
||||
A {
|
||||
#[primary_span]
|
||||
@ -507,18 +507,18 @@ enum AX {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[warning(parser_add_paren)]
|
||||
#[warning(parse_add_paren)]
|
||||
struct AY {}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[warning(parser_add_paren)]
|
||||
#[warning(parse_add_paren)]
|
||||
struct AZ {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "...")]
|
||||
#[suggestion(parse_add_paren, code = "...")]
|
||||
//~^ ERROR suggestion without `#[primary_span]` field
|
||||
struct BA {
|
||||
#[suggestion_part]
|
||||
@ -533,7 +533,7 @@ struct BA {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_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 {
|
||||
@ -541,7 +541,7 @@ struct BBa {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BBb {
|
||||
#[suggestion_part]
|
||||
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
|
||||
@ -549,7 +549,7 @@ struct BBb {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BBc {
|
||||
#[suggestion_part()]
|
||||
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
|
||||
@ -557,7 +557,7 @@ struct BBc {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
|
||||
struct BC {
|
||||
#[primary_span]
|
||||
@ -566,7 +566,7 @@ struct BC {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BD {
|
||||
#[suggestion_part]
|
||||
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
|
||||
@ -586,7 +586,7 @@ struct BD {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BE {
|
||||
#[suggestion_part(code = "...", code = ",,,")]
|
||||
//~^ ERROR specified multiple times
|
||||
@ -595,7 +595,7 @@ struct BE {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BF {
|
||||
#[suggestion_part(code = "(")]
|
||||
first: Span,
|
||||
@ -604,7 +604,7 @@ struct BF {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BG {
|
||||
#[applicability]
|
||||
appl: Applicability,
|
||||
@ -615,7 +615,7 @@ struct BG {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BH {
|
||||
#[applicability]
|
||||
//~^ ERROR `#[applicability]` has no effect
|
||||
@ -627,14 +627,14 @@ struct BH {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
|
||||
#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
|
||||
struct BI {
|
||||
#[suggestion_part(code = "")]
|
||||
spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct BJ {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -643,7 +643,7 @@ struct BJ {
|
||||
|
||||
/// with a doc comment on the type..
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
struct BK {
|
||||
/// ..and the field
|
||||
#[primary_span]
|
||||
@ -654,7 +654,7 @@ struct BK {
|
||||
#[derive(Subdiagnostic)]
|
||||
enum BL {
|
||||
/// ..and the variant..
|
||||
#[label(parser_add_paren)]
|
||||
#[label(parse_add_paren)]
|
||||
Foo {
|
||||
/// ..and the field
|
||||
#[primary_span]
|
||||
@ -663,7 +663,7 @@ enum BL {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BM {
|
||||
#[suggestion_part(code("foo"))]
|
||||
//~^ ERROR expected exactly one string literal for `code = ...`
|
||||
@ -672,7 +672,7 @@ struct BM {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BN {
|
||||
#[suggestion_part(code("foo", "bar"))]
|
||||
//~^ ERROR expected exactly one string literal for `code = ...`
|
||||
@ -681,7 +681,7 @@ struct BN {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BO {
|
||||
#[suggestion_part(code(3))]
|
||||
//~^ ERROR expected exactly one string literal for `code = ...`
|
||||
@ -690,7 +690,7 @@ struct BO {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BP {
|
||||
#[suggestion_part(code())]
|
||||
//~^ ERROR expected exactly one string literal for `code = ...`
|
||||
@ -699,7 +699,7 @@ struct BP {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parser_add_paren)]
|
||||
#[multipart_suggestion(parse_add_paren)]
|
||||
struct BQ {
|
||||
#[suggestion_part(code = 3)]
|
||||
//~^ ERROR `code = "..."`/`code(...)` must contain only string literals
|
||||
@ -708,42 +708,42 @@ struct BQ {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "")]
|
||||
#[suggestion(parse_add_paren, code = "")]
|
||||
struct SuggestionStyleDefault {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "short")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "short")]
|
||||
struct SuggestionStyleShort {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "hidden")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "hidden")]
|
||||
struct SuggestionStyleHidden {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "verbose")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "verbose")]
|
||||
struct SuggestionStyleVerbose {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "tool-only")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "tool-only")]
|
||||
struct SuggestionStyleToolOnly {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
//~^ ERROR specified multiple times
|
||||
//~| NOTE previously specified here
|
||||
struct SuggestionStyleTwice {
|
||||
@ -752,7 +752,7 @@ struct SuggestionStyleTwice {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_hidden(parser_add_paren, code = "")]
|
||||
#[suggestion_hidden(parse_add_paren, code = "")]
|
||||
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
||||
struct SuggestionStyleOldSyntax {
|
||||
#[primary_span]
|
||||
@ -760,7 +760,7 @@ struct SuggestionStyleOldSyntax {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_hidden(parser_add_paren, code = "", style = "normal")]
|
||||
#[suggestion_hidden(parse_add_paren, code = "", style = "normal")]
|
||||
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
||||
struct SuggestionStyleOldAndNewSyntax {
|
||||
#[primary_span]
|
||||
@ -768,7 +768,7 @@ struct SuggestionStyleOldAndNewSyntax {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = "foo")]
|
||||
#[suggestion(parse_add_paren, code = "", style = "foo")]
|
||||
//~^ ERROR invalid suggestion style
|
||||
struct SuggestionStyleInvalid1 {
|
||||
#[primary_span]
|
||||
@ -776,7 +776,7 @@ struct SuggestionStyleInvalid1 {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style = 42)]
|
||||
#[suggestion(parse_add_paren, code = "", style = 42)]
|
||||
//~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute
|
||||
struct SuggestionStyleInvalid2 {
|
||||
#[primary_span]
|
||||
@ -784,7 +784,7 @@ struct SuggestionStyleInvalid2 {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style)]
|
||||
#[suggestion(parse_add_paren, code = "", style)]
|
||||
//~^ ERROR `#[suggestion(style)]` is not a valid attribute
|
||||
struct SuggestionStyleInvalid3 {
|
||||
#[primary_span]
|
||||
@ -792,7 +792,7 @@ struct SuggestionStyleInvalid3 {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(parser_add_paren, code = "", style("foo"))]
|
||||
#[suggestion(parse_add_paren, code = "", style("foo"))]
|
||||
//~^ ERROR `#[suggestion(style(...))]` is not a valid attribute
|
||||
struct SuggestionStyleInvalid4 {
|
||||
#[primary_span]
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: label without `#[primary_span]` field
|
||||
--> $DIR/subdiagnostic-derive.rs:47:1
|
||||
|
|
||||
LL | / #[label(parser_add_paren)]
|
||||
LL | / #[label(parse_add_paren)]
|
||||
LL | |
|
||||
LL | | struct C {
|
||||
LL | | var: String,
|
||||
@ -81,16 +81,16 @@ LL | #[label()]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: `#[label(code = ...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:141:27
|
||||
--> $DIR/subdiagnostic-derive.rs:141:26
|
||||
|
|
||||
LL | #[label(parser_add_paren, code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | #[label(parse_add_paren, code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: `#[label(applicability = ...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:150:27
|
||||
--> $DIR/subdiagnostic-derive.rs:150:26
|
||||
|
|
||||
LL | #[label(parser_add_paren, applicability = "machine-applicable")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[label(parse_add_paren, applicability = "machine-applicable")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unsupported type attribute for subdiagnostic enum
|
||||
--> $DIR/subdiagnostic-derive.rs:159:1
|
||||
@ -143,7 +143,7 @@ LL | #[primary_span]
|
||||
error: label without `#[primary_span]` field
|
||||
--> $DIR/subdiagnostic-derive.rs:247:1
|
||||
|
|
||||
LL | / #[label(parser_add_paren)]
|
||||
LL | / #[label(parse_add_paren)]
|
||||
LL | |
|
||||
LL | | struct W {
|
||||
LL | | #[primary_span]
|
||||
@ -190,11 +190,11 @@ LL | | b: u64,
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: `#[label(parser_add_paren)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:323:27
|
||||
error: `#[label(parse_add_paren)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:323:26
|
||||
|
|
||||
LL | #[label(parser_add_paren, parser_add_paren)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[label(parse_add_paren, parse_add_paren)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: a diagnostic slug must be the first argument to the attribute
|
||||
|
||||
@ -217,16 +217,16 @@ LL | struct AG {
|
||||
| ^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/subdiagnostic-derive.rs:379:46
|
||||
--> $DIR/subdiagnostic-derive.rs:379:45
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "...", code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/subdiagnostic-derive.rs:379:32
|
||||
--> $DIR/subdiagnostic-derive.rs:379:31
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "...", code = "...")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/subdiagnostic-derive.rs:397:5
|
||||
@ -249,19 +249,19 @@ LL | #[applicability]
|
||||
error: suggestion without `code = "..."`
|
||||
--> $DIR/subdiagnostic-derive.rs:420:1
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid applicability
|
||||
--> $DIR/subdiagnostic-derive.rs:430:46
|
||||
--> $DIR/subdiagnostic-derive.rs:430:45
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "...", applicability = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_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(parse_add_paren, code = "...")]
|
||||
LL | |
|
||||
LL | | struct AR {
|
||||
LL | | var: String,
|
||||
@ -275,16 +275,16 @@ LL | #[label]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `var` doesn't refer to a field on this type
|
||||
--> $DIR/subdiagnostic-derive.rs:482:39
|
||||
--> $DIR/subdiagnostic-derive.rs:482:38
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
| ^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
| ^^^^^^^
|
||||
|
||||
error: `var` doesn't refer to a field on this type
|
||||
--> $DIR/subdiagnostic-derive.rs:501:43
|
||||
--> $DIR/subdiagnostic-derive.rs:501:42
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
| ^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
|
||||
| ^^^^^^^
|
||||
|
||||
error: `#[suggestion_part]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:524:5
|
||||
@ -305,7 +305,7 @@ LL | #[suggestion_part(code = "...")]
|
||||
error: suggestion without `#[primary_span]` field
|
||||
--> $DIR/subdiagnostic-derive.rs:521:1
|
||||
|
|
||||
LL | / #[suggestion(parser_add_paren, code = "...")]
|
||||
LL | / #[suggestion(parse_add_paren, code = "...")]
|
||||
LL | |
|
||||
LL | | struct BA {
|
||||
LL | | #[suggestion_part]
|
||||
@ -315,17 +315,17 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: `#[multipart_suggestion(code = ...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:536:42
|
||||
--> $DIR/subdiagnostic-derive.rs:536:41
|
||||
|
|
||||
LL | #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: only `style` and `applicability` are valid nested attributes
|
||||
|
||||
error: multipart suggestion without any `#[suggestion_part(...)]` fields
|
||||
--> $DIR/subdiagnostic-derive.rs:536:1
|
||||
|
|
||||
LL | / #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
LL | / #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | struct BBa {
|
||||
@ -356,7 +356,7 @@ LL | #[primary_span]
|
||||
error: multipart suggestion without any `#[suggestion_part(...)]` fields
|
||||
--> $DIR/subdiagnostic-derive.rs:560:1
|
||||
|
|
||||
LL | / #[multipart_suggestion(parser_add_paren)]
|
||||
LL | / #[multipart_suggestion(parse_add_paren)]
|
||||
LL | |
|
||||
LL | | struct BC {
|
||||
LL | | #[primary_span]
|
||||
@ -446,60 +446,60 @@ LL | #[suggestion_part(code = 3)]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/subdiagnostic-derive.rs:746:61
|
||||
--> $DIR/subdiagnostic-derive.rs:746:60
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/subdiagnostic-derive.rs:746:43
|
||||
--> $DIR/subdiagnostic-derive.rs:746:42
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[suggestion_hidden(...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:755:1
|
||||
|
|
||||
LL | #[suggestion_hidden(parser_add_paren, code = "")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion_hidden(parse_add_paren, code = "")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: Use `#[suggestion(..., style = "hidden")]` instead
|
||||
|
||||
error: `#[suggestion_hidden(...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:763:1
|
||||
|
|
||||
LL | #[suggestion_hidden(parser_add_paren, code = "", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[suggestion_hidden(parse_add_paren, code = "", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: Use `#[suggestion(..., style = "hidden")]` instead
|
||||
|
||||
error: invalid suggestion style
|
||||
--> $DIR/subdiagnostic-derive.rs:771:51
|
||||
--> $DIR/subdiagnostic-derive.rs:771:50
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = "foo")]
|
||||
| ^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style = "foo")]
|
||||
| ^^^^^
|
||||
|
|
||||
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
|
||||
|
||||
error: `#[suggestion(style = ...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:779:43
|
||||
--> $DIR/subdiagnostic-derive.rs:779:42
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = 42)]
|
||||
| ^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style = 42)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: `#[suggestion(style)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:787:43
|
||||
--> $DIR/subdiagnostic-derive.rs:787:42
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style)]
|
||||
| ^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style)]
|
||||
| ^^^^^
|
||||
|
|
||||
= help: a diagnostic slug must be the first argument to the attribute
|
||||
|
||||
error: `#[suggestion(style(...))]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:795:43
|
||||
--> $DIR/subdiagnostic-derive.rs:795:42
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style("foo"))]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | #[suggestion(parse_add_paren, code = "", style("foo"))]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `foo` in this scope
|
||||
--> $DIR/subdiagnostic-derive.rs:63:3
|
||||
|
Loading…
Reference in New Issue
Block a user