1use std::borrow::Cow;
2
3use rustc_ast::ast;
4use rustc_errors::codes::*;
5use rustc_hir::limit::Limit;
6use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
7use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol};
8
9#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
CfgAttrNoAttributes {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
CfgAttrNoAttributes => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[cfg_attr]` does not expand to any attributes")));
;
diag
}
};
}
}
};LintDiagnostic)]
10#[diag("`#[cfg_attr]` does not expand to any attributes")]
11pub(crate) struct CfgAttrNoAttributes;
12
13#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NoSyntaxVarsExprRepeat where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
NoSyntaxVarsExprRepeat {
span: __binding_0,
typo_repeatable: __binding_1,
typo_unrepeatable: __binding_2,
typo_unrepeatable_label: __binding_3,
var_no_typo: __binding_4,
no_repeatable_var: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempted to repeat an expression containing no syntax variables matched as repeating at this depth")));
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
if let Some(__binding_3) = __binding_3 {
diag.subdiagnostic(__binding_3);
}
if let Some(__binding_4) = __binding_4 {
diag.subdiagnostic(__binding_4);
}
if let Some(__binding_5) = __binding_5 {
diag.subdiagnostic(__binding_5);
}
diag
}
}
}
}
};Diagnostic)]
14#[diag(
15 "attempted to repeat an expression containing no syntax variables matched as repeating at this depth"
16)]
17pub(crate) struct NoSyntaxVarsExprRepeat {
18 #[primary_span]
19 pub span: Span,
20 #[subdiagnostic]
21 pub typo_repeatable: Option<VarTypoSuggestionRepeatable>,
22 #[subdiagnostic]
23 pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>,
24 #[subdiagnostic]
25 pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>,
26 #[subdiagnostic]
27 pub var_no_typo: Option<VarNoTypo>,
28 #[subdiagnostic]
29 pub no_repeatable_var: Option<NoRepeatableVar>,
30}
31
32#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for VarTypoSuggestionRepeatable {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
VarTypoSuggestionRepeatable {
span: __binding_0, name: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_0 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
});
suggestions.push((__binding_0, __code_0));
diag.store_args();
diag.arg("name", __binding_1);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there's a macro metavariable with a similar name")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
33#[multipart_suggestion(
34 "there's a macro metavariable with a similar name",
35 applicability = "maybe-incorrect",
36 style = "verbose"
37)]
38pub(crate) struct VarTypoSuggestionRepeatable {
39 #[suggestion_part(code = "{name}")]
40 pub span: Span,
41 pub name: Symbol,
42}
43
44#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for VarTypoSuggestionUnrepeatable {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
VarTypoSuggestionUnrepeatable { span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument not found")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
45#[label("argument not found")]
46pub(crate) struct VarTypoSuggestionUnrepeatable {
47 #[primary_span]
48 pub span: Span,
49}
50
51#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for
VarTypoSuggestionUnrepeatableLabel {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
VarTypoSuggestionUnrepeatableLabel { span: __binding_0 } =>
{
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this similarly named macro metavariable is unrepeatable")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
52#[label("this similarly named macro metavariable is unrepeatable")]
53pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
54 #[primary_span]
55 pub span: Span,
56}
57
58#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for VarNoTypo {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
VarNoTypo { span: __binding_0, msg: __binding_1 } => {
diag.store_args();
diag.arg("msg", __binding_1);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a repeatable metavariable: {$msg}")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
59#[label("expected a repeatable metavariable: {$msg}")]
60pub(crate) struct VarNoTypo {
61 #[primary_span]
62 pub span: Span,
63 pub msg: String,
64}
65
66#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for NoRepeatableVar {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
NoRepeatableVar { span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this macro metavariable is not repeatable and there are no other repeatable metavariables")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
67#[label(
68 "this macro metavariable is not repeatable and there are no other repeatable metavariables"
69)]
70pub(crate) struct NoRepeatableVar {
71 #[primary_span]
72 pub span: Span,
73}
74
75#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MustRepeatOnce
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MustRepeatOnce { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this must repeat at least once")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
76#[diag("this must repeat at least once")]
77pub(crate) struct MustRepeatOnce {
78 #[primary_span]
79 pub span: Span,
80}
81
82#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CountRepetitionMisplaced where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
CountRepetitionMisplaced { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`count` can not be placed inside the innermost repetition")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
83#[diag("`count` can not be placed inside the innermost repetition")]
84pub(crate) struct CountRepetitionMisplaced {
85 #[primary_span]
86 pub span: Span,
87}
88
89#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MacroVarStillRepeating where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MacroVarStillRepeating {
span: __binding_0, ident: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$ident}` is still repeating at this depth")));
;
diag.arg("ident", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
90#[diag("variable `{$ident}` is still repeating at this depth")]
91pub(crate) struct MacroVarStillRepeating {
92 #[primary_span]
93 pub span: Span,
94 pub ident: MacroRulesNormalizedIdent,
95}
96
97#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
MetaVarStillRepeatingLint {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
MetaVarStillRepeatingLint {
label: __binding_0, ident: __binding_1 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$ident}` is still repeating at this depth")));
;
diag.arg("ident", __binding_1);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected repetition")));
diag
}
};
}
}
};LintDiagnostic)]
98#[diag("variable `{$ident}` is still repeating at this depth")]
99pub(crate) struct MetaVarStillRepeatingLint {
100 #[label("expected repetition")]
101 pub label: Span,
102 pub ident: MacroRulesNormalizedIdent,
103}
104
105#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
MetaVariableWrongOperator {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
MetaVariableWrongOperator {
binder: __binding_0, occurrence: __binding_1 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("meta-variable repeats with different Kleene operator")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected repetition")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting repetition")));
diag
}
};
}
}
};LintDiagnostic)]
106#[diag("meta-variable repeats with different Kleene operator")]
107pub(crate) struct MetaVariableWrongOperator {
108 #[label("expected repetition")]
109 pub binder: Span,
110 #[label("conflicting repetition")]
111 pub occurrence: Span,
112}
113
114#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MetaVarsDifSeqMatchers where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MetaVarsDifSeqMatchers { span: __binding_0, msg: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$msg}")));
;
diag.arg("msg", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
115#[diag("{$msg}")]
116pub(crate) struct MetaVarsDifSeqMatchers {
117 #[primary_span]
118 pub span: Span,
119 pub msg: String,
120}
121
122#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnknownMacroVariable {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnknownMacroVariable { name: __binding_0 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown macro variable `{$name}`")));
;
diag.arg("name", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
123#[diag("unknown macro variable `{$name}`")]
124pub(crate) struct UnknownMacroVariable {
125 pub name: MacroRulesNormalizedIdent,
126}
127
128#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ResolveRelativePath where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ResolveRelativePath { span: __binding_0, path: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot resolve relative path in non-file source `{$path}`")));
;
diag.arg("path", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
129#[diag("cannot resolve relative path in non-file source `{$path}`")]
130pub(crate) struct ResolveRelativePath {
131 #[primary_span]
132 pub span: Span,
133 pub path: String,
134}
135
136#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MacroBodyStability where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MacroBodyStability {
span: __binding_0, head_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macros cannot have body stability attributes")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid body stability attribute")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("body stability attribute affects this macro")));
diag
}
}
}
}
};Diagnostic)]
137#[diag("macros cannot have body stability attributes")]
138pub(crate) struct MacroBodyStability {
139 #[primary_span]
140 #[label("invalid body stability attribute")]
141 pub span: Span,
142 #[label("body stability attribute affects this macro")]
143 pub head_span: Span,
144}
145
146#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
FeatureRemoved<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
FeatureRemoved {
span: __binding_0,
reason: __binding_1,
removed_rustc_version: __binding_2,
pull_note: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature has been removed")));
diag.code(E0557);
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("removed in {$removed_rustc_version}{$pull_note}")));
;
diag.arg("removed_rustc_version", __binding_2);
diag.arg("pull_note", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature has been removed")));
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
147#[diag("feature has been removed", code = E0557)]
148#[note("removed in {$removed_rustc_version}{$pull_note}")]
149pub(crate) struct FeatureRemoved<'a> {
150 #[primary_span]
151 #[label("feature has been removed")]
152 pub span: Span,
153 #[subdiagnostic]
154 pub reason: Option<FeatureRemovedReason<'a>>,
155 pub removed_rustc_version: &'a str,
156 pub pull_note: String,
157}
158
159#[derive(const _: () =
{
impl<'a> rustc_errors::Subdiagnostic for FeatureRemovedReason<'a> {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
FeatureRemovedReason { reason: __binding_0 } => {
diag.store_args();
diag.arg("reason", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$reason}")));
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
160#[note("{$reason}")]
161pub(crate) struct FeatureRemovedReason<'a> {
162 pub reason: &'a str,
163}
164
165#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
FeatureNotAllowed where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
FeatureNotAllowed { span: __binding_0, name: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$name}` is not in the list of allowed features")));
diag.code(E0725);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
166#[diag("the feature `{$name}` is not in the list of allowed features", code = E0725)]
167pub(crate) struct FeatureNotAllowed {
168 #[primary_span]
169 pub span: Span,
170 pub name: Symbol,
171}
172
173#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RecursionLimitReached where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
RecursionLimitReached {
span: __binding_0,
descr: __binding_1,
suggested_limit: __binding_2,
crate_name: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("recursion limit reached while expanding `{$descr}`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)")));
;
diag.arg("descr", __binding_1);
diag.arg("suggested_limit", __binding_2);
diag.arg("crate_name", __binding_3);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
174#[diag("recursion limit reached while expanding `{$descr}`")]
175#[help(
176 "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)"
177)]
178pub(crate) struct RecursionLimitReached {
179 #[primary_span]
180 pub span: Span,
181 pub descr: String,
182 pub suggested_limit: Limit,
183 pub crate_name: Symbol,
184}
185
186#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MalformedFeatureAttribute where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MalformedFeatureAttribute {
span: __binding_0, help: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `feature` attribute input")));
diag.code(E0556);
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
187#[diag("malformed `feature` attribute input", code = E0556)]
188pub(crate) struct MalformedFeatureAttribute {
189 #[primary_span]
190 pub span: Span,
191 #[subdiagnostic]
192 pub help: MalformedFeatureAttributeHelp,
193}
194
195#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MalformedFeatureAttributeHelp {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
MalformedFeatureAttributeHelp::Label { span: __binding_0 }
=> {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected just one word")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
MalformedFeatureAttributeHelp::Suggestion {
span: __binding_0, suggestion: __binding_1 } => {
let __code_1 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
diag.store_args();
diag.arg("suggestion", __binding_1);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected just one word")));
diag.span_suggestions_with_style(__binding_0, __message,
__code_1, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
196pub(crate) enum MalformedFeatureAttributeHelp {
197 #[label("expected just one word")]
198 Label {
199 #[primary_span]
200 span: Span,
201 },
202 #[suggestion(
203 "expected just one word",
204 code = "{suggestion}",
205 applicability = "maybe-incorrect"
206 )]
207 Suggestion {
208 #[primary_span]
209 span: Span,
210 suggestion: Symbol,
211 },
212}
213
214#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RemoveExprNotSupported where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
RemoveExprNotSupported { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("removing an expression is not supported in this position")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
215#[diag("removing an expression is not supported in this position")]
216pub(crate) struct RemoveExprNotSupported {
217 #[primary_span]
218 pub span: Span,
219}
220
221#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidCfg
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
InvalidCfg::NotFollowedByParens { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg` is not followed by parentheses")));
let __code_2 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("cfg(/* predicate */)"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected syntax is")),
__code_2, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
InvalidCfg::NoPredicate { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg` predicate is not specified")));
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("cfg(/* predicate */)"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected syntax is")),
__code_3, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
InvalidCfg::MultiplePredicates { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `cfg` predicates are specified")));
;
diag.span(__binding_0);
diag
}
InvalidCfg::PredicateLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg` predicate key cannot be a literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
222pub(crate) enum InvalidCfg {
223 #[diag("`cfg` is not followed by parentheses")]
224 NotFollowedByParens {
225 #[primary_span]
226 #[suggestion(
227 "expected syntax is",
228 code = "cfg(/* predicate */)",
229 applicability = "has-placeholders"
230 )]
231 span: Span,
232 },
233 #[diag("`cfg` predicate is not specified")]
234 NoPredicate {
235 #[primary_span]
236 #[suggestion(
237 "expected syntax is",
238 code = "cfg(/* predicate */)",
239 applicability = "has-placeholders"
240 )]
241 span: Span,
242 },
243 #[diag("multiple `cfg` predicates are specified")]
244 MultiplePredicates {
245 #[primary_span]
246 span: Span,
247 },
248 #[diag("`cfg` predicate key cannot be a literal")]
249 PredicateLiteral {
250 #[primary_span]
251 span: Span,
252 },
253}
254
255#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
WrongFragmentKind<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
WrongFragmentKind {
span: __binding_0, kind: __binding_1, name: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-{$kind} macro in {$kind} position: {$name}")));
;
diag.arg("kind", __binding_1);
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
256#[diag("non-{$kind} macro in {$kind} position: {$name}")]
257pub(crate) struct WrongFragmentKind<'a> {
258 #[primary_span]
259 pub span: Span,
260 pub kind: &'a str,
261 pub name: &'a ast::Path,
262}
263
264#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnsupportedKeyValue where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
UnsupportedKeyValue { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("key-value macro attributes are not supported")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
265#[diag("key-value macro attributes are not supported")]
266pub(crate) struct UnsupportedKeyValue {
267 #[primary_span]
268 pub span: Span,
269}
270
271#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
IncompleteParse<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
IncompleteParse {
span: __binding_0,
descr: __binding_1,
label_span: __binding_2,
macro_path: __binding_3,
kind_name: __binding_4,
expands_to_match_arm: __binding_5,
add_semicolon: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro expansion ignores {$descr} and any tokens following")));
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(";"))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")));
;
diag.arg("descr", __binding_1);
diag.arg("macro_path", __binding_3);
diag.arg("kind_name", __binding_4);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("caused by the macro expansion here")));
if __binding_5 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macros cannot expand to match arms")));
}
if let Some(__binding_6) = __binding_6 {
diag.span_suggestions_with_style(__binding_6,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might be missing a semicolon here")),
__code_4, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
}
diag
}
}
}
}
};Diagnostic)]
272#[diag("macro expansion ignores {$descr} and any tokens following")]
273#[note("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")]
274pub(crate) struct IncompleteParse<'a> {
275 #[primary_span]
276 pub span: Span,
277 pub descr: String,
278 #[label("caused by the macro expansion here")]
279 pub label_span: Span,
280 pub macro_path: &'a ast::Path,
281 pub kind_name: &'a str,
282 #[note("macros cannot expand to match arms")]
283 pub expands_to_match_arm: bool,
284
285 #[suggestion(
286 "you might be missing a semicolon here",
287 style = "verbose",
288 code = ";",
289 applicability = "maybe-incorrect"
290 )]
291 pub add_semicolon: Option<Span>,
292}
293
294#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RemoveNodeNotSupported where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
RemoveNodeNotSupported {
span: __binding_0, descr: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("removing {$descr} is not supported in this position")));
;
diag.arg("descr", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
295#[diag("removing {$descr} is not supported in this position")]
296pub(crate) struct RemoveNodeNotSupported {
297 #[primary_span]
298 pub span: Span,
299 pub descr: &'static str,
300}
301
302#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ModuleCircular
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ModuleCircular { span: __binding_0, modules: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("circular modules: {$modules}")));
;
diag.arg("modules", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
303#[diag("circular modules: {$modules}")]
304pub(crate) struct ModuleCircular {
305 #[primary_span]
306 pub span: Span,
307 pub modules: String,
308}
309
310#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ModuleInBlock
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ModuleInBlock { span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot declare a file module inside a block unless it has a path attribute")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file modules are usually placed outside of blocks, at the top level of the file")));
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
311#[diag("cannot declare a file module inside a block unless it has a path attribute")]
312#[note("file modules are usually placed outside of blocks, at the top level of the file")]
313pub(crate) struct ModuleInBlock {
314 #[primary_span]
315 pub span: Span,
316 #[subdiagnostic]
317 pub name: Option<ModuleInBlockName>,
318}
319
320#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ModuleInBlockName {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
ModuleInBlockName { span: __binding_0, name: __binding_1 }
=> {
diag.store_args();
diag.arg("name", __binding_1);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maybe `use` the module `{$name}` instead of redeclaring it")));
diag.span_help(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
321#[help("maybe `use` the module `{$name}` instead of redeclaring it")]
322pub(crate) struct ModuleInBlockName {
323 #[primary_span]
324 pub span: Span,
325 pub name: Ident,
326}
327
328#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ModuleFileNotFound where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ModuleFileNotFound {
span: __binding_0,
name: __binding_1,
default_path: __binding_2,
secondary_path: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file not found for module `{$name}`")));
diag.code(E0583);
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead")));
;
diag.arg("name", __binding_1);
diag.arg("default_path", __binding_2);
diag.arg("secondary_path", __binding_3);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
329#[diag("file not found for module `{$name}`", code = E0583)]
330#[help("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")]
331#[note(
332 "if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead"
333)]
334pub(crate) struct ModuleFileNotFound {
335 #[primary_span]
336 pub span: Span,
337 pub name: Ident,
338 pub default_path: String,
339 pub secondary_path: String,
340}
341
342#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ModuleMultipleCandidates where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ModuleMultipleCandidates {
span: __binding_0,
name: __binding_1,
default_path: __binding_2,
secondary_path: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"")));
diag.code(E0761);
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("delete or rename one of them to remove the ambiguity")));
;
diag.arg("name", __binding_1);
diag.arg("default_path", __binding_2);
diag.arg("secondary_path", __binding_3);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
343#[diag("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"", code = E0761)]
344#[help("delete or rename one of them to remove the ambiguity")]
345pub(crate) struct ModuleMultipleCandidates {
346 #[primary_span]
347 pub span: Span,
348 pub name: Ident,
349 pub default_path: String,
350 pub secondary_path: String,
351}
352
353#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for TraceMacro
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
TraceMacro { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trace_macro")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
354#[diag("trace_macro")]
355pub(crate) struct TraceMacro {
356 #[primary_span]
357 pub span: Span,
358}
359
360#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ProcMacroPanicked where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ProcMacroPanicked { span: __binding_0, message: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc macro panicked")));
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
361#[diag("proc macro panicked")]
362pub(crate) struct ProcMacroPanicked {
363 #[primary_span]
364 pub span: Span,
365 #[subdiagnostic]
366 pub message: Option<ProcMacroPanickedHelp>,
367}
368
369#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ProcMacroPanickedHelp {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
ProcMacroPanickedHelp { message: __binding_0 } => {
diag.store_args();
diag.arg("message", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")));
diag.help(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
370#[help("message: {$message}")]
371pub(crate) struct ProcMacroPanickedHelp {
372 pub message: String,
373}
374
375#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ProcMacroDerivePanicked where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ProcMacroDerivePanicked {
span: __binding_0, message: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc-macro derive panicked")));
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
376#[diag("proc-macro derive panicked")]
377pub(crate) struct ProcMacroDerivePanicked {
378 #[primary_span]
379 pub span: Span,
380 #[subdiagnostic]
381 pub message: Option<ProcMacroDerivePanickedHelp>,
382}
383
384#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ProcMacroDerivePanickedHelp {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
ProcMacroDerivePanickedHelp { message: __binding_0 } => {
diag.store_args();
diag.arg("message", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")));
diag.help(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
385#[help("message: {$message}")]
386pub(crate) struct ProcMacroDerivePanickedHelp {
387 pub message: String,
388}
389
390#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CustomAttributePanicked where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
CustomAttributePanicked {
span: __binding_0, message: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("custom attribute panicked")));
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
391#[diag("custom attribute panicked")]
392pub(crate) struct CustomAttributePanicked {
393 #[primary_span]
394 pub span: Span,
395 #[subdiagnostic]
396 pub message: Option<CustomAttributePanickedHelp>,
397}
398
399#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CustomAttributePanickedHelp {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
CustomAttributePanickedHelp { message: __binding_0 } => {
diag.store_args();
diag.arg("message", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")));
diag.help(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
400#[help("message: {$message}")]
401pub(crate) struct CustomAttributePanickedHelp {
402 pub message: String,
403}
404
405#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ProcMacroDeriveTokens where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ProcMacroDeriveTokens { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc-macro derive produced unparsable tokens")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
406#[diag("proc-macro derive produced unparsable tokens")]
407pub(crate) struct ProcMacroDeriveTokens {
408 #[primary_span]
409 pub span: Span,
410}
411
412#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DuplicateMatcherBinding where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
DuplicateMatcherBinding {
span: __binding_0, prev: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate matcher binding")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate binding")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous binding")));
diag
}
}
}
}
};Diagnostic)]
413#[diag("duplicate matcher binding")]
414pub(crate) struct DuplicateMatcherBinding {
415 #[primary_span]
416 #[label("duplicate binding")]
417 pub span: Span,
418 #[label("previous binding")]
419 pub prev: Span,
420}
421
422#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
DuplicateMatcherBindingLint {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
DuplicateMatcherBindingLint {
span: __binding_0, prev: __binding_1 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate matcher binding")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate binding")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous binding")));
diag
}
};
}
}
};LintDiagnostic)]
423#[diag("duplicate matcher binding")]
424pub(crate) struct DuplicateMatcherBindingLint {
425 #[label("duplicate binding")]
426 pub span: Span,
427 #[label("previous binding")]
428 pub prev: Span,
429}
430
431#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MissingFragmentSpecifier where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MissingFragmentSpecifier {
span: __binding_0, add_span: __binding_1, valid: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing fragment specifier")));
let __code_5 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(":spec"))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fragment specifiers must be provided")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid}")));
;
diag.arg("valid", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding a specifier here")),
__code_5, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
432#[diag("missing fragment specifier")]
433#[note("fragment specifiers must be provided")]
434#[help("{$valid}")]
435pub(crate) struct MissingFragmentSpecifier {
436 #[primary_span]
437 pub span: Span,
438 #[suggestion(
439 "try adding a specifier here",
440 style = "verbose",
441 code = ":spec",
442 applicability = "maybe-incorrect"
443 )]
444 pub add_span: Span,
445 pub valid: &'static str,
446}
447
448#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidFragmentSpecifier where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
InvalidFragmentSpecifier {
span: __binding_0, fragment: __binding_1, help: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid fragment specifier `{$fragment}`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$help}")));
;
diag.arg("fragment", __binding_1);
diag.arg("help", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
449#[diag("invalid fragment specifier `{$fragment}`")]
450#[help("{$help}")]
451pub(crate) struct InvalidFragmentSpecifier {
452 #[primary_span]
453 pub span: Span,
454 pub fragment: Ident,
455 pub help: &'static str,
456}
457
458#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ExpectedParenOrBrace<'a> where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
ExpectedParenOrBrace { span: __binding_0, token: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `(` or `{\"{\"}`, found `{$token}`")));
;
diag.arg("token", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
459#[diag("expected `(` or `{\"{\"}`, found `{$token}`")]
460pub(crate) struct ExpectedParenOrBrace<'a> {
461 #[primary_span]
462 pub span: Span,
463 pub token: Cow<'a, str>,
464}
465
466#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
EmptyDelegationMac where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
EmptyDelegationMac { span: __binding_0, kind: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty {$kind} delegation is not supported")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
467#[diag("empty {$kind} delegation is not supported")]
468pub(crate) struct EmptyDelegationMac {
469 #[primary_span]
470 pub span: Span,
471 pub kind: String,
472}
473
474#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
GlobDelegationOutsideImpls where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
GlobDelegationOutsideImpls { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("glob delegation is only supported in impls")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
475#[diag("glob delegation is only supported in impls")]
476pub(crate) struct GlobDelegationOutsideImpls {
477 #[primary_span]
478 pub span: Span,
479}
480
481#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CrateNameInCfgAttr where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
CrateNameInCfgAttr { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`crate_name` within an `#![cfg_attr]` attribute is forbidden")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
482#[diag("`crate_name` within an `#![cfg_attr]` attribute is forbidden")]
483pub(crate) struct CrateNameInCfgAttr {
484 #[primary_span]
485 pub span: Span,
486}
487
488#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CrateTypeInCfgAttr where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
CrateTypeInCfgAttr { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`crate_type` within an `#![cfg_attr]` attribute is forbidden")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
489#[diag("`crate_type` within an `#![cfg_attr]` attribute is forbidden")]
490pub(crate) struct CrateTypeInCfgAttr {
491 #[primary_span]
492 pub span: Span,
493}
494
495#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
GlobDelegationTraitlessQpath where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
GlobDelegationTraitlessQpath { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("qualified path without a trait in glob delegation")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
496#[diag("qualified path without a trait in glob delegation")]
497pub(crate) struct GlobDelegationTraitlessQpath {
498 #[primary_span]
499 pub span: Span,
500}
501
502pub(crate) use metavar_exprs::*;
503mod metavar_exprs {
504 use super::*;
505
506 #[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MveExtraTokens
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MveExtraTokens {
span: __binding_0,
ident_span: __binding_1,
extra_count: __binding_2,
exact_args_note: __binding_3,
range_args_note: __binding_4,
min_or_exact_args: __binding_5,
max_args: __binding_6,
name: __binding_7 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected trailing tokens")));
let __code_6 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("extra_count", __binding_2);
diag.arg("min_or_exact_args", __binding_5);
diag.arg("max_args", __binding_6);
diag.arg("name", __binding_7);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try removing {$extra_count ->\n [one] this token\n *[other] these tokens\n }")),
__code_6, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for this metavariable expression")));
if let Some(__binding_3) = __binding_3 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}` metavariable expression takes {$min_or_exact_args ->\n [zero] no arguments\n [one] a single argument\n *[other] {$min_or_exact_args} arguments\n }")));
}
if let Some(__binding_4) = __binding_4 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments")));
}
diag
}
}
}
}
};Diagnostic, #[automatically_derived]
impl ::core::default::Default for MveExtraTokens {
#[inline]
fn default() -> MveExtraTokens {
MveExtraTokens {
span: ::core::default::Default::default(),
ident_span: ::core::default::Default::default(),
extra_count: ::core::default::Default::default(),
exact_args_note: ::core::default::Default::default(),
range_args_note: ::core::default::Default::default(),
min_or_exact_args: ::core::default::Default::default(),
max_args: ::core::default::Default::default(),
name: ::core::default::Default::default(),
}
}
}Default)]
507 #[diag("unexpected trailing tokens")]
508 pub(crate) struct MveExtraTokens {
509 #[primary_span]
510 #[suggestion(
511 "try removing {$extra_count ->
512 [one] this token
513 *[other] these tokens
514 }",
515 code = "",
516 applicability = "machine-applicable"
517 )]
518 pub span: Span,
519 #[label("for this metavariable expression")]
520 pub ident_span: Span,
521 pub extra_count: usize,
522
523 #[note(
526 "the `{$name}` metavariable expression takes {$min_or_exact_args ->
527 [zero] no arguments
528 [one] a single argument
529 *[other] {$min_or_exact_args} arguments
530 }"
531 )]
532 pub exact_args_note: Option<()>,
533 #[note(
534 "the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments"
535 )]
536 pub range_args_note: Option<()>,
537 pub min_or_exact_args: usize,
538 pub max_args: usize,
539 pub name: String,
540 }
541
542 #[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MveMissingParen where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MveMissingParen {
ident_span: __binding_0,
unexpected_span: __binding_1,
insert_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `(`")));
let __code_7 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("( /* ... */ )"))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("metavariable expressions use function-like parentheses syntax")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for this this metavariable expression")));
if let Some(__binding_1) = __binding_1 {
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected token")));
}
if let Some(__binding_2) = __binding_2 {
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding parentheses")),
__code_7, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
}
}
}
};Diagnostic)]
543 #[note("metavariable expressions use function-like parentheses syntax")]
544 #[diag("expected `(`")]
545 pub(crate) struct MveMissingParen {
546 #[primary_span]
547 #[label("for this this metavariable expression")]
548 pub ident_span: Span,
549 #[label("unexpected token")]
550 pub unexpected_span: Option<Span>,
551 #[suggestion(
552 "try adding parentheses",
553 code = "( /* ... */ )",
554 applicability = "has-placeholders"
555 )]
556 pub insert_span: Option<Span>,
557 }
558
559 #[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MveUnrecognizedExpr where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MveUnrecognizedExpr {
span: __binding_0, valid_expr_list: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized metavariable expression")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid metavariable expressions are {$valid_expr_list}")));
;
diag.arg("valid_expr_list", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a valid metavariable expression")));
diag
}
}
}
}
};Diagnostic)]
560 #[note("valid metavariable expressions are {$valid_expr_list}")]
561 #[diag("unrecognized metavariable expression")]
562 pub(crate) struct MveUnrecognizedExpr {
563 #[primary_span]
564 #[label("not a valid metavariable expression")]
565 pub span: Span,
566 pub valid_expr_list: &'static str,
567 }
568
569 #[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MveUnrecognizedVar where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MveUnrecognizedVar { span: __binding_0, key: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$key}` is not recognized in meta-variable expression")));
;
diag.arg("key", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
570 #[diag("variable `{$key}` is not recognized in meta-variable expression")]
571 pub(crate) struct MveUnrecognizedVar {
572 #[primary_span]
573 pub span: Span,
574 pub key: MacroRulesNormalizedIdent,
575 }
576}
577
578#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MacroArgsBadDelim where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MacroArgsBadDelim {
span: __binding_0, sugg: __binding_1, rule_kw: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$rule_kw}` rule argument matchers require parentheses")));
;
diag.arg("rule_kw", __binding_2);
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
579#[diag("`{$rule_kw}` rule argument matchers require parentheses")]
580pub(crate) struct MacroArgsBadDelim {
581 #[primary_span]
582 pub span: Span,
583 #[subdiagnostic]
584 pub sugg: MacroArgsBadDelimSugg,
585 pub rule_kw: Symbol,
586}
587
588#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MacroArgsBadDelimSugg {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
MacroArgsBadDelimSugg {
open: __binding_0, close: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_8 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("("))
});
let __code_9 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_8));
suggestions.push((__binding_1, __code_9));
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
589#[multipart_suggestion(
590 "the delimiters should be `(` and `)`",
591 applicability = "machine-applicable"
592)]
593pub(crate) struct MacroArgsBadDelimSugg {
594 #[suggestion_part(code = "(")]
595 pub open: Span,
596 #[suggestion_part(code = ")")]
597 pub close: Span,
598}
599
600#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
MacroCallUnusedDocComment {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
MacroCallUnusedDocComment { span: __binding_0 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused doc comment")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to document an item produced by a macro, the macro must produce the documentation as part of its expansion")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rustdoc does not generate documentation for macro invocations")));
diag
}
};
}
}
};LintDiagnostic)]
601#[diag("unused doc comment")]
602#[help(
603 "to document an item produced by a macro, the macro must produce the documentation as part of its expansion"
604)]
605pub(crate) struct MacroCallUnusedDocComment {
606 #[label("rustdoc does not generate documentation for macro invocations")]
607 pub span: Span,
608}
609
610#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
OrPatternsBackCompat {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
OrPatternsBackCompat {
span: __binding_0, suggestion: __binding_1 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro")));
;
let __code_10 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
diag.arg("suggestion", __binding_1);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use pat_param to preserve semantics")),
__code_10, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
};
}
}
};LintDiagnostic)]
611#[diag(
612 "the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro"
613)]
614pub(crate) struct OrPatternsBackCompat {
615 #[suggestion(
616 "use pat_param to preserve semantics",
617 code = "{suggestion}",
618 applicability = "machine-applicable"
619 )]
620 pub span: Span,
621 pub suggestion: String,
622}
623
624#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for TrailingMacro {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
TrailingMacro { is_trailing: __binding_0, name: __binding_1
} => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trailing semicolon in macro used in expression position")));
;
diag.arg("name", __binding_1);
if __binding_0 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro invocations at the end of a block are treated as expressions")));
}
if __binding_0 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`")));
}
diag
}
};
}
}
};LintDiagnostic)]
625#[diag("trailing semicolon in macro used in expression position")]
626pub(crate) struct TrailingMacro {
627 #[note("macro invocations at the end of a block are treated as expressions")]
628 #[note(
629 "to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`"
630 )]
631 pub is_trailing: bool,
632 pub name: Ident,
633}
634
635#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnusedBuiltinAttribute {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnusedBuiltinAttribute {
invoc_span: __binding_0,
attr_name: __binding_1,
macro_name: __binding_2,
attr_span: __binding_3 } => {
diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute `{$attr_name}`")));
;
let __code_11 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.arg("attr_name", __binding_1);
diag.arg("macro_name", __binding_2);
diag.span_note(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`")));
diag.span_suggestions_with_style(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
__code_11, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag
}
};
}
}
};LintDiagnostic)]
636#[diag("unused attribute `{$attr_name}`")]
637pub(crate) struct UnusedBuiltinAttribute {
638 #[note(
639 "the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`"
640 )]
641 pub invoc_span: Span,
642 pub attr_name: Symbol,
643 pub macro_name: String,
644 #[suggestion(
645 "remove the attribute",
646 code = "",
647 applicability = "machine-applicable",
648 style = "tool-only"
649 )]
650 pub attr_span: Span,
651}