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