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