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