1use rustc_errors::codes::*;
2use rustc_errors::formatting::DiagMessageAddArg;
3use rustc_errors::{
4 Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan, SingleLabelManySpans, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Ident, Span, Symbol};
8
9#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AvoidIntelSyntax {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AvoidIntelSyntax => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("avoid using `.intel_syntax`, Intel syntax is the default")));
;
diag
}
}
}
}
};Diagnostic)]
10#[diag("avoid using `.intel_syntax`, Intel syntax is the default")]
11pub(crate) struct AvoidIntelSyntax;
12
13#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AvoidAttSyntax {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AvoidAttSyntax => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("avoid using `.att_syntax`, prefer using `options(att_syntax)` instead")));
;
diag
}
}
}
}
};Diagnostic)]
14#[diag("avoid using `.att_syntax`, prefer using `options(att_syntax)` instead")]
15pub(crate) struct AvoidAttSyntax;
16
17#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for IncompleteInclude {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
IncompleteInclude => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("include macro expected single expression in source")));
;
diag
}
}
}
}
};Diagnostic)]
18#[diag("include macro expected single expression in source")]
19pub(crate) struct IncompleteInclude;
20
21#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnnameableTestItems
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnnameableTestItems => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot test inner items")));
;
diag
}
}
}
}
};Diagnostic)]
22#[diag("cannot test inner items")]
23pub(crate) struct UnnameableTestItems;
24
25#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for RequiresCfgPattern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RequiresCfgPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro requires a cfg-pattern as an argument")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cfg-pattern required")));
diag
}
}
}
}
};Diagnostic)]
26#[diag("macro requires a cfg-pattern as an argument")]
27pub(crate) struct RequiresCfgPattern {
28 #[primary_span]
29 #[label("cfg-pattern required")]
30 pub(crate) span: Span,
31}
32
33#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for OneCfgPattern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
OneCfgPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected 1 cfg-pattern")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
34#[diag("expected 1 cfg-pattern")]
35pub(crate) struct OneCfgPattern {
36 #[primary_span]
37 pub(crate) span: Span,
38}
39
40#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AllocErrorMustBeFn {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AllocErrorMustBeFn { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alloc_error_handler must be a function")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
41#[diag("alloc_error_handler must be a function")]
42pub(crate) struct AllocErrorMustBeFn {
43 #[primary_span]
44 pub(crate) span: Span,
45}
46
47#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AssertRequiresBoolean {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssertRequiresBoolean { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro requires a boolean expression as an argument")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("boolean expression required")));
diag
}
}
}
}
};Diagnostic)]
48#[diag("macro requires a boolean expression as an argument")]
49pub(crate) struct AssertRequiresBoolean {
50 #[primary_span]
51 #[label("boolean expression required")]
52 pub(crate) span: Span,
53}
54
55#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AssertRequiresExpression {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssertRequiresExpression {
span: __binding_0, token: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro requires an expression as an argument")));
let __code_0 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try removing semicolon")),
__code_0, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
56#[diag("macro requires an expression as an argument")]
57pub(crate) struct AssertRequiresExpression {
58 #[primary_span]
59 pub(crate) span: Span,
60 #[suggestion("try removing semicolon", code = "", applicability = "maybe-incorrect")]
61 pub(crate) token: Span,
62}
63
64#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssertMissingComma {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssertMissingComma { span: __binding_0, comma: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected string literal")));
let __code_1 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(", "))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding a comma")),
__code_1, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeInline);
diag
}
}
}
}
};Diagnostic)]
65#[diag("unexpected string literal")]
66pub(crate) struct AssertMissingComma {
67 #[primary_span]
68 pub(crate) span: Span,
69 #[suggestion(
70 "try adding a comma",
71 code = ", ",
72 applicability = "maybe-incorrect",
73 style = "short"
74 )]
75 pub(crate) comma: Span,
76}
77
78#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CfgAccessibleInvalid
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CfgAccessibleInvalid::UnspecifiedPath(__binding_0) => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg_accessible` path is not specified")));
;
diag.span(__binding_0);
diag
}
CfgAccessibleInvalid::MultiplePaths(__binding_0) => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `cfg_accessible` paths are specified")));
;
diag.span(__binding_0);
diag
}
CfgAccessibleInvalid::LiteralPath(__binding_0) => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg_accessible` path cannot be a literal")));
;
diag.span(__binding_0);
diag
}
CfgAccessibleInvalid::HasArguments(__binding_0) => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg_accessible` path cannot accept arguments")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
79pub(crate) enum CfgAccessibleInvalid {
80 #[diag("`cfg_accessible` path is not specified")]
81 UnspecifiedPath(#[primary_span] Span),
82 #[diag("multiple `cfg_accessible` paths are specified")]
83 MultiplePaths(#[primary_span] Span),
84 #[diag("`cfg_accessible` path cannot be a literal")]
85 LiteralPath(#[primary_span] Span),
86 #[diag("`cfg_accessible` path cannot accept arguments")]
87 HasArguments(#[primary_span] Span),
88}
89
90#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CfgAccessibleIndeterminate {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CfgAccessibleIndeterminate { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot determine whether the path is accessible or not")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
91#[diag("cannot determine whether the path is accessible or not")]
92pub(crate) struct CfgAccessibleIndeterminate {
93 #[primary_span]
94 pub(crate) span: Span,
95}
96
97#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatMissingLiteral
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatMissingLiteral { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only literals (like `\"foo\"`, `-42` and `3.14`) can be passed to `concat!()`")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
98#[diag("expected a literal")]
99#[note("only literals (like `\"foo\"`, `-42` and `3.14`) can be passed to `concat!()`")]
100pub(crate) struct ConcatMissingLiteral {
101 #[primary_span]
102 pub(crate) spans: Vec<Span>,
103}
104
105#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytestr {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytestr { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot concatenate a byte string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
106#[diag("cannot concatenate a byte string literal")]
107pub(crate) struct ConcatBytestr {
108 #[primary_span]
109 pub(crate) span: Span,
110}
111
112#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatCStrLit {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatCStrLit { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot concatenate a C string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
113#[diag("cannot concatenate a C string literal")]
114pub(crate) struct ConcatCStrLit {
115 #[primary_span]
116 pub(crate) span: Span,
117}
118
119#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExportMacroRules {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExportMacroRules { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot export macro_rules! macros from a `proc-macro` crate type currently")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
120#[diag("cannot export macro_rules! macros from a `proc-macro` crate type currently")]
121pub(crate) struct ExportMacroRules {
122 #[primary_span]
123 pub(crate) span: Span,
124}
125
126#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ProcMacro {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ProcMacro { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
127#[diag(
128 "`proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`"
129)]
130pub(crate) struct ProcMacro {
131 #[primary_span]
132 pub(crate) span: Span,
133}
134
135#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraceMacros {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TraceMacros { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trace_macros! accepts only `true` or `false`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
136#[diag("trace_macros! accepts only `true` or `false`")]
137pub(crate) struct TraceMacros {
138 #[primary_span]
139 pub(crate) span: Span,
140}
141
142#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for BenchSig {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BenchSig { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
143#[diag("functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`")]
144pub(crate) struct BenchSig {
145 #[primary_span]
146 pub(crate) span: Span,
147}
148
149#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AllocMustStatics {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AllocMustStatics { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("allocators must be statics")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
150#[diag("allocators must be statics")]
151pub(crate) struct AllocMustStatics {
152 #[primary_span]
153 pub(crate) span: Span,
154}
155
156#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AllocCannotThreadLocal {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AllocCannotThreadLocal {
span: __binding_0, attr: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("allocators cannot be `#[thread_local]`")));
let __code_2 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("marked `#[thread_local]` here")));
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
__code_2, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
157#[diag("allocators cannot be `#[thread_local]`")]
158pub(crate) struct AllocCannotThreadLocal {
159 #[primary_span]
160 pub(crate) span: Span,
161 #[label("marked `#[thread_local]` here")]
162 #[suggestion("remove this attribute", code = "", applicability = "maybe-incorrect")]
163 pub(crate) attr: Span,
164}
165
166pub(crate) use autodiff::*;
167
168mod autodiff {
169 use super::*;
170 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffMissingConfig {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffMissingConfig { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("autodiff requires at least a name and mode")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
171 #[diag("autodiff requires at least a name and mode")]
172 pub(crate) struct AutoDiffMissingConfig {
173 #[primary_span]
174 pub(crate) span: Span,
175 }
176 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffUnknownActivity {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffUnknownActivity {
span: __binding_0, act: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did not recognize Activity: `{$act}`")));
;
diag.arg("act", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
177 #[diag("did not recognize Activity: `{$act}`")]
178 pub(crate) struct AutoDiffUnknownActivity {
179 #[primary_span]
180 pub(crate) span: Span,
181 pub(crate) act: String,
182 }
183 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffInvalidTypeForActivity {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidTypeForActivity {
span: __binding_0, act: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$act} can not be used for this type")));
;
diag.arg("act", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
184 #[diag("{$act} can not be used for this type")]
185 pub(crate) struct AutoDiffInvalidTypeForActivity {
186 #[primary_span]
187 pub(crate) span: Span,
188 pub(crate) act: String,
189 }
190 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffInvalidNumberActivities {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidNumberActivities {
span: __binding_0, expected: __binding_1, found: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected {$expected} activities, but found {$found}")));
;
diag.arg("expected", __binding_1);
diag.arg("found", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
191 #[diag("expected {$expected} activities, but found {$found}")]
192 pub(crate) struct AutoDiffInvalidNumberActivities {
193 #[primary_span]
194 pub(crate) span: Span,
195 pub(crate) expected: usize,
196 pub(crate) found: usize,
197 }
198 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffInvalidApplicationModeAct {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidApplicationModeAct {
span: __binding_0, mode: __binding_1, act: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$act} can not be used in {$mode} Mode")));
;
diag.arg("mode", __binding_1);
diag.arg("act", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
199 #[diag("{$act} can not be used in {$mode} Mode")]
200 pub(crate) struct AutoDiffInvalidApplicationModeAct {
201 #[primary_span]
202 pub(crate) span: Span,
203 pub(crate) mode: String,
204 pub(crate) act: String,
205 }
206
207 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffInvalidRetAct {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidRetAct {
span: __binding_0, mode: __binding_1, act: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid return activity {$act} in {$mode} Mode")));
;
diag.arg("mode", __binding_1);
diag.arg("act", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
208 #[diag("invalid return activity {$act} in {$mode} Mode")]
209 pub(crate) struct AutoDiffInvalidRetAct {
210 #[primary_span]
211 pub(crate) span: Span,
212 pub(crate) mode: String,
213 pub(crate) act: String,
214 }
215
216 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoDiffInvalidWidth
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidWidth { span: __binding_0, width: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("autodiff width must fit u32, but is {$width}")));
;
diag.arg("width", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
217 #[diag("autodiff width must fit u32, but is {$width}")]
218 pub(crate) struct AutoDiffInvalidWidth {
219 #[primary_span]
220 pub(crate) span: Span,
221 pub(crate) width: u128,
222 }
223
224 #[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AutoDiffInvalidApplication {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoDiffInvalidApplication { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("autodiff must be applied to function")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
225 #[diag("autodiff must be applied to function")]
226 pub(crate) struct AutoDiffInvalidApplication {
227 #[primary_span]
228 pub(crate) span: Span,
229 }
230}
231
232#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
OffloadKernelInvalidApplication {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
OffloadKernelInvalidApplication { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("offload_kernel must be applied to function")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
233#[diag("offload_kernel must be applied to function")]
234pub(crate) struct OffloadKernelInvalidApplication {
235 #[primary_span]
236 pub(crate) span: Span,
237}
238
239#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytesInvalid {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesInvalid {
span: __binding_0,
lit_kind: __binding_1,
sugg: __binding_2,
cs_note: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot concatenate {$lit_kind} literals")));
;
diag.arg("lit_kind", __binding_1);
diag.span(__binding_0);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
if let Some(__binding_3) = __binding_3 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("concatenating C strings is ambiguous about including the '\\0'")));
}
diag
}
}
}
}
};Diagnostic)]
240#[diag("cannot concatenate {$lit_kind} literals")]
241pub(crate) struct ConcatBytesInvalid {
242 #[primary_span]
243 pub(crate) span: Span,
244 pub(crate) lit_kind: &'static str,
245 #[subdiagnostic]
246 pub(crate) sugg: Option<ConcatBytesInvalidSuggestion>,
247 #[note("concatenating C strings is ambiguous about including the '\\0'")]
248 pub(crate) cs_note: Option<()>,
249}
250
251#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ConcatBytesInvalidSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ConcatBytesInvalidSuggestion::CharLit {
span: __binding_0, snippet: __binding_1 } => {
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("b{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a byte character")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_3, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
ConcatBytesInvalidSuggestion::StrLit {
span: __binding_0, snippet: __binding_1 } => {
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("b{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a byte string")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_4, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
ConcatBytesInvalidSuggestion::CStrLit {
span: __binding_0, as_bstr: __binding_1 } => {
let __code_5 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("concatenating C strings is ambiguous about including the '\\0'")),
&sub_args);
diag.span_note(__binding_0, __message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a null-terminated byte string")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_5, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
ConcatBytesInvalidSuggestion::IntLit {
span: __binding_0, snippet: __binding_1 } => {
let __code_6 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("[{0}]", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try wrapping the number in an array")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_6, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
252pub(crate) enum ConcatBytesInvalidSuggestion {
253 #[suggestion(
254 "try using a byte character",
255 code = "b{snippet}",
256 applicability = "machine-applicable"
257 )]
258 CharLit {
259 #[primary_span]
260 span: Span,
261 snippet: String,
262 },
263 #[suggestion(
264 "try using a byte string",
265 code = "b{snippet}",
266 applicability = "machine-applicable"
267 )]
268 StrLit {
269 #[primary_span]
270 span: Span,
271 snippet: String,
272 },
273 #[note("concatenating C strings is ambiguous about including the '\\0'")]
274 #[suggestion(
275 "try using a null-terminated byte string",
276 code = "{as_bstr}",
277 applicability = "machine-applicable"
278 )]
279 CStrLit {
280 #[primary_span]
281 span: Span,
282 as_bstr: String,
283 },
284 #[suggestion(
285 "try wrapping the number in an array",
286 code = "[{snippet}]",
287 applicability = "machine-applicable"
288 )]
289 IntLit {
290 #[primary_span]
291 span: Span,
292 snippet: String,
293 },
294}
295
296#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytesOob {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesOob { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("numeric literal is out of bounds")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
297#[diag("numeric literal is out of bounds")]
298pub(crate) struct ConcatBytesOob {
299 #[primary_span]
300 pub(crate) span: Span,
301}
302
303#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytesNonU8 {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesNonU8 { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("numeric literal is not a `u8`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
304#[diag("numeric literal is not a `u8`")]
305pub(crate) struct ConcatBytesNonU8 {
306 #[primary_span]
307 pub(crate) span: Span,
308}
309
310#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ConcatBytesMissingLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesMissingLiteral { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a byte literal")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only byte literals (like `b\"foo\"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()`")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
311#[diag("expected a byte literal")]
312#[note(
313 "only byte literals (like `b\"foo\"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()`"
314)]
315pub(crate) struct ConcatBytesMissingLiteral {
316 #[primary_span]
317 pub(crate) spans: Vec<Span>,
318}
319
320#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytesArray {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesArray { span: __binding_0, bytestr: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot concatenate doubly nested array")));
;
diag.span(__binding_0);
if __binding_1 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("byte strings are treated as arrays of bytes")));
}
if __binding_1 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try flattening the array")));
}
diag
}
}
}
}
};Diagnostic)]
321#[diag("cannot concatenate doubly nested array")]
322pub(crate) struct ConcatBytesArray {
323 #[primary_span]
324 pub(crate) span: Span,
325 #[note("byte strings are treated as arrays of bytes")]
326 #[help("try flattening the array")]
327 pub(crate) bytestr: bool,
328}
329
330#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatBytesBadRepeat
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConcatBytesBadRepeat { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("repeat count is not a positive number")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
331#[diag("repeat count is not a positive number")]
332pub(crate) struct ConcatBytesBadRepeat {
333 #[primary_span]
334 pub(crate) span: Span,
335}
336
337#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for BadDeriveTarget {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BadDeriveTarget { span: __binding_0, item: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`derive` may only be applied to `struct`s, `enum`s and `union`s")));
diag.code(E0774);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not applicable here")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `struct`, `enum` or `union`")));
diag
}
}
}
}
};Diagnostic)]
338#[diag("`derive` may only be applied to `struct`s, `enum`s and `union`s", code = E0774)]
339pub(crate) struct BadDeriveTarget {
340 #[primary_span]
341 #[label("not applicable here")]
342 pub(crate) span: Span,
343 #[label("not a `struct`, `enum` or `union`")]
344 pub(crate) item: Span,
345}
346
347#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TestsNotSupport {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TestsNotSupport {} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("building tests with panic=abort is not supported without `-Zpanic_abort_tests`")));
;
diag
}
}
}
}
};Diagnostic)]
348#[diag("building tests with panic=abort is not supported without `-Zpanic_abort_tests`")]
349pub(crate) struct TestsNotSupport {}
350
351#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for BadDeriveLit {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BadDeriveLit { span: __binding_0, help: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected path to a trait, found literal")));
diag.code(E0777);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a trait")));
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
352#[diag("expected path to a trait, found literal", code = E0777)]
353pub(crate) struct BadDeriveLit {
354 #[primary_span]
355 #[label("not a trait")]
356 pub(crate) span: Span,
357 #[subdiagnostic]
358 pub help: BadDeriveLitHelp,
359}
360
361#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for BadDeriveLitHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
BadDeriveLitHelp::StrLit { sym: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("sym".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `#[derive({$sym})]`")),
&sub_args);
diag.help(__message);
}
BadDeriveLitHelp::Other => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for example, write `#[derive(Debug)]` for `Debug`")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
362pub(crate) enum BadDeriveLitHelp {
363 #[help("try using `#[derive({$sym})]`")]
364 StrLit { sym: Symbol },
365 #[help("for example, write `#[derive(Debug)]` for `Debug`")]
366 Other,
367}
368
369#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DerivePathArgsList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DerivePathArgsList { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("traits in `#[derive(...)]` don't accept arguments")));
let __code_7 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the arguments")),
__code_7, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
370#[diag("traits in `#[derive(...)]` don't accept arguments")]
371pub(crate) struct DerivePathArgsList {
372 #[suggestion("remove the arguments", code = "", applicability = "machine-applicable")]
373 #[primary_span]
374 pub(crate) span: Span,
375}
376
377#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DerivePathArgsValue
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DerivePathArgsValue { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("traits in `#[derive(...)]` don't accept values")));
let __code_8 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the value")),
__code_8, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
378#[diag("traits in `#[derive(...)]` don't accept values")]
379pub(crate) struct DerivePathArgsValue {
380 #[suggestion("remove the value", code = "", applicability = "machine-applicable")]
381 #[primary_span]
382 pub(crate) span: Span,
383}
384
385#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NoDefaultVariant {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NoDefaultVariant {
span: __binding_0,
item_span: __binding_1,
suggs: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[derive(Default)]` on enum with no `#[default]`")));
diag.code(E0665);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this enum needs a unit variant marked with `#[default]`")));
for __binding_2 in __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
386#[diag("`#[derive(Default)]` on enum with no `#[default]`", code = E0665)]
387pub(crate) struct NoDefaultVariant {
388 #[primary_span]
389 pub(crate) span: Span,
390 #[label("this enum needs a unit variant marked with `#[default]`")]
391 pub(crate) item_span: Span,
392 #[subdiagnostic]
393 pub(crate) suggs: Vec<NoDefaultVariantSugg>,
394}
395
396#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for NoDefaultVariantSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
NoDefaultVariantSugg { span: __binding_0 } => {
let __code_9 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("#[default] "))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("make this unit variant default by placing `#[default]` on it")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_9, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
397#[suggestion(
398 "make this unit variant default by placing `#[default]` on it",
399 code = "#[default] ",
400 applicability = "maybe-incorrect"
401)]
402pub(crate) struct NoDefaultVariantSugg {
403 #[primary_span]
404 pub(crate) span: Span,
405}
406
407#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MultipleDefaults {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MultipleDefaults {
span: __binding_0,
first: __binding_1,
additional: __binding_2,
suggs: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple declared defaults")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only one variant can be default")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first default")));
for __binding_2 in __binding_2 {
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("additional default")));
}
for __binding_3 in __binding_3 {
diag.subdiagnostic(__binding_3);
}
diag
}
}
}
}
};Diagnostic)]
408#[diag("multiple declared defaults")]
409#[note("only one variant can be default")]
410pub(crate) struct MultipleDefaults {
411 #[primary_span]
412 pub(crate) span: Span,
413 #[label("first default")]
414 pub(crate) first: Span,
415 #[label("additional default")]
416 pub additional: Vec<Span>,
417 #[subdiagnostic]
418 pub suggs: Vec<MultipleDefaultsSugg>,
419}
420
421#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MultipleDefaultsSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
MultipleDefaultsSugg {
spans: __binding_0, ident: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_10 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
for __binding_0 in __binding_0 {
suggestions.push((__binding_0, __code_10.clone()));
}
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("ident".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("make `{$ident}` default")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::CompletelyHidden);
}
}
}
}
};Subdiagnostic)]
422#[multipart_suggestion(
423 "make `{$ident}` default",
424 applicability = "maybe-incorrect",
425 style = "tool-only"
426)]
427pub(crate) struct MultipleDefaultsSugg {
428 #[suggestion_part(code = "")]
429 pub(crate) spans: Vec<Span>,
430 pub(crate) ident: Ident,
431}
432
433#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonUnitDefault {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonUnitDefault {
default_span: __binding_0,
span: __binding_1,
post: __binding_2,
is_item: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `#[default]` attribute may only be used on unit enum variants{$post}")));
;
diag.arg("post", __binding_2);
diag.span(__binding_0);
diag.span_context(__binding_1);
if let Some(__binding_3) = __binding_3 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider a manual implementation of `Default`")));
}
diag
}
}
}
}
};Diagnostic)]
434#[diag("the `#[default]` attribute may only be used on unit enum variants{$post}")]
435pub(crate) struct NonUnitDefault {
436 #[primary_span]
437 pub(crate) default_span: Span,
438 #[context]
439 pub(crate) span: Span,
440 pub(crate) post: &'static str,
441 #[help("consider a manual implementation of `Default`")]
442 pub(crate) is_item: Option<()>,
443}
444
445#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonExhaustiveDefault
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonExhaustiveDefault {
default_span: __binding_0,
span: __binding_1,
non_exhaustive: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("default variant must be exhaustive")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider a manual implementation of `Default`")));
;
diag.span(__binding_0);
diag.span_context(__binding_1);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declared `#[non_exhaustive]` here")));
diag
}
}
}
}
};Diagnostic)]
446#[diag("default variant must be exhaustive")]
447#[help("consider a manual implementation of `Default`")]
448pub(crate) struct NonExhaustiveDefault {
449 #[primary_span]
450 pub(crate) default_span: Span,
451 #[context]
452 pub(crate) span: Span,
453 #[label("declared `#[non_exhaustive]` here")]
454 pub(crate) non_exhaustive: Span,
455}
456
457#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MultipleDefaultAttrs
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MultipleDefaultAttrs {
span: __binding_0,
first: __binding_1,
first_rest: __binding_2,
rest: __binding_3,
only_one: __binding_4,
sugg: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `#[default]` attributes")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only one `#[default]` attribute is needed")));
;
diag.arg("only_one", __binding_4);
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[default]` used here")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[default]` used again here")));
diag.span_help(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try removing {$only_one ->\n [true] this\n *[false] these\n }")));
diag.subdiagnostic(__binding_5);
diag
}
}
}
}
};Diagnostic)]
458#[diag("multiple `#[default]` attributes")]
459#[note("only one `#[default]` attribute is needed")]
460pub(crate) struct MultipleDefaultAttrs {
461 #[primary_span]
462 pub(crate) span: Span,
463 #[label("`#[default]` used here")]
464 pub(crate) first: Span,
465 #[label("`#[default]` used again here")]
466 pub(crate) first_rest: Span,
467 #[help(
468 "try removing {$only_one ->
469 [true] this
470 *[false] these
471 }"
472 )]
473 pub(crate) rest: MultiSpan,
474 pub(crate) only_one: bool,
475 #[subdiagnostic]
476 pub(crate) sugg: MultipleDefaultAttrsSugg,
477}
478
479#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MultipleDefaultAttrsSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
MultipleDefaultAttrsSugg { spans: __binding_0 } => {
let mut suggestions = Vec::new();
let __code_11 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
for __binding_0 in __binding_0 {
suggestions.push((__binding_0, __code_11.clone()));
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider a manual implementation of `Default`")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
}
}
}
}
};Subdiagnostic)]
480#[multipart_suggestion(
481 "consider a manual implementation of `Default`",
482 applicability = "machine-applicable",
483 style = "tool-only"
484)]
485pub(crate) struct MultipleDefaultAttrsSugg {
486 #[suggestion_part(code = "")]
487 pub(crate) spans: Vec<Span>,
488}
489
490#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DefaultHasArg {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DefaultHasArg { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[default]` attribute does not accept a value")));
let __code_12 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("#[default]"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `#[default]`")),
__code_12, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeAlways);
diag
}
}
}
}
};Diagnostic)]
491#[diag("`#[default]` attribute does not accept a value")]
492pub(crate) struct DefaultHasArg {
493 #[primary_span]
494 #[suggestion(
495 "try using `#[default]`",
496 code = "#[default]",
497 style = "hidden",
498 applicability = "maybe-incorrect"
499 )]
500 pub(crate) span: Span,
501}
502
503#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
DeriveFromWrongTarget<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeriveFromWrongTarget { span: __binding_0, kind: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[derive(From)]` used on {$kind}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[derive(From)]` can only be used on structs with exactly one field")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
504#[diag("`#[derive(From)]` used on {$kind}")]
505#[note("`#[derive(From)]` can only be used on structs with exactly one field")]
506pub(crate) struct DeriveFromWrongTarget<'a> {
507 #[primary_span]
508 pub(crate) span: MultiSpan,
509 pub(crate) kind: &'a str,
510}
511
512#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DeriveFromWrongFieldCount {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeriveFromWrongFieldCount {
span: __binding_0, multiple_fields: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[derive(From)]` used on a struct with {$multiple_fields ->\n [true] multiple fields\n *[false] no fields\n }")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[derive(From)]` can only be used on structs with exactly one field")));
;
diag.arg("multiple_fields", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
513#[diag(
514 "`#[derive(From)]` used on a struct with {$multiple_fields ->
515 [true] multiple fields
516 *[false] no fields
517 }"
518)]
519#[note("`#[derive(From)]` can only be used on structs with exactly one field")]
520pub(crate) struct DeriveFromWrongFieldCount {
521 #[primary_span]
522 pub(crate) span: MultiSpan,
523 pub(crate) multiple_fields: bool,
524}
525
526#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DeriveMacroCall {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeriveMacroCall { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`derive` cannot be used on items with type macros")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
527#[diag("`derive` cannot be used on items with type macros")]
528pub(crate) struct DeriveMacroCall {
529 #[primary_span]
530 pub(crate) span: Span,
531}
532
533#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DeriveUnion {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeriveUnion { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this trait cannot be derived for unions")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
534#[diag("this trait cannot be derived for unions")]
535pub(crate) struct DeriveUnion {
536 #[primary_span]
537 pub(crate) span: Span,
538}
539
540#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EnvTakesArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EnvTakesArgs { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`env!()` takes 1 or 2 arguments")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
541#[diag("`env!()` takes 1 or 2 arguments")]
542pub(crate) struct EnvTakesArgs {
543 #[primary_span]
544 pub(crate) span: Span,
545}
546
547pub(crate) struct EnvNotDefinedWithUserMessage {
548 pub(crate) span: Span,
549 pub(crate) msg_from_user: Symbol,
550}
551
552impl<'a> Diagnostic<'a> for EnvNotDefinedWithUserMessage {
554 #[track_caller]
555 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
556 let mut diag = Diag::new(dcx, level, self.msg_from_user.to_string());
557 diag.span(self.span);
558 diag
559 }
560}
561
562#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EnvNotDefined {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EnvNotDefined::CargoEnvVar {
span: __binding_0, var: __binding_1, var_expr: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` not defined at compile time")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$var}` may not be available for the current Cargo target")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("Cargo sets build script variables at run time. Use `std::env::var({$var_expr})` instead")));
;
diag.arg("var", __binding_1);
diag.arg("var_expr", __binding_2);
diag.span(__binding_0);
diag
}
EnvNotDefined::CargoEnvVarTypo {
span: __binding_0,
var: __binding_1,
suggested_var: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` not defined at compile time")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a similar Cargo environment variable: `{$suggested_var}`")));
;
diag.arg("var", __binding_1);
diag.arg("suggested_var", __binding_2);
diag.span(__binding_0);
diag
}
EnvNotDefined::CustomEnvVar {
span: __binding_0, var: __binding_1, var_expr: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` not defined at compile time")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::env::var({$var_expr})` to read the variable at run time")));
;
diag.arg("var", __binding_1);
diag.arg("var_expr", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
563pub(crate) enum EnvNotDefined {
564 #[diag("environment variable `{$var}` not defined at compile time")]
565 #[help("`{$var}` may not be available for the current Cargo target")]
566 #[help(
567 "Cargo sets build script variables at run time. Use `std::env::var({$var_expr})` instead"
568 )]
569 CargoEnvVar {
570 #[primary_span]
571 span: Span,
572 var: String,
573 var_expr: String,
574 },
575 #[diag("environment variable `{$var}` not defined at compile time")]
576 #[help("there is a similar Cargo environment variable: `{$suggested_var}`")]
577 CargoEnvVarTypo {
578 #[primary_span]
579 span: Span,
580 var: String,
581 suggested_var: Symbol,
582 },
583 #[diag("environment variable `{$var}` not defined at compile time")]
584 #[help("use `std::env::var({$var_expr})` to read the variable at run time")]
585 CustomEnvVar {
586 #[primary_span]
587 span: Span,
588 var: String,
589 var_expr: String,
590 },
591}
592
593#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EnvNotUnicode {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EnvNotUnicode { span: __binding_0, var: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` is not a valid Unicode string")));
;
diag.arg("var", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
594#[diag("environment variable `{$var}` is not a valid Unicode string")]
595pub(crate) struct EnvNotUnicode {
596 #[primary_span]
597 pub(crate) span: Span,
598 pub(crate) var: String,
599}
600
601#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatRequiresString
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatRequiresString { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("requires at least a format string argument")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
602#[diag("requires at least a format string argument")]
603pub(crate) struct FormatRequiresString {
604 #[primary_span]
605 pub(crate) span: Span,
606}
607
608#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatDuplicateArg {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatDuplicateArg {
span: __binding_0,
prev: __binding_1,
duplicate: __binding_2,
ident: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate argument named `{$ident}`")));
;
diag.arg("ident", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previously here")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate argument")));
diag
}
}
}
}
};Diagnostic)]
609#[diag("duplicate argument named `{$ident}`")]
610pub(crate) struct FormatDuplicateArg {
611 #[primary_span]
612 pub(crate) span: Span,
613 #[label("previously here")]
614 pub(crate) prev: Span,
615 #[label("duplicate argument")]
616 pub(crate) duplicate: Span,
617 pub(crate) ident: Ident,
618}
619
620#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for PositionalAfterNamed
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PositionalAfterNamed { span: __binding_0, args: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional arguments cannot follow named arguments")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional arguments must be before named arguments")));
for __binding_1 in __binding_1 {
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("named argument")));
}
diag
}
}
}
}
};Diagnostic)]
621#[diag("positional arguments cannot follow named arguments")]
622pub(crate) struct PositionalAfterNamed {
623 #[primary_span]
624 #[label("positional arguments must be before named arguments")]
625 pub(crate) span: Span,
626 #[label("named argument")]
627 pub(crate) args: Vec<Span>,
628}
629
630#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidFormatString
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidFormatString {
span: __binding_0,
desc: __binding_1,
label1: __binding_2,
note_: __binding_3,
label_: __binding_4,
sugg_: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid format string: {$desc}")));
;
diag.arg("desc", __binding_1);
diag.arg("label1", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$label1} in format string")));
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)]
631#[diag("invalid format string: {$desc}")]
632pub(crate) struct InvalidFormatString {
633 #[primary_span]
634 #[label("{$label1} in format string")]
635 pub(crate) span: Span,
636 pub(crate) desc: String,
637 pub(crate) label1: String,
638 #[subdiagnostic]
639 pub(crate) note_: Option<InvalidFormatStringNote>,
640 #[subdiagnostic]
641 pub(crate) label_: Option<InvalidFormatStringLabel>,
642 #[subdiagnostic]
643 pub(crate) sugg_: Option<InvalidFormatStringSuggestion>,
644}
645
646#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidFormatStringNote {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidFormatStringNote { note: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("note".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$note}")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
647#[note("{$note}")]
648pub(crate) struct InvalidFormatStringNote {
649 pub(crate) note: String,
650}
651
652#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidFormatStringLabel {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidFormatStringLabel {
span: __binding_0, label: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("label".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$label}")),
&sub_args);
diag.span_label(__binding_0, __message);
}
}
}
}
};Subdiagnostic)]
653#[label("{$label}")]
654pub(crate) struct InvalidFormatStringLabel {
655 #[primary_span]
656 pub(crate) span: Span,
657 pub(crate) label: String,
658}
659
660#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidFormatStringSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidFormatStringSuggestion::UsePositional {
captured: __binding_0,
len: __binding_1,
span: __binding_2,
arg: __binding_3 } => {
let mut suggestions = Vec::new();
let __code_13 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
});
let __code_14 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(", {0}", __binding_3))
});
suggestions.push((__binding_0, __code_13));
suggestions.push((__binding_2, __code_14));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using a positional formatting argument instead")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
InvalidFormatStringSuggestion::RemoveRawIdent {
span: __binding_0 } => {
let __code_15 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `r#`")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_15, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
InvalidFormatStringSuggestion::ReorderFormatParameter {
span: __binding_0, replacement: __binding_1 } => {
let __code_16 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("replacement".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean `{$replacement}`?")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_16, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
InvalidFormatStringSuggestion::AddMissingColon {
span: __binding_0 } => {
let __code_17 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(":?"))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add a colon before the format specifier")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_17, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
InvalidFormatStringSuggestion::UseRustDebugPrintingMacro {
macro_span: __binding_0, replacement: __binding_1 } => {
let __code_18 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("replacement".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use rust debug printing macro")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_18, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
}
}
}
};Subdiagnostic)]
661pub(crate) enum InvalidFormatStringSuggestion {
662 #[multipart_suggestion(
663 "consider using a positional formatting argument instead",
664 style = "verbose",
665 applicability = "machine-applicable"
666 )]
667 UsePositional {
668 #[suggestion_part(code = "{len}")]
669 captured: Span,
670 len: String,
671 #[suggestion_part(code = ", {arg}")]
672 span: Span,
673 arg: String,
674 },
675 #[suggestion("remove the `r#`", code = "", applicability = "machine-applicable")]
676 RemoveRawIdent {
677 #[primary_span]
678 span: Span,
679 },
680 #[suggestion(
681 "did you mean `{$replacement}`?",
682 code = "{replacement}",
683 style = "verbose",
684 applicability = "machine-applicable"
685 )]
686 ReorderFormatParameter {
687 #[primary_span]
688 span: Span,
689 replacement: String,
690 },
691 #[suggestion(
692 "add a colon before the format specifier",
693 code = ":?",
694 applicability = "machine-applicable"
695 )]
696 AddMissingColon {
697 #[primary_span]
698 span: Span,
699 },
700
701 #[suggestion(
702 "use rust debug printing macro",
703 code = "{replacement}",
704 style = "verbose",
705 applicability = "machine-applicable"
706 )]
707 UseRustDebugPrintingMacro {
708 #[primary_span]
709 macro_span: Span,
710 replacement: String,
711 },
712}
713
714#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatNoArgNamed {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatNoArgNamed { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is no argument named `{$name}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you intend to capture a variable `{$name}` from the surrounding scope?")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
715#[diag("there is no argument named `{$name}`")]
716#[note("did you intend to capture a variable `{$name}` from the surrounding scope?")]
717#[note(
718 "to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro"
719)]
720pub(crate) struct FormatNoArgNamed {
721 #[primary_span]
722 pub(crate) span: Span,
723 pub(crate) name: Symbol,
724}
725
726#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
FormatUnknownTrait<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatUnknownTrait {
span: __binding_0, ty: __binding_1, suggs: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown format trait `{$ty}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the only appropriate formatting traits are:\n - ``, which uses the `Display` trait\n - `?`, which uses the `Debug` trait\n - `e`, which uses the `LowerExp` trait\n - `E`, which uses the `UpperExp` trait\n - `o`, which uses the `Octal` trait\n - `p`, which uses the `Pointer` trait\n - `b`, which uses the `Binary` trait\n - `x`, which uses the `LowerHex` trait\n - `X`, which uses the `UpperHex` trait")));
;
diag.arg("ty", __binding_1);
diag.span(__binding_0);
for __binding_2 in __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
727#[diag("unknown format trait `{$ty}`")]
728#[note(
729 "the only appropriate formatting traits are:
730 - ``, which uses the `Display` trait
731 - `?`, which uses the `Debug` trait
732 - `e`, which uses the `LowerExp` trait
733 - `E`, which uses the `UpperExp` trait
734 - `o`, which uses the `Octal` trait
735 - `p`, which uses the `Pointer` trait
736 - `b`, which uses the `Binary` trait
737 - `x`, which uses the `LowerHex` trait
738 - `X`, which uses the `UpperHex` trait"
739)]
740pub(crate) struct FormatUnknownTrait<'a> {
741 #[primary_span]
742 pub(crate) span: Span,
743 pub(crate) ty: &'a str,
744 #[subdiagnostic]
745 pub(crate) suggs: Vec<FormatUnknownTraitSugg>,
746}
747
748#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for FormatUnknownTraitSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
FormatUnknownTraitSugg {
span: __binding_0, fmt: __binding_1, trait_name: __binding_2
} => {
let __code_19 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("trait_name".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
&mut diag.long_ty_path));
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `{$trait_name}` trait")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_19, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::CompletelyHidden);
}
}
}
}
};Subdiagnostic)]
749#[suggestion(
750 "use the `{$trait_name}` trait",
751 code = "{fmt}",
752 style = "tool-only",
753 applicability = "maybe-incorrect"
754)]
755pub(crate) struct FormatUnknownTraitSugg {
756 #[primary_span]
757 pub span: Span,
758 pub fmt: &'static str,
759 pub trait_name: &'static str,
760}
761
762#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatUnusedArg {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatUnusedArg { span: __binding_0, named: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$named ->\n [true] named argument\n *[false] argument\n } never used")));
;
diag.arg("named", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$named ->\n [true] named argument\n *[false] argument\n } never used")));
diag
}
}
}
}
};Diagnostic)]
763#[diag(
764 "{$named ->
765 [true] named argument
766 *[false] argument
767 } never used"
768)]
769pub(crate) struct FormatUnusedArg {
770 #[primary_span]
771 #[label(
772 "{$named ->
773 [true] named argument
774 *[false] argument
775 } never used"
776 )]
777 pub(crate) span: Span,
778 pub(crate) named: bool,
779}
780
781impl Subdiagnostic for FormatUnusedArg {
784 fn add_to_diag(self, diag: &mut Diag<'_>) {
785 diag.span_label(
786 self.span,
787 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$named ->\n [true] named argument\n *[false] argument\n } never used"))msg!(
788 "{$named ->
789 [true] named argument
790 *[false] argument
791 } never used"
792 )
793 .arg("named", self.named)
794 .format(),
795 );
796 }
797}
798
799#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatUnusedArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatUnusedArgs {
unused: __binding_0,
fmt: __binding_1,
unused_labels: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple unused formatting arguments")));
;
diag.span(__binding_0.clone());
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple missing formatting specifiers")));
for __binding_2 in __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
800#[diag("multiple unused formatting arguments")]
801pub(crate) struct FormatUnusedArgs {
802 #[primary_span]
803 pub(crate) unused: Vec<Span>,
804 #[label("multiple missing formatting specifiers")]
805 pub(crate) fmt: Span,
806 #[subdiagnostic]
807 pub(crate) unused_labels: Vec<FormatUnusedArg>,
808}
809
810#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
FormatPositionalMismatch {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatPositionalMismatch {
span: __binding_0,
n: __binding_1,
desc: __binding_2,
highlight: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$n} positional {$n ->\n [one] argument\n *[more] arguments\n } in format string, but {$desc}")));
;
diag.arg("n", __binding_1);
diag.arg("desc", __binding_2);
diag.span(__binding_0);
diag.subdiagnostic(__binding_3);
diag
}
}
}
}
};Diagnostic)]
811#[diag(
812 "{$n} positional {$n ->
813 [one] argument
814 *[more] arguments
815 } in format string, but {$desc}"
816)]
817pub(crate) struct FormatPositionalMismatch {
818 #[primary_span]
819 pub(crate) span: MultiSpan,
820 pub(crate) n: usize,
821 pub(crate) desc: String,
822 #[subdiagnostic]
823 pub(crate) highlight: SingleLabelManySpans,
824}
825
826#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatRedundantArgs
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatRedundantArgs {
span: __binding_0,
n: __binding_1,
note: __binding_2,
sugg: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("redundant {$n ->\n [one] argument\n *[more] arguments\n }")));
;
diag.arg("n", __binding_1);
diag.span(__binding_0);
diag.span_note(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$n ->\n [one] the formatting specifier is referencing the binding already\n *[more] the formatting specifiers are referencing the bindings already\n }")));
if let Some(__binding_3) = __binding_3 {
diag.subdiagnostic(__binding_3);
}
diag
}
}
}
}
};Diagnostic)]
827#[diag(
828 "redundant {$n ->
829 [one] argument
830 *[more] arguments
831 }"
832)]
833pub(crate) struct FormatRedundantArgs {
834 #[primary_span]
835 pub(crate) span: MultiSpan,
836 pub(crate) n: usize,
837
838 #[note(
839 "{$n ->
840 [one] the formatting specifier is referencing the binding already
841 *[more] the formatting specifiers are referencing the bindings already
842 }"
843 )]
844 pub(crate) note: MultiSpan,
845
846 #[subdiagnostic]
847 pub(crate) sugg: Option<FormatRedundantArgsSugg>,
848}
849
850#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for FormatRedundantArgsSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
FormatRedundantArgsSugg { spans: __binding_0 } => {
let mut suggestions = Vec::new();
let __code_20 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
for __binding_0 in __binding_0 {
suggestions.push((__binding_0, __code_20.clone()));
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this can be removed")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
851#[multipart_suggestion("this can be removed", applicability = "machine-applicable")]
852pub(crate) struct FormatRedundantArgsSugg {
853 #[suggestion_part(code = "")]
854 pub(crate) spans: Vec<Span>,
855}
856
857#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TestCaseNonItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TestCaseNonItem { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[test_case]` attribute is only allowed on items")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
858#[diag("`#[test_case]` attribute is only allowed on items")]
859pub(crate) struct TestCaseNonItem {
860 #[primary_span]
861 pub(crate) span: Span,
862}
863
864#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TestBadFn {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TestBadFn {
span: __binding_0, cause: __binding_1, kind: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} functions cannot be used for tests")));
;
diag.arg("kind", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$kind}` because of this")));
diag
}
}
}
}
};Diagnostic)]
865#[diag("{$kind} functions cannot be used for tests")]
866pub(crate) struct TestBadFn {
867 #[primary_span]
868 pub(crate) span: Span,
869 #[label("`{$kind}` because of this")]
870 pub(crate) cause: Span,
871 pub(crate) kind: &'static str,
872}
873
874#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsmExplicitRegisterName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmExplicitRegisterName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicit register arguments cannot have names")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
875#[diag("explicit register arguments cannot have names")]
876pub(crate) struct AsmExplicitRegisterName {
877 #[primary_span]
878 pub(crate) span: Span,
879}
880
881#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmMutuallyExclusive
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmMutuallyExclusive {
spans: __binding_0, opt1: __binding_1, opt2: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$opt1}` and `{$opt2}` options are mutually exclusive")));
;
diag.arg("opt1", __binding_1);
diag.arg("opt2", __binding_2);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
882#[diag("the `{$opt1}` and `{$opt2}` options are mutually exclusive")]
883pub(crate) struct AsmMutuallyExclusive {
884 #[primary_span]
885 pub(crate) spans: Vec<Span>,
886 pub(crate) opt1: &'static str,
887 pub(crate) opt2: &'static str,
888}
889
890#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmPureCombine {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmPureCombine { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `pure` option must be combined with either `nomem` or `readonly`")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
891#[diag("the `pure` option must be combined with either `nomem` or `readonly`")]
892pub(crate) struct AsmPureCombine {
893 #[primary_span]
894 pub(crate) spans: Vec<Span>,
895}
896
897#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmPureNoOutput {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmPureNoOutput { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm with the `pure` option must have at least one output")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
898#[diag("asm with the `pure` option must have at least one output")]
899pub(crate) struct AsmPureNoOutput {
900 #[primary_span]
901 pub(crate) spans: Vec<Span>,
902}
903
904#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmModifierInvalid {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmModifierInvalid { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm template modifier must be a single character")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
905#[diag("asm template modifier must be a single character")]
906pub(crate) struct AsmModifierInvalid {
907 #[primary_span]
908 pub(crate) span: Span,
909}
910
911#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsmAttributeNotSupported {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmAttributeNotSupported { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute is not supported on assembly")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
912#[diag("this attribute is not supported on assembly")]
913pub(crate) struct AsmAttributeNotSupported {
914 #[primary_span]
915 pub(crate) span: Span,
916}
917
918#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmDuplicateArg {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmDuplicateArg {
span: __binding_0, prev: __binding_1, name: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate argument named `{$name}`")));
;
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate argument")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previously here")));
diag
}
}
}
}
};Diagnostic)]
919#[diag("duplicate argument named `{$name}`")]
920pub(crate) struct AsmDuplicateArg {
921 #[primary_span]
922 #[label("duplicate argument")]
923 pub(crate) span: Span,
924 #[label("previously here")]
925 pub(crate) prev: Span,
926 pub(crate) name: Symbol,
927}
928
929#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmPositionalAfter {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmPositionalAfter {
span: __binding_0, named: __binding_1, explicit: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional arguments cannot follow named arguments or explicit register arguments")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional argument")));
for __binding_1 in __binding_1 {
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("named argument")));
}
for __binding_2 in __binding_2 {
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicit register argument")));
}
diag
}
}
}
}
};Diagnostic)]
930#[diag("positional arguments cannot follow named arguments or explicit register arguments")]
931pub(crate) struct AsmPositionalAfter {
932 #[primary_span]
933 #[label("positional argument")]
934 pub(crate) span: Span,
935 #[label("named argument")]
936 pub(crate) named: Vec<Span>,
937 #[label("explicit register argument")]
938 pub(crate) explicit: Vec<Span>,
939}
940
941#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmNoReturn {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmNoReturn { outputs_sp: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm outputs are not allowed with the `noreturn` option")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
942#[diag("asm outputs are not allowed with the `noreturn` option")]
943pub(crate) struct AsmNoReturn {
944 #[primary_span]
945 pub(crate) outputs_sp: Vec<Span>,
946}
947
948#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsmNoMatchedArgumentName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmNoMatchedArgumentName {
name: __binding_0, span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is no argument named `{$name}`")));
;
diag.arg("name", __binding_0);
diag.span(__binding_1);
diag
}
}
}
}
};Diagnostic)]
949#[diag("there is no argument named `{$name}`")]
950pub(crate) struct AsmNoMatchedArgumentName {
951 pub(crate) name: String,
952 #[primary_span]
953 pub(crate) span: Span,
954}
955
956#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmMayUnwind {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmMayUnwind { labels_sp: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm labels are not allowed with the `may_unwind` option")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
957#[diag("asm labels are not allowed with the `may_unwind` option")]
958pub(crate) struct AsmMayUnwind {
959 #[primary_span]
960 pub(crate) labels_sp: Vec<Span>,
961}
962
963pub(crate) struct AsmClobberNoReg {
964 pub(crate) spans: Vec<Span>,
965 pub(crate) clobbers: Vec<Span>,
966}
967
968impl<'a> Diagnostic<'a> for AsmClobberNoReg {
969 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
970 Diag::new(
971 dcx,
972 level,
973 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm with `clobber_abi` must specify explicit registers for outputs"))msg!("asm with `clobber_abi` must specify explicit registers for outputs"),
974 )
975 .with_span(self.spans.clone())
976 .with_span_labels(self.clobbers, "clobber_abi")
977 .with_span_labels(self.spans, "generic outputs")
978 }
979}
980
981#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsmOptAlreadyprovided {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmOptAlreadyprovided {
span: __binding_0,
symbol: __binding_1,
span_with_comma: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$symbol}` option was already provided")));
let __code_21 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("symbol", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this option was already provided")));
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this option")),
__code_21, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag
}
}
}
}
};Diagnostic)]
982#[diag("the `{$symbol}` option was already provided")]
983pub(crate) struct AsmOptAlreadyprovided {
984 #[primary_span]
985 #[label("this option was already provided")]
986 pub(crate) span: Span,
987 pub(crate) symbol: Symbol,
988 #[suggestion(
989 "remove this option",
990 code = "",
991 applicability = "machine-applicable",
992 style = "tool-only"
993 )]
994 pub(crate) span_with_comma: Span,
995}
996
997#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmUnsupportedOption
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmUnsupportedOption {
span: __binding_0,
symbol: __binding_1,
span_with_comma: __binding_2,
macro_name: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$symbol}` option cannot be used with `{$macro_name}!`")));
let __code_22 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("symbol", __binding_1);
diag.arg("macro_name", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$symbol}` option is not meaningful for global-scoped inline assembly")));
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this option")),
__code_22, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag
}
}
}
}
};Diagnostic)]
998#[diag("the `{$symbol}` option cannot be used with `{$macro_name}!`")]
999pub(crate) struct AsmUnsupportedOption {
1000 #[primary_span]
1001 #[label("the `{$symbol}` option is not meaningful for global-scoped inline assembly")]
1002 pub(crate) span: Span,
1003 pub(crate) symbol: Symbol,
1004 #[suggestion(
1005 "remove this option",
1006 code = "",
1007 applicability = "machine-applicable",
1008 style = "tool-only"
1009 )]
1010 pub(crate) span_with_comma: Span,
1011 pub(crate) macro_name: &'static str,
1012}
1013
1014#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsmUnsupportedClobberAbi {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmUnsupportedClobberAbi {
spans: __binding_0, macro_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`clobber_abi` cannot be used with `{$macro_name}!`")));
;
diag.arg("macro_name", __binding_1);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
1015#[diag("`clobber_abi` cannot be used with `{$macro_name}!`")]
1016pub(crate) struct AsmUnsupportedClobberAbi {
1017 #[primary_span]
1018 pub(crate) spans: Vec<Span>,
1019 pub(crate) macro_name: &'static str,
1020}
1021
1022#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedCommaInList
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedCommaInList { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected token: `,`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1023#[diag("expected token: `,`")]
1024pub(crate) struct ExpectedCommaInList {
1025 #[primary_span]
1026 pub span: Span,
1027}
1028
1029#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
OnlyOneArgument<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
OnlyOneArgument { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name} takes 1 argument")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1030#[diag("{$name} takes 1 argument")]
1031pub(crate) struct OnlyOneArgument<'a> {
1032 #[primary_span]
1033 pub span: Span,
1034 pub name: &'a str,
1035}
1036
1037#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
TakesNoArguments<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TakesNoArguments { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name} takes no arguments")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1038#[diag("{$name} takes no arguments")]
1039pub(crate) struct TakesNoArguments<'a> {
1040 #[primary_span]
1041 pub span: Span,
1042 pub name: &'a str,
1043}
1044
1045#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
AttributeOnlyUsableWithCrateType<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AttributeOnlyUsableWithCrateType {
span: __binding_0, path: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$path}` attribute is only usable with crates of the `proc-macro` crate type")));
;
diag.arg("path", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1046#[diag("the `{$path}` attribute is only usable with crates of the `proc-macro` crate type")]
1047pub(crate) struct AttributeOnlyUsableWithCrateType<'a> {
1048 #[primary_span]
1049 pub span: Span,
1050 pub path: &'a str,
1051}
1052
1053#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for ExpectedItem<'a>
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedItem { span: __binding_0, token: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected item, found `{$token}`")));
;
diag.arg("token", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1054#[diag("expected item, found `{$token}`")]
1055pub(crate) struct ExpectedItem<'a> {
1056 #[primary_span]
1057 pub span: Span,
1058 pub token: &'a str,
1059}
1060
1061#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NakedFunctionTestingAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NakedFunctionTestingAttribute {
naked_span: __binding_0, testing_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use `#[unsafe(naked)]` with testing attributes")));
diag.code(E0736);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[unsafe(naked)]` is incompatible with testing attributes")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function marked with testing attribute here")));
diag
}
}
}
}
};Diagnostic)]
1062#[diag("cannot use `#[unsafe(naked)]` with testing attributes", code = E0736)]
1063pub(crate) struct NakedFunctionTestingAttribute {
1064 #[primary_span]
1065 #[label("`#[unsafe(naked)]` is incompatible with testing attributes")]
1066 pub naked_span: Span,
1067 #[label("function marked with testing attribute here")]
1068 pub testing_span: Span,
1069}
1070
1071#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonGenericPointee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonGenericPointee { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `#[pointee]` attribute may only be used on generic parameters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1072#[diag("the `#[pointee]` attribute may only be used on generic parameters")]
1073pub(crate) struct NonGenericPointee {
1074 #[primary_span]
1075 pub span: Span,
1076}
1077
1078#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsmExpectedOther {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsmExpectedOther {
span: __binding_0, is_inline_asm: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected operand, {$is_inline_asm ->\n [false] options\n *[true] clobber_abi, options\n }, or additional template string")));
;
diag.arg("is_inline_asm", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected operand, {$is_inline_asm ->\n [false] options\n *[true] clobber_abi, options\n }, or additional template string")));
diag
}
}
}
}
};Diagnostic)]
1079#[diag(
1080 "expected operand, {$is_inline_asm ->
1081 [false] options
1082 *[true] clobber_abi, options
1083 }, or additional template string"
1084)]
1085pub(crate) struct AsmExpectedOther {
1086 #[primary_span]
1087 #[label(
1088 "expected operand, {$is_inline_asm ->
1089 [false] options
1090 *[true] clobber_abi, options
1091 }, or additional template string"
1092 )]
1093 pub(crate) span: Span,
1094 pub(crate) is_inline_asm: bool,
1095}
1096
1097#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CfgSelectNoMatches {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CfgSelectNoMatches { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("none of the predicates in this `cfg_select` evaluated to true")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1098#[diag("none of the predicates in this `cfg_select` evaluated to true")]
1099pub(crate) struct CfgSelectNoMatches {
1100 #[primary_span]
1101 pub span: Span,
1102}
1103
1104#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EiiBothDeclAndImpl {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiBothDeclAndImpl { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a single item cannot both declare and implement EIIs")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1105#[diag("a single item cannot both declare and implement EIIs")]
1106pub(crate) struct EiiBothDeclAndImpl {
1107 #[primary_span]
1108 pub span: Span,
1109}
1110
1111#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiExternTargetExpectedMacro {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiExternTargetExpectedMacro { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[eii_declaration(...)]` is only valid on macros")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1112#[diag("`#[eii_declaration(...)]` is only valid on macros")]
1113pub(crate) struct EiiExternTargetExpectedMacro {
1114 #[primary_span]
1115 pub span: Span,
1116}
1117
1118#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiExternTargetExpectedList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiExternTargetExpectedList { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[eii_declaration(...)]` expects a list of one or two elements")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1119#[diag("`#[eii_declaration(...)]` expects a list of one or two elements")]
1120pub(crate) struct EiiExternTargetExpectedList {
1121 #[primary_span]
1122 pub span: Span,
1123}
1124
1125#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiExternTargetExpectedUnsafe {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiExternTargetExpectedUnsafe { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected this argument to be \"unsafe\"")));
;
diag.span(__binding_0);
diag.span_note(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the second argument is optional")));
diag
}
}
}
}
};Diagnostic)]
1126#[diag("expected this argument to be \"unsafe\"")]
1127pub(crate) struct EiiExternTargetExpectedUnsafe {
1128 #[primary_span]
1129 #[note("the second argument is optional")]
1130 pub span: Span,
1131}
1132
1133#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiMultipleImplementations {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiMultipleImplementations { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a single item cannot implement multiple EIIs")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1134#[diag("a single item cannot implement multiple EIIs")]
1135pub(crate) struct EiiMultipleImplementations {
1136 #[primary_span]
1137 pub span: Span,
1138}
1139
1140#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EiiSharedMacroTarget
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiSharedMacroTarget { span: __binding_0, name: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` is only valid on functions and statics")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1141#[diag("`#[{$name}]` is only valid on functions and statics")]
1142pub(crate) struct EiiSharedMacroTarget {
1143 #[primary_span]
1144 pub span: Span,
1145 pub name: String,
1146}
1147
1148#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiStaticDefaultApple {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiStaticDefaultApple { span: __binding_0, name: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` cannot be used on statics with a value on Apple targets")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #157649 <https://github.com/rust-lang/rust/issues/157649> for more information")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1149#[diag("`#[{$name}]` cannot be used on statics with a value on Apple targets")]
1150#[note("see issue #157649 <https://github.com/rust-lang/rust/issues/157649> for more information")]
1151pub(crate) struct EiiStaticDefaultApple {
1152 #[primary_span]
1153 pub span: Span,
1154 pub name: String,
1155}
1156
1157#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiStaticArgumentRequired {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiStaticArgumentRequired {
span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` requires the name as an explicit argument when used on a static")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1158#[diag("`#[{$name}]` requires the name as an explicit argument when used on a static")]
1159pub(crate) struct EiiStaticArgumentRequired {
1160 #[primary_span]
1161 pub span: Span,
1162 pub name: String,
1163}
1164
1165#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EiiStaticMutable {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiStaticMutable { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` cannot be used on mutable statics")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1166#[diag("`#[{$name}]` cannot be used on mutable statics")]
1167pub(crate) struct EiiStaticMutable {
1168 #[primary_span]
1169 pub span: Span,
1170 pub name: String,
1171}
1172
1173#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiSharedMacroInStatementPosition {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiSharedMacroInStatementPosition {
span: __binding_0, name: __binding_1, item_span: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` can only be used on functions inside a module")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` is used on this item, which is part of another item's local scope")));
diag
}
}
}
}
};Diagnostic)]
1174#[diag("`#[{$name}]` can only be used on functions inside a module")]
1175pub(crate) struct EiiSharedMacroInStatementPosition {
1176 #[primary_span]
1177 pub span: Span,
1178 pub name: String,
1179 #[label("`#[{$name}]` is used on this item, which is part of another item's local scope")]
1180 pub item_span: Span,
1181}
1182
1183#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EiiOnlyOnce {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiOnlyOnce {
span: __binding_0,
first_span: __binding_1,
name: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` can only be specified once")));
;
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag.span_note(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specified again here")));
diag
}
}
}
}
};Diagnostic)]
1184#[diag("`#[{$name}]` can only be specified once")]
1185pub(crate) struct EiiOnlyOnce {
1186 #[primary_span]
1187 pub span: Span,
1188 #[note("specified again here")]
1189 pub first_span: Span,
1190 pub name: String,
1191}
1192
1193#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiMacroExpectedMaxOneArgument {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiMacroExpectedMaxOneArgument {
span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` expected no arguments or a single argument: `#[{$name}(default)]`")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1194#[diag("`#[{$name}]` expected no arguments or a single argument: `#[{$name}(default)]`")]
1195pub(crate) struct EiiMacroExpectedMaxOneArgument {
1196 #[primary_span]
1197 pub span: Span,
1198 pub name: String,
1199}
1200
1201#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
EiiAttributeNotSupported {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiAttributeNotSupported {
span: __binding_0, attr_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only a small subset of attributes are supported on externally implementable items")));
;
diag.span(__binding_0);
diag.span_note(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute is not supported")));
diag
}
}
}
}
};Diagnostic)]
1202#[diag("only a small subset of attributes are supported on externally implementable items")]
1203pub(crate) struct EiiAttributeNotSupported {
1204 #[primary_span]
1205 pub span: Span,
1206 #[note("this attribute is not supported")]
1207 pub attr_span: Span,
1208}
1209
1210#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NamedArgumentUsedPositionally {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NamedArgumentUsedPositionally {
named_arg_sp: __binding_0,
position_label_sp: __binding_1,
suggestion: __binding_2,
name: __binding_3,
named_arg_name: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("named argument `{$named_arg_name}` is not used by name")));
let __code_23 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_3))
})].into_iter();
;
diag.arg("named_arg_name", __binding_4);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this named argument is referred to by position in formatting string")));
if let Some(__binding_1) = __binding_1 {
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this formatting argument uses named argument `{$named_arg_name}` by position")));
}
if let Some(__binding_2) = __binding_2 {
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the named argument by name to avoid ambiguity")),
__code_23, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
}
diag
}
}
}
}
};Diagnostic)]
1211#[diag("named argument `{$named_arg_name}` is not used by name")]
1212pub(crate) struct NamedArgumentUsedPositionally {
1213 #[label("this named argument is referred to by position in formatting string")]
1214 pub named_arg_sp: Span,
1215 #[label("this formatting argument uses named argument `{$named_arg_name}` by position")]
1216 pub position_label_sp: Option<Span>,
1217 #[suggestion(
1218 "use the named argument by name to avoid ambiguity",
1219 style = "verbose",
1220 code = "{name}",
1221 applicability = "maybe-incorrect"
1222 )]
1223 pub suggestion: Option<Span>,
1224
1225 pub name: String,
1226 pub named_arg_name: String,
1227}