Remove #[suggestion_*] attributes
This commit is contained in:
parent
cd621be782
commit
2eeb7802b3
@ -12,7 +12,7 @@
|
||||
use syn::{MetaList, MetaNameValue, NestedMeta, Path};
|
||||
use synstructure::{BindingInfo, VariantInfo};
|
||||
|
||||
use super::error::invalid_nested_attr;
|
||||
use super::error::{invalid_attr, invalid_nested_attr};
|
||||
|
||||
thread_local! {
|
||||
pub static CODE_IDENT_COUNT: RefCell<u32> = RefCell::new(0);
|
||||
@ -496,6 +496,18 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for SuggestionKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
SuggestionKind::Normal => write!(f, "normal"),
|
||||
SuggestionKind::Short => write!(f, "short"),
|
||||
SuggestionKind::Hidden => write!(f, "hidden"),
|
||||
SuggestionKind::Verbose => write!(f, "verbose"),
|
||||
SuggestionKind::ToolOnly => write!(f, "tool-only"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SuggestionKind {
|
||||
pub fn to_suggestion_style(&self) -> TokenStream {
|
||||
match self {
|
||||
@ -577,21 +589,24 @@ pub(super) fn from_attr(
|
||||
|
||||
let meta = attr.parse_meta()?;
|
||||
|
||||
let mut opt_suggestion_kind = None;
|
||||
let mut kind = match name {
|
||||
"label" => SubdiagnosticKind::Label,
|
||||
"note" => SubdiagnosticKind::Note,
|
||||
"help" => SubdiagnosticKind::Help,
|
||||
"warning" => SubdiagnosticKind::Warn,
|
||||
_ => {
|
||||
// FIXME(#100717): remove #[suggestion_{short,verbose,hidden}] attributes, use
|
||||
// #[suggestion(style = "...")] instead
|
||||
// Recover old `#[(multipart_)suggestion_*]` syntaxes
|
||||
// FIXME(#100717): remove
|
||||
if let Some(suggestion_kind) =
|
||||
name.strip_prefix("suggestion").and_then(SuggestionKind::from_suffix)
|
||||
{
|
||||
if suggestion_kind != SuggestionKind::Normal {
|
||||
// Plain `#[suggestion]` can have a `style = "..."` attribute later, so don't set it here
|
||||
opt_suggestion_kind.set_once(suggestion_kind, attr.path.span().unwrap());
|
||||
invalid_attr(attr, &meta)
|
||||
.help(format!(
|
||||
r#"Use `#[suggestion(..., style = "{}")]` instead"#,
|
||||
suggestion_kind
|
||||
))
|
||||
.emit();
|
||||
}
|
||||
|
||||
SubdiagnosticKind::Suggestion {
|
||||
@ -604,8 +619,12 @@ pub(super) fn from_attr(
|
||||
name.strip_prefix("multipart_suggestion").and_then(SuggestionKind::from_suffix)
|
||||
{
|
||||
if suggestion_kind != SuggestionKind::Normal {
|
||||
// Plain `#[multipart_suggestion]` can have a `style = "..."` attribute later, so don't set it here
|
||||
opt_suggestion_kind.set_once(suggestion_kind, attr.path.span().unwrap());
|
||||
invalid_attr(attr, &meta)
|
||||
.help(format!(
|
||||
r#"Use `#[multipart_suggestion(..., style = "{}")]` instead"#,
|
||||
suggestion_kind
|
||||
))
|
||||
.emit();
|
||||
}
|
||||
|
||||
SubdiagnosticKind::MultipartSuggestion {
|
||||
@ -649,6 +668,7 @@ pub(super) fn from_attr(
|
||||
};
|
||||
|
||||
let mut code = None;
|
||||
let mut suggestion_kind = None;
|
||||
|
||||
let mut nested_iter = nested.into_iter().peekable();
|
||||
|
||||
@ -727,7 +747,7 @@ pub(super) fn from_attr(
|
||||
SuggestionKind::Normal
|
||||
});
|
||||
|
||||
opt_suggestion_kind.set_once(value, span);
|
||||
suggestion_kind.set_once(value, span);
|
||||
}
|
||||
|
||||
// Invalid nested attribute
|
||||
@ -753,11 +773,11 @@ pub(super) fn from_attr(
|
||||
SubdiagnosticKind::Suggestion {
|
||||
ref code_field,
|
||||
ref mut code_init,
|
||||
ref mut suggestion_kind,
|
||||
suggestion_kind: ref mut kind_field,
|
||||
..
|
||||
} => {
|
||||
if let Some(kind) = opt_suggestion_kind.value() {
|
||||
*suggestion_kind = kind;
|
||||
if let Some(kind) = suggestion_kind.value() {
|
||||
*kind_field = kind;
|
||||
}
|
||||
|
||||
*code_init = if let Some(init) = code.value() {
|
||||
@ -767,9 +787,11 @@ pub(super) fn from_attr(
|
||||
quote! { let #code_field = std::iter::empty(); }
|
||||
};
|
||||
}
|
||||
SubdiagnosticKind::MultipartSuggestion { ref mut suggestion_kind, .. } => {
|
||||
if let Some(kind) = opt_suggestion_kind.value() {
|
||||
*suggestion_kind = kind;
|
||||
SubdiagnosticKind::MultipartSuggestion {
|
||||
suggestion_kind: ref mut kind_field, ..
|
||||
} => {
|
||||
if let Some(kind) = suggestion_kind.value() {
|
||||
*kind_field = kind;
|
||||
}
|
||||
}
|
||||
SubdiagnosticKind::Label
|
||||
|
@ -211,9 +211,10 @@ struct LabelOnNonSpan {
|
||||
#[diag(compiletest_example, code = "E0123")]
|
||||
struct Suggest {
|
||||
#[suggestion(suggestion, code = "This is the suggested code")]
|
||||
#[suggestion_short(suggestion, code = "This is the suggested code")]
|
||||
#[suggestion_hidden(suggestion, code = "This is the suggested code")]
|
||||
#[suggestion_verbose(suggestion, code = "This is the suggested code")]
|
||||
#[suggestion(suggestion, code = "This is the suggested code", style = "normal")]
|
||||
#[suggestion(suggestion, code = "This is the suggested code", style = "short")]
|
||||
#[suggestion(suggestion, code = "This is the suggested code", style = "hidden")]
|
||||
#[suggestion(suggestion, code = "This is the suggested code", style = "verbose")]
|
||||
suggestion: (Span, Applicability),
|
||||
}
|
||||
|
||||
@ -730,7 +731,7 @@ struct SubdiagnosticEagerCorrect {
|
||||
// after the `span_suggestion` call - which breaks eager translation.
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_short(use_instead, applicability = "machine-applicable", code = "{correct}")]
|
||||
#[suggestion(use_instead, applicability = "machine-applicable", code = "{correct}")]
|
||||
pub(crate) struct SubdiagnosticWithSuggestion {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
|
@ -261,13 +261,13 @@ LL | #[label(label)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: suggestion without `code = "..."`
|
||||
--> $DIR/diagnostic-derive.rs:223:5
|
||||
--> $DIR/diagnostic-derive.rs:224:5
|
||||
|
|
||||
LL | #[suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[suggestion(nonsense = ...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:231:18
|
||||
--> $DIR/diagnostic-derive.rs:232:18
|
||||
|
|
||||
LL | #[suggestion(nonsense = "bar")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -275,13 +275,13 @@ LL | #[suggestion(nonsense = "bar")]
|
||||
= help: only `style`, `code` and `applicability` are valid nested attributes
|
||||
|
||||
error: suggestion without `code = "..."`
|
||||
--> $DIR/diagnostic-derive.rs:231:5
|
||||
--> $DIR/diagnostic-derive.rs:232:5
|
||||
|
|
||||
LL | #[suggestion(nonsense = "bar")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[suggestion(msg = ...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:240:18
|
||||
--> $DIR/diagnostic-derive.rs:241:18
|
||||
|
|
||||
LL | #[suggestion(msg = "bar")]
|
||||
| ^^^^^^^^^^^
|
||||
@ -289,13 +289,13 @@ LL | #[suggestion(msg = "bar")]
|
||||
= help: only `style`, `code` and `applicability` are valid nested attributes
|
||||
|
||||
error: suggestion without `code = "..."`
|
||||
--> $DIR/diagnostic-derive.rs:240:5
|
||||
--> $DIR/diagnostic-derive.rs:241:5
|
||||
|
|
||||
LL | #[suggestion(msg = "bar")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: wrong field type for suggestion
|
||||
--> $DIR/diagnostic-derive.rs:263:5
|
||||
--> $DIR/diagnostic-derive.rs:264:5
|
||||
|
|
||||
LL | / #[suggestion(suggestion, code = "This is suggested code")]
|
||||
LL | |
|
||||
@ -305,55 +305,55 @@ LL | | suggestion: Applicability,
|
||||
= help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/diagnostic-derive.rs:279:24
|
||||
--> $DIR/diagnostic-derive.rs:280:24
|
||||
|
|
||||
LL | suggestion: (Span, Span, Applicability),
|
||||
| ^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/diagnostic-derive.rs:279:18
|
||||
--> $DIR/diagnostic-derive.rs:280:18
|
||||
|
|
||||
LL | suggestion: (Span, Span, Applicability),
|
||||
| ^^^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/diagnostic-derive.rs:287:33
|
||||
--> $DIR/diagnostic-derive.rs:288:33
|
||||
|
|
||||
LL | suggestion: (Applicability, Applicability, Span),
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/diagnostic-derive.rs:287:18
|
||||
--> $DIR/diagnostic-derive.rs:288:18
|
||||
|
|
||||
LL | suggestion: (Applicability, Applicability, Span),
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: `#[label = ...]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:294:5
|
||||
--> $DIR/diagnostic-derive.rs:295:5
|
||||
|
|
||||
LL | #[label = "bar"]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/diagnostic-derive.rs:445:44
|
||||
--> $DIR/diagnostic-derive.rs:446:44
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/diagnostic-derive.rs:447:24
|
||||
--> $DIR/diagnostic-derive.rs:448:24
|
||||
|
|
||||
LL | suggestion: (Span, Applicability),
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: invalid applicability
|
||||
--> $DIR/diagnostic-derive.rs:453:44
|
||||
--> $DIR/diagnostic-derive.rs:454:44
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", applicability = "batman")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[label(foo)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:516:20
|
||||
--> $DIR/diagnostic-derive.rs:517:20
|
||||
|
|
||||
LL | #[label(label, foo)]
|
||||
| ^^^
|
||||
@ -361,19 +361,19 @@ LL | #[label(label, foo)]
|
||||
= help: a diagnostic slug must be the first argument to the attribute
|
||||
|
||||
error: `#[label(foo = ...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:524:20
|
||||
--> $DIR/diagnostic-derive.rs:525:20
|
||||
|
|
||||
LL | #[label(label, foo = "...")]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: `#[label(foo(...))]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:532:20
|
||||
--> $DIR/diagnostic-derive.rs:533:20
|
||||
|
|
||||
LL | #[label(label, foo("..."))]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: `#[primary_span]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:544:5
|
||||
--> $DIR/diagnostic-derive.rs:545: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:564:1
|
||||
--> $DIR/diagnostic-derive.rs:565:1
|
||||
|
|
||||
LL | #[error(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:564:1
|
||||
--> $DIR/diagnostic-derive.rs:565: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:571:1
|
||||
--> $DIR/diagnostic-derive.rs:572:1
|
||||
|
|
||||
LL | #[warn_(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:571:1
|
||||
--> $DIR/diagnostic-derive.rs:572: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:578:1
|
||||
--> $DIR/diagnostic-derive.rs:579:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:578:1
|
||||
--> $DIR/diagnostic-derive.rs:579: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:585:1
|
||||
--> $DIR/diagnostic-derive.rs:586:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[lint(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:585:1
|
||||
--> $DIR/diagnostic-derive.rs:586:1
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: diagnostic slug not specified
|
||||
--> $DIR/diagnostic-derive.rs:585:1
|
||||
--> $DIR/diagnostic-derive.rs:586: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:595:44
|
||||
--> $DIR/diagnostic-derive.rs:596:44
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/diagnostic-derive.rs:595:30
|
||||
--> $DIR/diagnostic-derive.rs:596:30
|
||||
|
|
||||
LL | #[suggestion(suggestion, code = "...", code = ",,,")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: wrong types for suggestion
|
||||
--> $DIR/diagnostic-derive.rs:604:24
|
||||
--> $DIR/diagnostic-derive.rs:605: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:612:17
|
||||
--> $DIR/diagnostic-derive.rs:613: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:619:5
|
||||
--> $DIR/diagnostic-derive.rs:620:5
|
||||
|
|
||||
LL | #[suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[multipart_suggestion(...)]` is not a valid attribute
|
||||
--> $DIR/diagnostic-derive.rs:626:1
|
||||
--> $DIR/diagnostic-derive.rs:627: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:629:1
|
||||
--> $DIR/diagnostic-derive.rs:630: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:633:5
|
||||
--> $DIR/diagnostic-derive.rs:634: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:641:1
|
||||
--> $DIR/diagnostic-derive.rs:642: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:650:1
|
||||
--> $DIR/diagnostic-derive.rs:651: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:684:21
|
||||
--> $DIR/diagnostic-derive.rs:685: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:692:5
|
||||
--> $DIR/diagnostic-derive.rs:693: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:700:5
|
||||
--> $DIR/diagnostic-derive.rs:701: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:708:21
|
||||
--> $DIR/diagnostic-derive.rs:709: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:716:5
|
||||
--> $DIR/diagnostic-derive.rs:717: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:774:18
|
||||
--> $DIR/diagnostic-derive.rs:775:18
|
||||
|
|
||||
LL | #[suggestion(code())]
|
||||
| ^^^^^^
|
||||
|
||||
error: `code(...)` must contain only string literals
|
||||
--> $DIR/diagnostic-derive.rs:782:23
|
||||
--> $DIR/diagnostic-derive.rs:783:23
|
||||
|
|
||||
LL | #[suggestion(code(foo))]
|
||||
| ^^^
|
||||
|
||||
error: `code = "..."`/`code(...)` must contain only string literals
|
||||
--> $DIR/diagnostic-derive.rs:790:18
|
||||
--> $DIR/diagnostic-derive.rs:791:18
|
||||
|
|
||||
LL | #[suggestion(code = 3)]
|
||||
| ^^^^^^^^
|
||||
@ -604,43 +604,43 @@ LL | #[nonsense]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot find attribute `error` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:564:3
|
||||
--> $DIR/diagnostic-derive.rs:565:3
|
||||
|
|
||||
LL | #[error(compiletest_example, code = "E0123")]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find attribute `warn_` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:571:3
|
||||
--> $DIR/diagnostic-derive.rs:572:3
|
||||
|
|
||||
LL | #[warn_(compiletest_example, code = "E0123")]
|
||||
| ^^^^^ help: a built-in attribute with a similar name exists: `warn`
|
||||
|
||||
error: cannot find attribute `lint` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:578:3
|
||||
--> $DIR/diagnostic-derive.rs:579:3
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^ help: a built-in attribute with a similar name exists: `link`
|
||||
|
||||
error: cannot find attribute `lint` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:585:3
|
||||
--> $DIR/diagnostic-derive.rs:586:3
|
||||
|
|
||||
LL | #[lint(compiletest_example, code = "E0123")]
|
||||
| ^^^^ help: a built-in attribute with a similar name exists: `link`
|
||||
|
||||
error: cannot find attribute `multipart_suggestion` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:626:3
|
||||
--> $DIR/diagnostic-derive.rs:627:3
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `multipart_suggestion` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:629:3
|
||||
--> $DIR/diagnostic-derive.rs:630:3
|
||||
|
|
||||
LL | #[multipart_suggestion()]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `multipart_suggestion` in this scope
|
||||
--> $DIR/diagnostic-derive.rs:633:7
|
||||
--> $DIR/diagnostic-derive.rs:634:7
|
||||
|
|
||||
LL | #[multipart_suggestion(suggestion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -652,7 +652,7 @@ LL | #[diag(nonsense, code = "E0123")]
|
||||
| ^^^^^^^^ not found in `rustc_errors::fluent`
|
||||
|
||||
error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
|
||||
--> $DIR/diagnostic-derive.rs:338:10
|
||||
--> $DIR/diagnostic-derive.rs:339:10
|
||||
|
|
||||
LL | #[derive(Diagnostic)]
|
||||
| ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
|
||||
|
@ -751,11 +751,18 @@ struct SuggestionStyleTwice {
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_hidden(parser_add_paren, code = "")]
|
||||
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
||||
struct SuggestionStyleOldSyntax {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion_hidden(parser_add_paren, code = "", style = "normal")]
|
||||
//~^ ERROR specified multiple times
|
||||
//~| NOTE previously specified here
|
||||
struct SuggestionStyleTwiceExplicit {
|
||||
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
||||
struct SuggestionStyleOldAndNewSyntax {
|
||||
#[primary_span]
|
||||
sub: Span,
|
||||
}
|
||||
|
@ -457,20 +457,24 @@ note: previously specified here
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = "hidden", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: specified multiple times
|
||||
--> $DIR/subdiagnostic-derive.rs:755:50
|
||||
error: `#[suggestion_hidden(...)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:755:1
|
||||
|
|
||||
LL | #[suggestion_hidden(parser_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")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: previously specified here
|
||||
--> $DIR/subdiagnostic-derive.rs:755:3
|
||||
|
|
||||
LL | #[suggestion_hidden(parser_add_paren, code = "", style = "normal")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= help: Use `#[suggestion(..., style = "hidden")]` instead
|
||||
|
||||
error: invalid suggestion style
|
||||
--> $DIR/subdiagnostic-derive.rs:764:51
|
||||
--> $DIR/subdiagnostic-derive.rs:771:51
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = "foo")]
|
||||
| ^^^^^
|
||||
@ -478,13 +482,13 @@ LL | #[suggestion(parser_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:772:43
|
||||
--> $DIR/subdiagnostic-derive.rs:779:43
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style = 42)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: `#[suggestion(style)]` is not a valid attribute
|
||||
--> $DIR/subdiagnostic-derive.rs:780:43
|
||||
--> $DIR/subdiagnostic-derive.rs:787:43
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style)]
|
||||
| ^^^^^
|
||||
@ -492,7 +496,7 @@ LL | #[suggestion(parser_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:788:43
|
||||
--> $DIR/subdiagnostic-derive.rs:795:43
|
||||
|
|
||||
LL | #[suggestion(parser_add_paren, code = "", style("foo"))]
|
||||
| ^^^^^^^^^^^^
|
||||
@ -557,6 +561,6 @@ error[E0425]: cannot find value `slug` in module `rustc_errors::fluent`
|
||||
LL | #[label(slug)]
|
||||
| ^^^^ not found in `rustc_errors::fluent`
|
||||
|
||||
error: aborting due to 78 previous errors
|
||||
error: aborting due to 79 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
Loading…
Reference in New Issue
Block a user