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