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("`{$var}` may not be available for the current Cargo target")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("Cargo sets build script variables at run time. Use `std::env::var({$var_expr})` instead")));
;
diag.arg("var", __binding_1);
diag.arg("var_expr", __binding_2);
diag.span(__binding_0);
diag
}
EnvNotDefined::CargoEnvVarTypo {
span: __binding_0,
var: __binding_1,
suggested_var: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` not defined at compile time")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a similar Cargo environment variable: `{$suggested_var}`")));
;
diag.arg("var", __binding_1);
diag.arg("suggested_var", __binding_2);
diag.span(__binding_0);
diag
}
EnvNotDefined::CustomEnvVar {
span: __binding_0, var: __binding_1, var_expr: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("environment variable `{$var}` not defined at compile time")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::env::var({$var_expr})` to read the variable at run time")));
;
diag.arg("var", __binding_1);
diag.arg("var_expr", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
546pub(crate) enum EnvNotDefined<'a> {
547 #[diag("environment variable `{$var}` not defined at compile time")]
548 #[help("`{$var}` may not be available for the current Cargo target")]
549 #[help(
550 "Cargo sets build script variables at run time. Use `std::env::var({$var_expr})` instead"
551 )]
552 CargoEnvVar {
553 #[primary_span]
554 span: Span,
555 var: Symbol,
556 var_expr: &'a rustc_ast::Expr,
557 },
558 #[diag("environment variable `{$var}` not defined at compile time")]
559 #[help("there is a similar Cargo environment variable: `{$suggested_var}`")]
560 CargoEnvVarTypo {
561 #[primary_span]
562 span: Span,
563 var: Symbol,
564 suggested_var: Symbol,
565 },
566 #[diag("environment variable `{$var}` not defined at compile time")]
567 #[help("use `std::env::var({$var_expr})` to read the variable at run time")]
568 CustomEnvVar {
569 #[primary_span]
570 span: Span,
571 var: Symbol,
572 var_expr: &'a rustc_ast::Expr,
573 },
574}
575
576#[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)]
577#[diag("environment variable `{$var}` is not a valid Unicode string")]
578pub(crate) struct EnvNotUnicode {
579 #[primary_span]
580 pub(crate) span: Span,
581 pub(crate) var: Symbol,
582}
583
584#[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)]
585#[diag("requires at least a format string argument")]
586pub(crate) struct FormatRequiresString {
587 #[primary_span]
588 pub(crate) span: Span,
589}
590
591#[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)]
592#[diag("duplicate argument named `{$ident}`")]
593pub(crate) struct FormatDuplicateArg {
594 #[primary_span]
595 pub(crate) span: Span,
596 #[label("previously here")]
597 pub(crate) prev: Span,
598 #[label("duplicate argument")]
599 pub(crate) duplicate: Span,
600 pub(crate) ident: Ident,
601}
602
603#[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)]
604#[diag("positional arguments cannot follow named arguments")]
605pub(crate) struct PositionalAfterNamed {
606 #[primary_span]
607 #[label("positional arguments must be before named arguments")]
608 pub(crate) span: Span,
609 #[label("named argument")]
610 pub(crate) args: Vec<Span>,
611}
612
613#[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)]
614#[diag("invalid format string: {$desc}")]
615pub(crate) struct InvalidFormatString {
616 #[primary_span]
617 #[label("{$label1} in format string")]
618 pub(crate) span: Span,
619 pub(crate) desc: String,
620 pub(crate) label1: String,
621 #[subdiagnostic]
622 pub(crate) note_: Option<InvalidFormatStringNote>,
623 #[subdiagnostic]
624 pub(crate) label_: Option<InvalidFormatStringLabel>,
625 #[subdiagnostic]
626 pub(crate) sugg_: Option<InvalidFormatStringSuggestion>,
627}
628
629#[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)]
630#[note("{$note}")]
631pub(crate) struct InvalidFormatStringNote {
632 pub(crate) note: String,
633}
634
635#[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)]
636#[label("{$label}")]
637pub(crate) struct InvalidFormatStringLabel {
638 #[primary_span]
639 pub(crate) span: Span,
640 pub(crate) label: String,
641}
642
643#[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)]
644pub(crate) enum InvalidFormatStringSuggestion {
645 #[multipart_suggestion(
646 "consider using a positional formatting argument instead",
647 style = "verbose",
648 applicability = "machine-applicable"
649 )]
650 UsePositional {
651 #[suggestion_part(code = "{len}")]
652 captured: Span,
653 len: String,
654 #[suggestion_part(code = ", {arg}")]
655 span: Span,
656 arg: String,
657 },
658 #[suggestion("remove the `r#`", code = "", applicability = "machine-applicable")]
659 RemoveRawIdent {
660 #[primary_span]
661 span: Span,
662 },
663 #[suggestion(
664 "did you mean `{$replacement}`?",
665 code = "{replacement}",
666 style = "verbose",
667 applicability = "machine-applicable"
668 )]
669 ReorderFormatParameter {
670 #[primary_span]
671 span: Span,
672 replacement: String,
673 },
674 #[suggestion(
675 "add a colon before the format specifier",
676 code = ":?",
677 applicability = "machine-applicable"
678 )]
679 AddMissingColon {
680 #[primary_span]
681 span: Span,
682 },
683
684 #[suggestion(
685 "use rust debug printing macro",
686 code = "{replacement}",
687 style = "verbose",
688 applicability = "machine-applicable"
689 )]
690 UseRustDebugPrintingMacro {
691 #[primary_span]
692 macro_span: Span,
693 replacement: String,
694 },
695}
696
697#[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)]
698#[diag("there is no argument named `{$name}`")]
699#[note("did you intend to capture a variable `{$name}` from the surrounding scope?")]
700#[note(
701 "to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro"
702)]
703pub(crate) struct FormatNoArgNamed {
704 #[primary_span]
705 pub(crate) span: Span,
706 pub(crate) name: Symbol,
707}
708
709#[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)]
710#[diag("unknown format trait `{$ty}`")]
711#[note(
712 "the only appropriate formatting traits are:
713 - ``, which uses the `Display` trait
714 - `?`, which uses the `Debug` trait
715 - `e`, which uses the `LowerExp` trait
716 - `E`, which uses the `UpperExp` trait
717 - `o`, which uses the `Octal` trait
718 - `p`, which uses the `Pointer` trait
719 - `b`, which uses the `Binary` trait
720 - `x`, which uses the `LowerHex` trait
721 - `X`, which uses the `UpperHex` trait"
722)]
723pub(crate) struct FormatUnknownTrait<'a> {
724 #[primary_span]
725 pub(crate) span: Span,
726 pub(crate) ty: &'a str,
727 #[subdiagnostic]
728 pub(crate) suggs: Vec<FormatUnknownTraitSugg>,
729}
730
731#[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)]
732#[suggestion(
733 "use the `{$trait_name}` trait",
734 code = "{fmt}",
735 style = "tool-only",
736 applicability = "maybe-incorrect"
737)]
738pub(crate) struct FormatUnknownTraitSugg {
739 #[primary_span]
740 pub span: Span,
741 pub fmt: &'static str,
742 pub trait_name: &'static str,
743}
744
745#[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)]
746#[diag(
747 "{$named ->
748 [true] named argument
749 *[false] argument
750 } never used"
751)]
752pub(crate) struct FormatUnusedArg {
753 #[primary_span]
754 #[label(
755 "{$named ->
756 [true] named argument
757 *[false] argument
758 } never used"
759 )]
760 pub(crate) span: Span,
761 pub(crate) named: bool,
762}
763
764impl Subdiagnostic for FormatUnusedArg {
767 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
768 diag.span_label(
769 self.span,
770 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$named ->\n [true] named argument\n *[false] argument\n } never used"))msg!(
771 "{$named ->
772 [true] named argument
773 *[false] argument
774 } never used"
775 )
776 .arg("named", self.named)
777 .format(),
778 );
779 }
780}
781
782#[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)]
783#[diag("multiple unused formatting arguments")]
784pub(crate) struct FormatUnusedArgs {
785 #[primary_span]
786 pub(crate) unused: Vec<Span>,
787 #[label("multiple missing formatting specifiers")]
788 pub(crate) fmt: Span,
789 #[subdiagnostic]
790 pub(crate) unused_labels: Vec<FormatUnusedArg>,
791}
792
793#[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)]
794#[diag(
795 "{$n} positional {$n ->
796 [one] argument
797 *[more] arguments
798 } in format string, but {$desc}"
799)]
800pub(crate) struct FormatPositionalMismatch {
801 #[primary_span]
802 pub(crate) span: MultiSpan,
803 pub(crate) n: usize,
804 pub(crate) desc: String,
805 #[subdiagnostic]
806 pub(crate) highlight: SingleLabelManySpans,
807}
808
809#[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)]
810#[diag(
811 "redundant {$n ->
812 [one] argument
813 *[more] arguments
814 }"
815)]
816pub(crate) struct FormatRedundantArgs {
817 #[primary_span]
818 pub(crate) span: MultiSpan,
819 pub(crate) n: usize,
820
821 #[note(
822 "{$n ->
823 [one] the formatting specifier is referencing the binding already
824 *[more] the formatting specifiers are referencing the bindings already
825 }"
826 )]
827 pub(crate) note: MultiSpan,
828
829 #[subdiagnostic]
830 pub(crate) sugg: Option<FormatRedundantArgsSugg>,
831}
832
833#[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)]
834#[multipart_suggestion("this can be removed", applicability = "machine-applicable")]
835pub(crate) struct FormatRedundantArgsSugg {
836 #[suggestion_part(code = "")]
837 pub(crate) spans: Vec<Span>,
838}
839
840#[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)]
841#[diag("`#[test_case]` attribute is only allowed on items")]
842pub(crate) struct TestCaseNonItem {
843 #[primary_span]
844 pub(crate) span: Span,
845}
846
847#[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)]
848#[diag("{$kind} functions cannot be used for tests")]
849pub(crate) struct TestBadFn {
850 #[primary_span]
851 pub(crate) span: Span,
852 #[label("`{$kind}` because of this")]
853 pub(crate) cause: Span,
854 pub(crate) kind: &'static str,
855}
856
857#[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)]
858#[diag("explicit register arguments cannot have names")]
859pub(crate) struct AsmExplicitRegisterName {
860 #[primary_span]
861 pub(crate) span: Span,
862}
863
864#[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)]
865#[diag("the `{$opt1}` and `{$opt2}` options are mutually exclusive")]
866pub(crate) struct AsmMutuallyExclusive {
867 #[primary_span]
868 pub(crate) spans: Vec<Span>,
869 pub(crate) opt1: &'static str,
870 pub(crate) opt2: &'static str,
871}
872
873#[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)]
874#[diag("the `pure` option must be combined with either `nomem` or `readonly`")]
875pub(crate) struct AsmPureCombine {
876 #[primary_span]
877 pub(crate) spans: Vec<Span>,
878}
879
880#[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)]
881#[diag("asm with the `pure` option must have at least one output")]
882pub(crate) struct AsmPureNoOutput {
883 #[primary_span]
884 pub(crate) spans: Vec<Span>,
885}
886
887#[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)]
888#[diag("asm template modifier must be a single character")]
889pub(crate) struct AsmModifierInvalid {
890 #[primary_span]
891 pub(crate) span: Span,
892}
893
894#[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)]
895#[diag("this attribute is not supported on assembly")]
896pub(crate) struct AsmAttributeNotSupported {
897 #[primary_span]
898 pub(crate) span: Span,
899}
900
901#[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)]
902#[diag("duplicate argument named `{$name}`")]
903pub(crate) struct AsmDuplicateArg {
904 #[primary_span]
905 #[label("duplicate argument")]
906 pub(crate) span: Span,
907 #[label("previously here")]
908 pub(crate) prev: Span,
909 pub(crate) name: Symbol,
910}
911
912#[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)]
913#[diag("positional arguments cannot follow named arguments or explicit register arguments")]
914pub(crate) struct AsmPositionalAfter {
915 #[primary_span]
916 #[label("positional argument")]
917 pub(crate) span: Span,
918 #[label("named argument")]
919 pub(crate) named: Vec<Span>,
920 #[label("explicit register argument")]
921 pub(crate) explicit: Vec<Span>,
922}
923
924#[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)]
925#[diag("asm outputs are not allowed with the `noreturn` option")]
926pub(crate) struct AsmNoReturn {
927 #[primary_span]
928 pub(crate) outputs_sp: Vec<Span>,
929}
930
931#[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)]
932#[diag("there is no argument named `{$name}`")]
933pub(crate) struct AsmNoMatchedArgumentName {
934 pub(crate) name: String,
935 #[primary_span]
936 pub(crate) span: Span,
937}
938
939#[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)]
940#[diag("asm labels are not allowed with the `may_unwind` option")]
941pub(crate) struct AsmMayUnwind {
942 #[primary_span]
943 pub(crate) labels_sp: Vec<Span>,
944}
945
946pub(crate) struct AsmClobberNoReg {
947 pub(crate) spans: Vec<Span>,
948 pub(crate) clobbers: Vec<Span>,
949}
950
951impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AsmClobberNoReg {
952 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
953 Diag::new(
954 dcx,
955 level,
956 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"),
957 )
958 .with_span(self.spans.clone())
959 .with_span_labels(self.clobbers, "clobber_abi")
960 .with_span_labels(self.spans, "generic outputs")
961 }
962}
963
964#[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)]
965#[diag("the `{$symbol}` option was already provided")]
966pub(crate) struct AsmOptAlreadyprovided {
967 #[primary_span]
968 #[label("this option was already provided")]
969 pub(crate) span: Span,
970 pub(crate) symbol: Symbol,
971 #[suggestion(
972 "remove this option",
973 code = "",
974 applicability = "machine-applicable",
975 style = "tool-only"
976 )]
977 pub(crate) span_with_comma: Span,
978}
979
980#[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)]
981#[diag("the `{$symbol}` option cannot be used with `{$macro_name}!`")]
982pub(crate) struct AsmUnsupportedOption {
983 #[primary_span]
984 #[label("the `{$symbol}` option is not meaningful for global-scoped inline assembly")]
985 pub(crate) span: Span,
986 pub(crate) symbol: Symbol,
987 #[suggestion(
988 "remove this option",
989 code = "",
990 applicability = "machine-applicable",
991 style = "tool-only"
992 )]
993 pub(crate) span_with_comma: Span,
994 pub(crate) macro_name: &'static str,
995}
996
997#[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)]
998#[diag("`clobber_abi` cannot be used with `{$macro_name}!`")]
999pub(crate) struct AsmUnsupportedClobberAbi {
1000 #[primary_span]
1001 pub(crate) spans: Vec<Span>,
1002 pub(crate) macro_name: &'static str,
1003}
1004
1005#[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)]
1006#[diag("expected token: `,`")]
1007pub(crate) struct ExpectedCommaInList {
1008 #[primary_span]
1009 pub span: Span,
1010}
1011
1012#[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)]
1013#[diag("{$name} takes 1 argument")]
1014pub(crate) struct OnlyOneArgument<'a> {
1015 #[primary_span]
1016 pub span: Span,
1017 pub name: &'a str,
1018}
1019
1020#[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)]
1021#[diag("{$name} takes no arguments")]
1022pub(crate) struct TakesNoArguments<'a> {
1023 #[primary_span]
1024 pub span: Span,
1025 pub name: &'a str,
1026}
1027
1028#[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)]
1029#[diag("the `#[{$path}]` attribute is only usable with crates of the `proc-macro` crate type")]
1030pub(crate) struct AttributeOnlyUsableWithCrateType<'a> {
1031 #[primary_span]
1032 pub span: Span,
1033 pub path: &'a str,
1034}
1035
1036#[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)]
1037#[diag("expected item, found `{$token}`")]
1038pub(crate) struct ExpectedItem<'a> {
1039 #[primary_span]
1040 pub span: Span,
1041 pub token: &'a str,
1042}
1043
1044#[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)]
1045#[diag("cannot use `#[unsafe(naked)]` with testing attributes", code = E0736)]
1046pub(crate) struct NakedFunctionTestingAttribute {
1047 #[primary_span]
1048 #[label("`#[unsafe(naked)]` is incompatible with testing attributes")]
1049 pub naked_span: Span,
1050 #[label("function marked with testing attribute here")]
1051 pub testing_span: Span,
1052}
1053
1054#[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)]
1055#[diag("the `#[pointee]` attribute may only be used on generic parameters")]
1056pub(crate) struct NonGenericPointee {
1057 #[primary_span]
1058 pub span: Span,
1059}
1060
1061#[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)]
1062#[diag(
1063 "expected operand, {$is_inline_asm ->
1064 [false] options
1065 *[true] clobber_abi, options
1066 }, or additional template string"
1067)]
1068pub(crate) struct AsmExpectedOther {
1069 #[primary_span]
1070 #[label(
1071 "expected operand, {$is_inline_asm ->
1072 [false] options
1073 *[true] clobber_abi, options
1074 }, or additional template string"
1075 )]
1076 pub(crate) span: Span,
1077 pub(crate) is_inline_asm: bool,
1078}
1079
1080#[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)]
1081#[diag("none of the predicates in this `cfg_select` evaluated to true")]
1082pub(crate) struct CfgSelectNoMatches {
1083 #[primary_span]
1084 pub span: Span,
1085}
1086
1087#[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)]
1088#[diag("`#[eii_declaration(...)]` is only valid on macros")]
1089pub(crate) struct EiiExternTargetExpectedMacro {
1090 #[primary_span]
1091 pub span: Span,
1092}
1093
1094#[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)]
1095#[diag("`#[eii_declaration(...)]` expects a list of one or two elements")]
1096pub(crate) struct EiiExternTargetExpectedList {
1097 #[primary_span]
1098 pub span: Span,
1099}
1100
1101#[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)]
1102#[diag("expected this argument to be \"unsafe\"")]
1103pub(crate) struct EiiExternTargetExpectedUnsafe {
1104 #[primary_span]
1105 #[note("the second argument is optional")]
1106 pub span: Span,
1107}
1108
1109#[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)]
1110#[diag("`#[{$name}]` is only valid on functions")]
1111pub(crate) struct EiiSharedMacroExpectedFunction {
1112 #[primary_span]
1113 pub span: Span,
1114 pub name: String,
1115}
1116
1117#[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)]
1118#[diag("`#[{$name}]` can only be used on functions inside a module")]
1119pub(crate) struct EiiSharedMacroInStatementPosition {
1120 #[primary_span]
1121 pub span: Span,
1122 pub name: String,
1123 #[label("`#[{$name}]` is used on this item, which is part of another item's local scope")]
1124 pub item_span: Span,
1125}
1126
1127#[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)]
1128#[diag("`#[{$name}]` can only be specified once")]
1129pub(crate) struct EiiOnlyOnce {
1130 #[primary_span]
1131 pub span: Span,
1132 #[note("specified again here")]
1133 pub first_span: Span,
1134 pub name: String,
1135}
1136
1137#[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)]
1138#[diag("`#[{$name}]` expected no arguments or a single argument: `#[{$name}(default)]`")]
1139pub(crate) struct EiiMacroExpectedMaxOneArgument {
1140 #[primary_span]
1141 pub span: Span,
1142 pub name: String,
1143}