1use std::num::IntErrorKind;
2
3use rustc_attr_ir::{AttrPath, MirDialect, MirPhase};
4use rustc_errors::codes::*;
5use rustc_errors::{
6 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, E0264, Level, MultiSpan,
7};
8use rustc_macros::{Diagnostic, Subdiagnostic};
9use rustc_span::{Ident, Span, Symbol};
10use rustc_target::spec::TargetTuple;
11
12use crate::AttributeTemplate;
13use crate::context::Suggestion;
14
15#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcLegacyConstGenericsOnly {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcLegacyConstGenericsOnly {
attr_span: __binding_0, param_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("#[rustc_legacy_const_generics] functions must only have const generics")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-const generic parameter")));
diag
}
}
}
}
};Diagnostic)]
16#[diag("#[rustc_legacy_const_generics] functions must only have const generics")]
17pub(crate) struct RustcLegacyConstGenericsOnly {
18 #[primary_span]
19 pub attr_span: Span,
20 #[label("non-const generic parameter")]
21 pub param_span: Span,
22}
23
24#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcLegacyConstGenericsIndex {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcLegacyConstGenericsIndex {
attr_span: __binding_0, generics_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("#[rustc_legacy_const_generics] must have one index for each generic parameter")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters")));
diag
}
}
}
}
};Diagnostic)]
25#[diag("#[rustc_legacy_const_generics] must have one index for each generic parameter")]
26pub(crate) struct RustcLegacyConstGenericsIndex {
27 #[primary_span]
28 pub attr_span: Span,
29 #[label("generic parameters")]
30 pub generics_span: Span,
31}
32
33#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcLegacyConstGenericsIndexExceed {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcLegacyConstGenericsIndexExceed {
span: __binding_0, arg_count: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("index exceeds number of arguments")));
;
diag.arg("arg_count", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there {$arg_count ->\n [one] is\n *[other] are\n } only {$arg_count} {$arg_count ->\n [one] argument\n *[other] arguments\n }")));
diag
}
}
}
}
};Diagnostic)]
34#[diag("index exceeds number of arguments")]
35pub(crate) struct RustcLegacyConstGenericsIndexExceed {
36 #[primary_span]
37 #[label(
38 "there {$arg_count ->
39 [one] is
40 *[other] are
41 } only {$arg_count} {$arg_count ->
42 [one] argument
43 *[other] arguments
44 }"
45 )]
46 pub span: Span,
47 pub arg_count: usize,
48}
49
50#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InvalidAttrAtCrateLevel {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidAttrAtCrateLevel {
span: __binding_0,
pound_to_opening_bracket: __binding_1,
name: __binding_2,
item: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` attribute cannot be used at crate level")));
let __code_0 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("#["))
})].into_iter();
;
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("perhaps you meant to use an outer attribute")),
__code_0, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
if let Some(__binding_3) = __binding_3 {
diag.subdiagnostic(__binding_3);
}
diag
}
}
}
}
};Diagnostic)]
51#[diag("`{$name}` attribute cannot be used at crate level")]
52pub(crate) struct InvalidAttrAtCrateLevel {
53 #[primary_span]
54 pub span: Span,
55 #[suggestion(
56 "perhaps you meant to use an outer attribute",
57 code = "#[",
58 applicability = "machine-applicable",
59 style = "verbose"
60 )]
61 pub pound_to_opening_bracket: Span,
62 pub name: Symbol,
63 #[subdiagnostic]
64 pub item: Option<ItemFollowingInnerAttr>,
65}
66
67#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ItemFollowingInnerAttr {
}
#[automatically_derived]impl ::core::clone::Clone for ItemFollowingInnerAttr {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for ItemFollowingInnerAttr {
}Copy, const _: () =
{
impl rustc_errors::Subdiagnostic for ItemFollowingInnerAttr {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ItemFollowingInnerAttr { span: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the inner attribute doesn't annotate this item")),
&sub_args);
diag.span_label(__binding_0, __message);
}
}
}
}
};Subdiagnostic)]
68#[label("the inner attribute doesn't annotate this item")]
69pub(crate) struct ItemFollowingInnerAttr {
70 #[primary_span]
71 pub span: Span,
72}
73
74#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnreachableCfgSelectPredicate {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnreachableCfgSelectPredicate { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
diag
}
}
}
}
};Diagnostic)]
75#[diag("unreachable configuration predicate")]
76pub(crate) struct UnreachableCfgSelectPredicate {
77 #[label("this configuration predicate is never reached")]
78 pub span: Span,
79}
80
81#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnsupportedAttributesInWhere {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsupportedAttributesInWhere { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("most attributes are not supported in `where` clauses")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `#[cfg]` and `#[cfg_attr]` are supported")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
82#[diag("most attributes are not supported in `where` clauses")]
83#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
84pub(crate) struct UnsupportedAttributesInWhere {
85 #[primary_span]
86 pub span: MultiSpan,
87}
88
89#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnreachableCfgSelectPredicateWildcard {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnreachableCfgSelectPredicateWildcard {
span: __binding_0, wildcard_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("always matches")));
diag
}
}
}
}
};Diagnostic)]
90#[diag("unreachable configuration predicate")]
91pub(crate) struct UnreachableCfgSelectPredicateWildcard {
92 #[label("this configuration predicate is never reached")]
93 pub span: Span,
94
95 #[label("always matches")]
96 pub wildcard_span: Span,
97}
98
99#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MustBeNameOfAssociatedFunction {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MustBeNameOfAssociatedFunction { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("must be a name of an associated function")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
100#[diag("must be a name of an associated function")]
101pub(crate) struct MustBeNameOfAssociatedFunction {
102 #[primary_span]
103 pub span: Span,
104}
105
106#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
FunctionNamesDuplicated {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FunctionNamesDuplicated { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions names are duplicated")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("all `#[rustc_must_implement_one_of]` arguments must be unique")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
107#[diag("functions names are duplicated")]
108#[note("all `#[rustc_must_implement_one_of]` arguments must be unique")]
109pub(crate) struct FunctionNamesDuplicated {
110 #[primary_span]
111 pub spans: Vec<Span>,
112}
113
114#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnsafeAttrOutsideUnsafeLint {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeAttrOutsideUnsafeLint {
span: __binding_0, suggestion: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
115#[diag("unsafe attribute used without unsafe")]
116pub(crate) struct UnsafeAttrOutsideUnsafeLint {
117 #[label("usage of unsafe attribute")]
118 pub span: Span,
119 #[subdiagnostic]
120 pub suggestion: Option<crate::diagnostics::UnsafeAttrOutsideUnsafeSuggestion>,
121}
122
123#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcAllowConstFnUnstable {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcAllowConstFnUnstable {
attr_span: __binding_0, span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to `const fn`")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `const fn`")));
diag
}
}
}
}
};Diagnostic)]
124#[diag("attribute should be applied to `const fn`")]
125pub(crate) struct RustcAllowConstFnUnstable {
126 #[primary_span]
127 pub attr_span: Span,
128 #[label("not a `const fn`")]
129 pub span: Span,
130}
131
132#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
IllFormedAttributeInput {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
IllFormedAttributeInput {
num_suggestions: __binding_0,
suggestions: __binding_1,
has_docs: __binding_2,
docs: __binding_3,
help: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_suggestions ->\n [1] attribute must be of the form {$suggestions}\n *[other] valid forms for the attribute are {$suggestions}\n }")));
;
diag.arg("num_suggestions", __binding_0);
diag.arg("suggestions", __binding_1);
diag.arg("docs", __binding_3);
if __binding_2 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <{$docs}>")));
}
if let Some(__binding_4) = __binding_4 {
diag.subdiagnostic(__binding_4);
}
diag
}
}
}
}
};Diagnostic)]
133#[diag(
134 "{$num_suggestions ->
135 [1] attribute must be of the form {$suggestions}
136 *[other] valid forms for the attribute are {$suggestions}
137 }"
138)]
139pub(crate) struct IllFormedAttributeInput {
140 pub num_suggestions: usize,
141 pub suggestions: DiagArgValue,
142 #[note("for more information, visit <{$docs}>")]
143 pub has_docs: bool,
144 pub docs: &'static str,
145 #[subdiagnostic]
146 help: Option<IllFormedAttributeInputHelp>,
147}
148
149impl IllFormedAttributeInput {
150 pub(crate) fn new(
151 suggestions: &[String],
152 docs: Option<&'static str>,
153 help: Option<&str>,
154 ) -> Self {
155 Self {
156 num_suggestions: suggestions.len(),
157 suggestions: DiagArgValue::StrListSepByAnd(
158 suggestions.iter().map(|s| ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("`{0}`", s))
})format!("`{s}`").into()).collect(),
159 ),
160 has_docs: docs.is_some(),
161 docs: docs.unwrap_or(""),
162 help: help.map(|h| IllFormedAttributeInputHelp { lint: h.to_string() }),
163 }
164 }
165}
166
167#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for IllFormedAttributeInputHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
IllFormedAttributeInputHelp { lint: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("lint".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("if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
168#[help(
169 "if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]"
170)]
171struct IllFormedAttributeInputHelp {
172 pub lint: String,
173}
174
175#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyAttributeList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EmptyAttributeList {
attr_span: __binding_0,
attr_path: __binding_1,
valid_without_list: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
let __code_1 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all\n *[other] using `{$attr_path}` with an empty list has no effect\n }")));
;
diag.arg("attr_path", __binding_1);
diag.arg("valid_without_list", __binding_2);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n [true] remove these parentheses\n *[other] remove this attribute\n }")),
__code_1, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
176#[diag("unused attribute")]
177#[note(
178 "{$valid_without_list ->
179 [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
180 *[other] using `{$attr_path}` with an empty list has no effect
181 }"
182)]
183pub(crate) struct EmptyAttributeList {
184 #[suggestion(
185 "{$valid_without_list ->
186 [true] remove these parentheses
187 *[other] remove this attribute
188 }",
189 code = "",
190 applicability = "machine-applicable"
191 )]
192 pub attr_span: Span,
193 pub attr_path: String,
194 pub valid_without_list: bool,
195}
196
197#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAttrStyle {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidAttrStyle {
name: __binding_0,
is_used_as_inner: __binding_1,
target_span: __binding_2,
target: __binding_3,
crate_root_path: __binding_4,
show_crate_root_help: __binding_5,
span: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_used_as_inner ->\n [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`\n *[other] the `#![{$name}]` attribute can only be used at the crate root\n }")));
;
diag.arg("name", __binding_0);
diag.arg("is_used_as_inner", __binding_1);
diag.arg("target", __binding_3);
diag.arg("crate_root_path", __binding_4);
if let Some(__binding_2) = __binding_2 {
diag.span_note(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute does not have an `!`, which means it is applied to this {$target}")));
}
if __binding_5 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate root is at `{$crate_root_path}`")));
}
diag.span(__binding_6);
diag
}
}
}
}
};Diagnostic)]
198#[diag(
199 "{$is_used_as_inner ->
200 [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
201 *[other] the `#![{$name}]` attribute can only be used at the crate root
202 }"
203)]
204pub(crate) struct InvalidAttrStyle {
205 pub name: String,
206 pub is_used_as_inner: bool,
207 #[note("this attribute does not have an `!`, which means it is applied to this {$target}")]
208 pub target_span: Option<Span>,
209 pub target: &'static str,
210 pub crate_root_path: String,
211 #[help("the crate root is at `{$crate_root_path}`")]
212 pub show_crate_root_help: bool,
213 #[primary_span]
214 pub span: Span,
215}
216
217#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAliasDuplicated {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAliasDuplicated { first_definition: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias is duplicated")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first defined here")));
diag
}
}
}
}
};Diagnostic)]
218#[diag("doc alias is duplicated")]
219pub(crate) struct DocAliasDuplicated {
220 #[label("first defined here")]
221 pub first_definition: Span,
222}
223
224#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgExpectsHideOrShow {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgExpectsHideOrShow => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")));
;
diag
}
}
}
}
};Diagnostic)]
225#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
226pub(crate) struct DocAutoCfgExpectsHideOrShow;
227
228#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AmbiguousDeriveHelpers {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AmbiguousDeriveHelpers => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there exists a built-in attribute with the same name")));
;
diag
}
}
}
}
};Diagnostic)]
229#[diag("there exists a built-in attribute with the same name")]
230pub(crate) struct AmbiguousDeriveHelpers;
231
232#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgHideShowUnexpectedItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgHideShowUnexpectedItem { attr_name: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or `values(...)`")));
;
diag.arg("attr_name", __binding_0);
diag
}
}
}
}
};Diagnostic)]
233#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or `values(...)`")]
234pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
235 pub attr_name: Symbol,
236}
237
238#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgHideShowValuesMix {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgHideShowValuesMix { value_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`any()` was used when other values were provided")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value declared here")));
diag
}
}
}
}
};Diagnostic)]
239#[diag("`any()` was used when other values were provided")]
240pub(crate) struct DocAutoCfgHideShowValuesMix {
241 #[label("value declared here")]
242 pub value_span: Span,
243}
244
245#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgHideShowUnexpectedItemAfterValues {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgHideShowUnexpectedItemAfterValues => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected item after `values()`")));
;
diag
}
}
}
}
};Diagnostic)]
246#[diag("unexpected item after `values()`")]
247pub(crate) struct DocAutoCfgHideShowUnexpectedItemAfterValues;
248
249#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgHideShowExpectsList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgHideShowExpectsList { attr_name: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")));
;
diag.arg("attr_name", __binding_0);
diag
}
}
}
}
};Diagnostic)]
250#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
251pub(crate) struct DocAutoCfgHideShowExpectsList {
252 pub attr_name: Symbol,
253}
254
255#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownInclude {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocUnknownInclude {
inner: __binding_0, value: __binding_1, sugg: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `include`")));
let __code_2 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("#{0}[doc = include_str!(\"{1}\")]",
__binding_0, __binding_1))
})].into_iter();
;
diag.span_suggestions_with_style(__binding_2.0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `doc = include_str!` instead")),
__code_2, __binding_2.1,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
256#[diag("unknown `doc` attribute `include`")]
257pub(crate) struct DocUnknownInclude {
258 pub inner: &'static str,
259 pub value: Symbol,
260 #[suggestion(
261 "use `doc = include_str!` instead",
262 code = "#{inner}[doc = include_str!(\"{value}\")]"
263 )]
264 pub sugg: (Span, Applicability),
265}
266
267#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownSpotlight
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocUnknownSpotlight { sugg_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `spotlight`")));
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("notable_trait"))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` was renamed to `doc(notable_trait)`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` is now a no-op")));
;
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `notable_trait` instead")),
__code_3, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::HideCodeInline);
diag
}
}
}
}
};Diagnostic)]
268#[diag("unknown `doc` attribute `spotlight`")]
269#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
270#[note("`doc(spotlight)` is now a no-op")]
271pub(crate) struct DocUnknownSpotlight {
272 #[suggestion(
273 "use `notable_trait` instead",
274 style = "short",
275 applicability = "machine-applicable",
276 code = "notable_trait"
277 )]
278 pub sugg_span: Span,
279}
280
281#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownPasses {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocUnknownPasses { name: __binding_0, note_span: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc({$name})` is now a no-op")));
;
diag.arg("name", __binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
diag
}
}
}
}
};Diagnostic)]
282#[diag("unknown `doc` attribute `{$name}`")]
283#[note(
284 "`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>"
285)]
286#[note("`doc({$name})` is now a no-op")]
287pub(crate) struct DocUnknownPasses {
288 pub name: Symbol,
289 #[label("no longer functions")]
290 pub note_span: Span,
291}
292
293#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownPlugins {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocUnknownPlugins { label_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `plugins`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(plugins)` is now a no-op")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
diag
}
}
}
}
};Diagnostic)]
294#[diag("unknown `doc` attribute `plugins`")]
295#[note(
296 "`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>"
297)]
298#[note("`doc(plugins)` is now a no-op")]
299pub(crate) struct DocUnknownPlugins {
300 #[label("no longer functions")]
301 pub label_span: Span,
302}
303
304#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownAny {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocUnknownAny { name: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
;
diag.arg("name", __binding_0);
diag
}
}
}
}
};Diagnostic)]
305#[diag("unknown `doc` attribute `{$name}`")]
306pub(crate) struct DocUnknownAny {
307 pub name: Symbol,
308}
309
310#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgWrongLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgWrongLiteral => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected boolean for `#[doc(auto_cfg = ...)]`")));
;
diag
}
}
}
}
};Diagnostic)]
311#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
312pub(crate) struct DocAutoCfgWrongLiteral;
313
314#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAutoCfgHideShowNoIdentBeforeValues {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAutoCfgHideShowNoIdentBeforeValues => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there must be at least one identifier before `values(...)`")));
;
diag
}
}
}
}
};Diagnostic)]
315#[diag("there must be at least one identifier before `values(...)`")]
316pub(crate) struct DocAutoCfgHideShowNoIdentBeforeValues;
317
318#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestTakesList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocTestTakesList => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(test(...)]` takes a list of attributes")));
;
diag
}
}
}
}
};Diagnostic)]
319#[diag("`#[doc(test(...)]` takes a list of attributes")]
320pub(crate) struct DocTestTakesList;
321
322#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestUnknown {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocTestUnknown { name: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc(test)` attribute `{$name}`")));
;
diag.arg("name", __binding_0);
diag
}
}
}
}
};Diagnostic)]
323#[diag("unknown `doc(test)` attribute `{$name}`")]
324pub(crate) struct DocTestUnknown {
325 pub name: Symbol,
326}
327
328#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocTestLiteral => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(test(...)]` does not take a literal")));
;
diag
}
}
}
}
};Diagnostic)]
329#[diag("`#![doc(test(...)]` does not take a literal")]
330pub(crate) struct DocTestLiteral;
331
332#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocInlineConflict {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocInlineConflict { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting doc inlining attributes")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove one of the conflicting attributes")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
333#[diag("conflicting doc inlining attributes")]
334#[help("remove one of the conflicting attributes")]
335pub(crate) struct DocInlineConflict {
336 #[primary_span]
337 pub spans: MultiSpan,
338}
339
340#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocInlineOnlyUse {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocInlineOnlyUse {
attr_span: __binding_0, item_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied to a `use` item")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only applicable on `use` items")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `use` item")));
diag
}
}
}
}
};Diagnostic)]
341#[diag("this attribute can only be applied to a `use` item")]
342#[note(
343 "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information"
344)]
345pub(crate) struct DocInlineOnlyUse {
346 #[label("only applicable on `use` items")]
347 pub attr_span: Span,
348 #[label("not a `use` item")]
349 pub item_span: Span,
350}
351
352#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AttrCrateLevelOnly {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AttrCrateLevelOnly { attr_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied at the crate level")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
353#[diag("this attribute can only be applied at the crate level")]
354#[note(
355 "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information"
356)]
357pub(crate) struct AttrCrateLevelOnly {
358 #[primary_span]
359 pub attr_span: Span,
360}
361
362#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DoNotRecommendDoesNotExpectArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DoNotRecommendDoesNotExpectArgs => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::do_not_recommend]` does not expect any arguments")));
;
diag
}
}
}
}
};Diagnostic)]
363#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")]
364pub(crate) struct DoNotRecommendDoesNotExpectArgs;
365
366#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
OpaqueDoesNotExpectArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
OpaqueDoesNotExpectArgs => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::opaque]` does not expect any arguments")));
;
diag
}
}
}
}
};Diagnostic)]
367#[diag("`#[diagnostic::opaque]` does not expect any arguments")]
368pub(crate) struct OpaqueDoesNotExpectArgs;
369
370#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownCrateTypes {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownCrateTypes { sugg: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `crate_type` value")));
;
if let Some(__binding_0) = __binding_0 {
diag.subdiagnostic(__binding_0);
}
diag
}
}
}
}
};Diagnostic)]
371#[diag("invalid `crate_type` value")]
372pub(crate) struct UnknownCrateTypes {
373 #[subdiagnostic]
374 pub sugg: Option<UnknownCrateTypesSuggestion>,
375}
376
377#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnknownCrateTypesSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnknownCrateTypesSuggestion {
span: __binding_0, snippet: __binding_1 } => {
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_4, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
378#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")]
379pub(crate) struct UnknownCrateTypesSuggestion {
380 #[primary_span]
381 pub span: Span,
382 pub snippet: Symbol,
383}
384
385#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MalformedDoc {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MalformedDoc => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `doc` attribute input")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag
}
}
}
}
};Diagnostic)]
386#[diag("malformed `doc` attribute input")]
387#[warning(
388 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
389)]
390pub(crate) struct MalformedDoc;
391
392#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedNoArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedNoArgs => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("didn't expect any arguments here")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag
}
}
}
}
};Diagnostic)]
393#[diag("didn't expect any arguments here")]
394#[warning(
395 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
396)]
397pub(crate) struct ExpectedNoArgs;
398
399#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedNameValue {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedNameValue => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected this to be of the form `... = \"...\"`")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag
}
}
}
}
};Diagnostic)]
400#[diag("expected this to be of the form `... = \"...\"`")]
401#[warning(
402 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
403)]
404pub(crate) struct ExpectedNameValue;
405
406#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DuplicateNotableTraitColor {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DuplicateNotableTraitColor => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only one color should be specified")));
;
diag
}
}
}
}
};Diagnostic)]
407#[diag("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")]
408#[warning(
409 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
410)]
411#[help("only one color should be specified")]
412pub(crate) struct DuplicateNotableTraitColor;
413
414#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InvalidNotableTraitAttr {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidNotableTraitAttr => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag
}
}
}
}
};Diagnostic)]
415#[diag("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")]
416#[warning(
417 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
418)]
419pub(crate) struct InvalidNotableTraitAttr;
420
421#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InvalidNotableTraitColor {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidNotableTraitColor => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown color in `doc(notable_trait(color=\"...\"))`")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected grey, gray, red, green, yellow, blue, magenta, cyan, or transparent")));
;
diag
}
}
}
}
};Diagnostic)]
422#[diag("unknown color in `doc(notable_trait(color=\"...\"))`")]
423#[warning(
424 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
425)]
426#[help("expected grey, gray, red, green, yellow, blue, magenta, cyan, or transparent")]
427pub(crate) struct InvalidNotableTraitColor;
428
429#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MalFormedDiagnosticAttributeLint {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MalFormedDiagnosticAttributeLint {
attribute: __binding_0,
options: __binding_1,
span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `{$attribute}` attribute")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$options}")));
;
diag.arg("attribute", __binding_0);
diag.arg("options", __binding_1);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid option found here")));
diag
}
}
}
}
};Diagnostic)]
430#[diag("malformed `{$attribute}` attribute")]
431#[help("{$options}")]
432pub(crate) struct MalFormedDiagnosticAttributeLint {
433 pub attribute: &'static str,
434 pub options: &'static str,
435 #[label("invalid option found here")]
436 pub span: Span,
437}
438
439#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for WrappedParserError {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
WrappedParserError {
description: __binding_0,
span: __binding_1,
label: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$description}")));
;
diag.arg("description", __binding_0);
diag.arg("label", __binding_2);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$label}")));
diag
}
}
}
}
};Diagnostic)]
440#[diag("{$description}")]
441pub(crate) struct WrappedParserError {
442 pub description: String,
443 #[label("{$label}")]
444 pub span: Span,
445 pub label: String,
446}
447
448#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
IgnoredDiagnosticOption {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
IgnoredDiagnosticOption {
option_name: __binding_0,
first_span: __binding_1,
later_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is ignored due to previous definition of `{$option_name}`")));
;
diag.arg("option_name", __binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is first declared here")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is later redundantly declared here")));
diag
}
}
}
}
};Diagnostic)]
449#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
450pub(crate) struct IgnoredDiagnosticOption {
451 pub option_name: Symbol,
452 #[label("`{$option_name}` is first declared here")]
453 pub first_span: Span,
454 #[label("`{$option_name}` is later redundantly declared here")]
455 pub later_span: Span,
456}
457
458#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MissingOptionsForDiagnosticAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingOptionsForDiagnosticAttribute {
attribute: __binding_0, options: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing options for `{$attribute}` attribute")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$options}")));
;
diag.arg("attribute", __binding_0);
diag.arg("options", __binding_1);
diag
}
}
}
}
};Diagnostic)]
459#[diag("missing options for `{$attribute}` attribute")]
460#[help("{$options}")]
461pub(crate) struct MissingOptionsForDiagnosticAttribute {
462 pub attribute: &'static str,
463 pub options: &'static str,
464}
465
466#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NonMetaItemDiagnosticAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonMetaItemDiagnosticAttribute => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal or missing delimiter")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma")));
;
diag
}
}
}
}
};Diagnostic)]
467#[diag("expected a literal or missing delimiter")]
468#[help(
469 "only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma"
470)]
471pub(crate) struct NonMetaItemDiagnosticAttribute;
472
473#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatWarning {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FormatWarning::PositionalArgument { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional arguments are not permitted in diagnostic attributes")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can print empty braces by escaping them")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
diag
}
FormatWarning::IndexedArgument { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("indexed format arguments are not permitted in diagnostic attributes")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
diag
}
FormatWarning::InvalidSpecifier { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("format specifiers are not permitted in diagnostic attributes")));
;
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format specifier")));
diag
}
FormatWarning::DisallowedPlaceholder {
span: __binding_0, attr: __binding_1, allowed: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this format argument is not allowed in `#[{$attr}]`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$allowed}")));
;
diag.arg("attr", __binding_1);
diag.arg("allowed", __binding_2);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
diag
}
}
}
}
};Diagnostic, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for FormatWarning {
}
#[automatically_derived]impl ::core::clone::Clone for FormatWarning {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'static str>;
let _: ::core::clone::AssertParamIsClone<&'static str>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for FormatWarning { }Copy)]
474pub(crate) enum FormatWarning {
475 #[diag("positional arguments are not permitted in diagnostic attributes")]
476 #[help("you can print empty braces by escaping them")]
477 PositionalArgument {
478 #[label("remove this format argument")]
479 span: Span,
480 },
481
482 #[diag("indexed format arguments are not permitted in diagnostic attributes")]
483 IndexedArgument {
484 #[label("remove this format argument")]
485 span: Span,
486 },
487
488 #[diag("format specifiers are not permitted in diagnostic attributes")]
489 InvalidSpecifier {
490 #[label("remove this format specifier")]
491 span: Span,
492 },
493
494 #[diag("this format argument is not allowed in `#[{$attr}]`")]
495 #[note("{$allowed}")]
496 DisallowedPlaceholder {
497 #[label("remove this format argument")]
498 span: Span,
499 attr: &'static str,
500 allowed: &'static str,
501 },
502}
503
504#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnexpectedCfgCargoHelp::LintCfg {
cargo_toml_lint_cfg: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("cargo_toml_lint_cfg".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("consider using a Cargo feature instead")),
&sub_args);
diag.help(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")),
&sub_args);
diag.help(__message);
}
UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
cargo_toml_lint_cfg: __binding_0,
build_rs_println: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("cargo_toml_lint_cfg".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("build_rs_println".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("consider using a Cargo feature instead")),
&sub_args);
diag.help(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")),
&sub_args);
diag.help(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding `{$build_rs_println}` to the top of the `build.rs`")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
505pub(crate) enum UnexpectedCfgCargoHelp {
506 #[help("consider using a Cargo feature instead")]
507 #[help(
508 "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
509 )]
510 LintCfg { cargo_toml_lint_cfg: String },
511 #[help("consider using a Cargo feature instead")]
512 #[help(
513 "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
514 )]
515 #[help("or consider adding `{$build_rs_println}` to the top of the `build.rs`")]
516 LintCfgAndBuildRs { cargo_toml_lint_cfg: String, build_rs_println: String },
517}
518
519impl UnexpectedCfgCargoHelp {
520 fn cargo_toml_lint_cfg(unescaped: &str) -> String {
521 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\'{0}\'] }}",
unescaped))
})format!(
522 "\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{unescaped}'] }}"
523 )
524 }
525
526 pub(crate) fn lint_cfg(unescaped: &str) -> Self {
527 UnexpectedCfgCargoHelp::LintCfg {
528 cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
529 }
530 }
531
532 pub(crate) fn lint_cfg_and_build_rs(unescaped: &str, escaped: &str) -> Self {
533 UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
534 cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
535 build_rs_println: ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("println!(\"cargo::rustc-check-cfg={0}\");",
escaped))
})format!("println!(\"cargo::rustc-check-cfg={escaped}\");"),
536 }
537 }
538}
539
540#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnexpectedCfgRustcHelp { cmdline_arg: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("cmdline_arg".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("to expect this configuration use `{$cmdline_arg}`")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
541#[help("to expect this configuration use `{$cmdline_arg}`")]
542pub(crate) struct UnexpectedCfgRustcHelp {
543 pub cmdline_arg: String,
544}
545
546impl UnexpectedCfgRustcHelp {
547 pub(crate) fn new(unescaped: &str) -> Self {
548 Self { cmdline_arg: ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("--check-cfg={0}", unescaped))
})format!("--check-cfg={unescaped}") }
549 }
550}
551
552#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcMacroHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnexpectedCfgRustcMacroHelp {
macro_kind: __binding_0, macro_name: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("macro_kind".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("macro_name".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("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")),
&sub_args);
diag.note(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
553#[note(
554 "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
555)]
556#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
557pub(crate) struct UnexpectedCfgRustcMacroHelp {
558 pub macro_kind: &'static str,
559 pub macro_name: Symbol,
560}
561
562#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoMacroHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnexpectedCfgCargoMacroHelp {
macro_kind: __binding_0, macro_name: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("macro_kind".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("macro_name".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("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")),
&sub_args);
diag.note(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
563#[note(
564 "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
565)]
566#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
567pub(crate) struct UnexpectedCfgCargoMacroHelp {
568 pub macro_kind: &'static str,
569 pub macro_name: Symbol,
570}
571
572#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnexpectedCfgName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnexpectedCfgName {
code_sugg: __binding_0,
invocation_help: __binding_1,
name: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition name: `{$name}`")));
;
diag.arg("name", __binding_2);
diag.subdiagnostic(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
573#[diag("unexpected `cfg` condition name: `{$name}`")]
574pub(crate) struct UnexpectedCfgName {
575 #[subdiagnostic]
576 pub code_sugg: unexpected_cfg_name::CodeSuggestion,
577 #[subdiagnostic]
578 pub invocation_help: unexpected_cfg_name::InvocationHelp,
579
580 pub name: Symbol,
581}
582
583pub(crate) mod unexpected_cfg_name {
584 use rustc_errors::DiagSymbolList;
585 use rustc_macros::Subdiagnostic;
586 use rustc_span::{Ident, Span, Symbol};
587
588 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CodeSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
CodeSuggestion::DefineFeatures => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")),
&sub_args);
diag.help(__message);
}
CodeSuggestion::VersionSyntax {
between_name_and_value: __binding_0,
after_value: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_5 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("("))
});
let __code_6 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_5));
suggestions.push((__binding_1, __code_6));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a similar config predicate: `version(\"..\")`")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
CodeSuggestion::SimilarNameAndValue {
span: __binding_0, code: __binding_1 } => {
let __code_7 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and value")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_7, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
CodeSuggestion::SimilarNameNoValue {
span: __binding_0, code: __binding_1 } => {
let __code_8 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and no value")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_8, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
CodeSuggestion::SimilarNameDifferentValues {
span: __binding_0, code: __binding_1, expected: __binding_2
} => {
let __code_9 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
if let Some(__binding_2) = __binding_2 {
__binding_2.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and different values")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_9, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
CodeSuggestion::SimilarName {
span: __binding_0, code: __binding_1, expected: __binding_2
} => {
let __code_10 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
if let Some(__binding_2) = __binding_2 {
__binding_2.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_10, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
CodeSuggestion::SimilarValues {
with_similar_values: __binding_0,
expected_names: __binding_1 } => {
for __binding_0 in __binding_0 {
__binding_0.add_to_diag(diag);
}
if let Some(__binding_1) = __binding_1 {
__binding_1.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
}
CodeSuggestion::BooleanLiteral {
span: __binding_0, literal: __binding_1 } => {
let __code_11 =
[::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("literal".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("you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_11, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
}
}
}
};Subdiagnostic)]
589 pub(crate) enum CodeSuggestion {
590 #[help("consider defining some features in `Cargo.toml`")]
591 DefineFeatures,
592 #[multipart_suggestion(
593 "there is a similar config predicate: `version(\"..\")`",
594 applicability = "machine-applicable"
595 )]
596 VersionSyntax {
597 #[suggestion_part(code = "(")]
598 between_name_and_value: Span,
599 #[suggestion_part(code = ")")]
600 after_value: Span,
601 },
602 #[suggestion(
603 "there is a config with a similar name and value",
604 applicability = "maybe-incorrect",
605 code = "{code}"
606 )]
607 SimilarNameAndValue {
608 #[primary_span]
609 span: Span,
610 code: String,
611 },
612 #[suggestion(
613 "there is a config with a similar name and no value",
614 applicability = "maybe-incorrect",
615 code = "{code}"
616 )]
617 SimilarNameNoValue {
618 #[primary_span]
619 span: Span,
620 code: String,
621 },
622 #[suggestion(
623 "there is a config with a similar name and different values",
624 applicability = "maybe-incorrect",
625 code = "{code}"
626 )]
627 SimilarNameDifferentValues {
628 #[primary_span]
629 span: Span,
630 code: String,
631 #[subdiagnostic]
632 expected: Option<ExpectedValues>,
633 },
634 #[suggestion(
635 "there is a config with a similar name",
636 applicability = "maybe-incorrect",
637 code = "{code}"
638 )]
639 SimilarName {
640 #[primary_span]
641 span: Span,
642 code: String,
643 #[subdiagnostic]
644 expected: Option<ExpectedValues>,
645 },
646 SimilarValues {
647 #[subdiagnostic]
648 with_similar_values: Vec<FoundWithSimilarValue>,
649 #[subdiagnostic]
650 expected_names: Option<ExpectedNames>,
651 },
652 #[suggestion(
653 "you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally",
654 applicability = "machine-applicable",
655 style = "verbose",
656 code = "{literal}"
657 )]
658 BooleanLiteral {
659 #[primary_span]
660 span: Span,
661 literal: bool,
662 },
663 }
664
665 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ExpectedValues {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ExpectedValues {
best_match: __binding_0, possibilities: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("best_match".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("possibilities".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("expected values for `{$best_match}` are: {$possibilities}")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
666 #[help("expected values for `{$best_match}` are: {$possibilities}")]
667 pub(crate) struct ExpectedValues {
668 pub best_match: Symbol,
669 pub possibilities: DiagSymbolList,
670 }
671
672 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for FoundWithSimilarValue {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
FoundWithSimilarValue { span: __binding_0, code: __binding_1
} => {
let __code_12 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found config with similar value")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_12, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
673 #[suggestion(
674 "found config with similar value",
675 applicability = "maybe-incorrect",
676 code = "{code}"
677 )]
678 pub(crate) struct FoundWithSimilarValue {
679 #[primary_span]
680 pub span: Span,
681 pub code: String,
682 }
683
684 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ExpectedNames {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ExpectedNames {
possibilities: __binding_0, and_more: __binding_1 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("possibilities".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("and_more".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("expected names are: {$possibilities}{$and_more ->\n [0] {\"\"}\n *[other] {\" \"}and {$and_more} more\n }")),
&sub_args);
diag.help_once(__message);
}
}
}
}
};Subdiagnostic)]
685 #[help_once(
686 "expected names are: {$possibilities}{$and_more ->
687 [0] {\"\"}
688 *[other] {\" \"}and {$and_more} more
689 }"
690 )]
691 pub(crate) struct ExpectedNames {
692 pub possibilities: DiagSymbolList<Ident>,
693 pub and_more: usize,
694 }
695
696 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvocationHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvocationHelp::Cargo {
macro_help: __binding_0, help: __binding_1 } => {
if let Some(__binding_0) = __binding_0 {
__binding_0.add_to_diag(diag);
}
if let Some(__binding_1) = __binding_1 {
__binding_1.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")),
&sub_args);
diag.note(__message);
}
InvocationHelp::Rustc {
macro_help: __binding_0, help: __binding_1 } => {
if let Some(__binding_0) = __binding_0 {
__binding_0.add_to_diag(diag);
}
__binding_1.add_to_diag(diag);
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
697 pub(crate) enum InvocationHelp {
698 #[note(
699 "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
700 )]
701 Cargo {
702 #[subdiagnostic]
703 macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
704 #[subdiagnostic]
705 help: Option<super::UnexpectedCfgCargoHelp>,
706 },
707 #[note(
708 "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
709 )]
710 Rustc {
711 #[subdiagnostic]
712 macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
713 #[subdiagnostic]
714 help: super::UnexpectedCfgRustcHelp,
715 },
716 }
717}
718
719#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnexpectedCfgValue {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnexpectedCfgValue {
code_sugg: __binding_0,
invocation_help: __binding_1,
has_value: __binding_2,
value: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition value: {$has_value ->\n [true] `{$value}`\n *[false] (none)\n }")));
;
diag.arg("has_value", __binding_2);
diag.arg("value", __binding_3);
diag.subdiagnostic(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
720#[diag(
721 "unexpected `cfg` condition value: {$has_value ->
722 [true] `{$value}`
723 *[false] (none)
724 }"
725)]
726pub(crate) struct UnexpectedCfgValue {
727 #[subdiagnostic]
728 pub code_sugg: unexpected_cfg_value::CodeSuggestion,
729 #[subdiagnostic]
730 pub invocation_help: unexpected_cfg_value::InvocationHelp,
731
732 pub has_value: bool,
733 pub value: String,
734}
735
736pub(crate) mod unexpected_cfg_value {
737 use rustc_errors::DiagSymbolList;
738 use rustc_macros::Subdiagnostic;
739 use rustc_span::{Span, Symbol};
740
741 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CodeSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
CodeSuggestion::ChangeValue {
expected_values: __binding_0, suggestion: __binding_1 } => {
__binding_0.add_to_diag(diag);
if let Some(__binding_1) = __binding_1 {
__binding_1.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
}
CodeSuggestion::RemoveValue {
suggestion: __binding_0, name: __binding_1 } => {
if let Some(__binding_0) = __binding_0 {
__binding_0.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".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("no expected value for `{$name}`")),
&sub_args);
diag.note(__message);
}
CodeSuggestion::RemoveCondition {
suggestion: __binding_0, name: __binding_1 } => {
__binding_0.add_to_diag(diag);
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".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("no expected values for `{$name}`")),
&sub_args);
diag.note(__message);
}
CodeSuggestion::ChangeName { suggestions: __binding_0 } => {
for __binding_0 in __binding_0 {
__binding_0.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
}
}
}
}
};Subdiagnostic)]
742 pub(crate) enum CodeSuggestion {
743 ChangeValue {
744 #[subdiagnostic]
745 expected_values: ExpectedValues,
746 #[subdiagnostic]
747 suggestion: Option<ChangeValueSuggestion>,
748 },
749 #[note("no expected value for `{$name}`")]
750 RemoveValue {
751 #[subdiagnostic]
752 suggestion: Option<RemoveValueSuggestion>,
753
754 name: Symbol,
755 },
756 #[note("no expected values for `{$name}`")]
757 RemoveCondition {
758 #[subdiagnostic]
759 suggestion: RemoveConditionSuggestion,
760
761 name: Symbol,
762 },
763 ChangeName {
764 #[subdiagnostic]
765 suggestions: Vec<ChangeNameSuggestion>,
766 },
767 }
768
769 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ChangeValueSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ChangeValueSuggestion::SimilarName {
span: __binding_0, best_match: __binding_1 } => {
let __code_13 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a expected value with a similar name")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_13, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
ChangeValueSuggestion::SpecifyValue {
span: __binding_0, first_possibility: __binding_1 } => {
let __code_14 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = \"{0}\"",
__binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specify a config value")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_14, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
770 pub(crate) enum ChangeValueSuggestion {
771 #[suggestion(
772 "there is a expected value with a similar name",
773 code = r#""{best_match}""#,
774 applicability = "maybe-incorrect"
775 )]
776 SimilarName {
777 #[primary_span]
778 span: Span,
779 best_match: Symbol,
780 },
781 #[suggestion(
782 "specify a config value",
783 code = r#" = "{first_possibility}""#,
784 applicability = "maybe-incorrect"
785 )]
786 SpecifyValue {
787 #[primary_span]
788 span: Span,
789 first_possibility: Symbol,
790 },
791 }
792
793 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for RemoveValueSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
RemoveValueSuggestion { 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 value")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_15, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
794 #[suggestion("remove the value", code = "", applicability = "maybe-incorrect")]
795 pub(crate) struct RemoveValueSuggestion {
796 #[primary_span]
797 pub span: Span,
798 }
799
800 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for RemoveConditionSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
RemoveConditionSuggestion { span: __binding_0 } => {
let __code_16 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the condition")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_16, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
801 #[suggestion("remove the condition", code = "", applicability = "maybe-incorrect")]
802 pub(crate) struct RemoveConditionSuggestion {
803 #[primary_span]
804 pub span: Span,
805 }
806
807 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ExpectedValues {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ExpectedValues {
name: __binding_0,
have_none_possibility: __binding_1,
possibilities: __binding_2,
and_more: __binding_3 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
&mut diag.long_ty_path));
sub_args.insert("have_none_possibility".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
sub_args.insert("possibilities".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
&mut diag.long_ty_path));
sub_args.insert("and_more".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("expected values for `{$name}` are: {$have_none_possibility ->\n [true] {\"(none), \"}\n *[false] {\"\"}\n }{$possibilities}{$and_more ->\n [0] {\"\"}\n *[other] {\" \"}and {$and_more} more\n }")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
808 #[note(
809 "expected values for `{$name}` are: {$have_none_possibility ->
810 [true] {\"(none), \"}
811 *[false] {\"\"}
812 }{$possibilities}{$and_more ->
813 [0] {\"\"}
814 *[other] {\" \"}and {$and_more} more
815 }"
816 )]
817 pub(crate) struct ExpectedValues {
818 pub name: Symbol,
819 pub have_none_possibility: bool,
820 pub possibilities: DiagSymbolList,
821 pub and_more: usize,
822 }
823
824 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ChangeNameSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ChangeNameSuggestion {
span: __binding_0, name: __binding_1, value: __binding_2 }
=> {
let __code_17 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
})].into_iter();
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".into(),
rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
&mut diag.long_ty_path));
sub_args.insert("value".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("`{$value}` is an expected value for `{$name}`")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_17, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
}
}
}
}
};Subdiagnostic)]
825 #[suggestion(
826 "`{$value}` is an expected value for `{$name}`",
827 code = "{name}",
828 applicability = "maybe-incorrect",
829 style = "verbose"
830 )]
831 pub(crate) struct ChangeNameSuggestion {
832 #[primary_span]
833 pub span: Span,
834 pub name: Symbol,
835 pub value: Symbol,
836 }
837
838 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvocationHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvocationHelp::Cargo {
help: __binding_0, macro_help: __binding_1 } => {
if let Some(__binding_0) = __binding_0 {
__binding_0.add_to_diag(diag);
}
if let Some(__binding_1) = __binding_1 {
__binding_1.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")),
&sub_args);
diag.note(__message);
}
InvocationHelp::Rustc {
help: __binding_0, macro_help: __binding_1 } => {
if let Some(__binding_0) = __binding_0 {
__binding_0.add_to_diag(diag);
}
if let Some(__binding_1) = __binding_1 {
__binding_1.add_to_diag(diag);
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
839 pub(crate) enum InvocationHelp {
840 #[note(
841 "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
842 )]
843 Cargo {
844 #[subdiagnostic]
845 help: Option<CargoHelp>,
846 #[subdiagnostic]
847 macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
848 },
849 #[note(
850 "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
851 )]
852 Rustc {
853 #[subdiagnostic]
854 help: Option<super::UnexpectedCfgRustcHelp>,
855 #[subdiagnostic]
856 macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
857 },
858 }
859
860 #[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CargoHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
CargoHelp::AddFeature { value: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("value".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("consider adding `{$value}` as a feature in `Cargo.toml`")),
&sub_args);
diag.help(__message);
}
CargoHelp::DefineFeatures => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")),
&sub_args);
diag.help(__message);
}
CargoHelp::Other(__binding_0) => {
__binding_0.add_to_diag(diag);
let mut sub_args = rustc_errors::DiagArgMap::default();
}
}
}
}
};Subdiagnostic)]
861 pub(crate) enum CargoHelp {
862 #[help("consider adding `{$value}` as a feature in `Cargo.toml`")]
863 AddFeature {
864 value: Symbol,
865 },
866 #[help("consider defining some features in `Cargo.toml`")]
867 DefineFeatures,
868 Other(#[subdiagnostic] super::UnexpectedCfgCargoHelp),
869 }
870}
871
872#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidOnClause {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidOnClause::Empty { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty `on`-clause in `#[rustc_on_unimplemented]`")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty `on`-clause here")));
diag
}
InvalidOnClause::ExpectedOnePredInNot { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a single predicate in `not(..)`")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected quantity of predicates here")));
diag
}
InvalidOnClause::UnsupportedLiteral { span: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literals inside `on`-clauses are not supported")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected literal here")));
diag
}
InvalidOnClause::ExpectedIdentifier {
span: __binding_0, path: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected an identifier inside this `on`-clause")));
;
diag.arg("path", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected an identifier here, not `{$path}`")));
diag
}
InvalidOnClause::InvalidPredicate {
span: __binding_0, invalid_pred: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this predicate is invalid")));
;
diag.arg("invalid_pred", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")));
diag
}
InvalidOnClause::InvalidFlag {
span: __binding_0, invalid_flag: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid flag in `on`-clause")));
;
diag.arg("invalid_flag", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`")));
diag
}
}
}
}
};Diagnostic)]
873pub(crate) enum InvalidOnClause {
874 #[diag("empty `on`-clause in `#[rustc_on_unimplemented]`")]
875 Empty {
876 #[primary_span]
877 #[label("empty `on`-clause here")]
878 span: Span,
879 },
880 #[diag("expected a single predicate in `not(..)`")]
881 ExpectedOnePredInNot {
882 #[primary_span]
883 #[label("unexpected quantity of predicates here")]
884 span: Span,
885 },
886 #[diag("literals inside `on`-clauses are not supported")]
887 UnsupportedLiteral {
888 #[primary_span]
889 #[label("unexpected literal here")]
890 span: Span,
891 },
892 #[diag("expected an identifier inside this `on`-clause")]
893 ExpectedIdentifier {
894 #[primary_span]
895 #[label("expected an identifier here, not `{$path}`")]
896 span: Span,
897 path: AttrPath,
898 },
899 #[diag("this predicate is invalid")]
900 InvalidPredicate {
901 #[primary_span]
902 #[label("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")]
903 span: Span,
904 invalid_pred: Symbol,
905 },
906 #[diag("invalid flag in `on`-clause")]
907 InvalidFlag {
908 #[primary_span]
909 #[label(
910 "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
911 )]
912 span: Span,
913 invalid_flag: Symbol,
914 },
915}
916
917#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeAttribute { attr_path: __binding_0, note: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of the unsafe `{$attr_path}` attribute")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$note}")));
;
diag.arg("attr_path", __binding_0);
diag.arg("note", __binding_1);
diag
}
}
}
}
};Diagnostic)]
918#[diag("usage of the unsafe `{$attr_path}` attribute")]
919#[note("{$note}")]
920pub(crate) struct UnsafeAttribute {
921 pub attr_path: AttrPath,
922 pub note: &'static str,
923}
924
925#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnknownExternLangItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownExternLangItem {
span: __binding_0, lang_item: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown external lang item: `{$lang_item}`")));
diag.code(E0264);
;
diag.arg("lang_item", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
926#[diag("unknown external lang item: `{$lang_item}`", code = E0264)]
927pub(crate) struct UnknownExternLangItem {
928 #[primary_span]
929 pub span: Span,
930 pub lang_item: Symbol,
931}
932
933#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DuplicateTool {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DuplicateTool {
span: __binding_0,
tool: __binding_1,
old_ident_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate tool `{$tool}` registered")));
;
diag.arg("tool", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("already registered here")));
diag
}
}
}
}
};Diagnostic)]
934#[diag("duplicate tool `{$tool}` registered")]
935pub(crate) struct DuplicateTool {
936 #[primary_span]
937 pub(crate) span: Span,
938 pub(crate) tool: Ident,
939 #[label("already registered here")]
940 pub(crate) old_ident_span: Span,
941}
942
943#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ToolReserved {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ToolReserved { span: __binding_0, tool: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("tool `{$tool}` is reserved and cannot be registered")));
;
diag.arg("tool", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
944#[diag("tool `{$tool}` is reserved and cannot be registered")]
945pub(crate) struct ToolReserved {
946 #[primary_span]
947 pub(crate) span: Span,
948 pub(crate) tool: Ident,
949}
950
951#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnknownDiagnosticAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownDiagnosticAttribute { typo: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown diagnostic attribute")));
;
if let Some(__binding_0) = __binding_0 {
diag.subdiagnostic(__binding_0);
}
diag
}
}
}
}
};Diagnostic)]
952#[diag("unknown diagnostic attribute")]
953pub(crate) struct UnknownDiagnosticAttribute {
954 #[subdiagnostic]
955 pub typo: Option<UnknownDiagnosticAttributeTypo>,
956}
957
958#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnknownDiagnosticAttributeTypo {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnknownDiagnosticAttributeTypo {
span: __binding_0, typo_name: __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();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an attribute with a similar name exists")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_18, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
}
}
}
};Subdiagnostic)]
959#[suggestion(
960 "an attribute with a similar name exists",
961 style = "verbose",
962 code = "{typo_name}",
963 applicability = "machine-applicable"
964)]
965pub(crate) struct UnknownDiagnosticAttributeTypo {
966 #[primary_span]
967 pub span: Span,
968 pub typo_name: Symbol,
969}
970
971#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnstableDiagnosticAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnstableDiagnosticAttribute {
nightly_build: __binding_0, feature: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown diagnostic attribute")));
;
diag.arg("feature", __binding_1);
if __binding_0 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is an experimental diagnostic attribute")));
}
if __binding_0 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature({$feature})]` to the crate attributes to enable")));
}
diag
}
}
}
}
};Diagnostic)]
972#[diag("unknown diagnostic attribute")]
973pub(crate) struct UnstableDiagnosticAttribute {
974 #[note("this is an experimental diagnostic attribute")]
975 #[help("add `#![feature({$feature})]` to the crate attributes to enable")]
976 pub nightly_build: bool,
977 pub feature: Symbol,
978}
979
980#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InlineForceInlineConflict {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InlineForceInlineConflict {
force_inline_span: __binding_0, inline_span: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_force_inline]` and `#[inline]` cannot be used together")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the inline attribute is specified here")));
diag
}
}
}
}
};Diagnostic)]
981#[diag("`#[rustc_force_inline]` and `#[inline]` cannot be used together")]
982pub(crate) struct InlineForceInlineConflict {
983 #[primary_span]
984 pub force_inline_span: Span,
985 #[label("the inline attribute is specified here")]
986 pub inline_span: Span,
987}
988
989#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InlineIgnoredForExported {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InlineIgnoredForExported => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[inline]` is ignored on externally exported functions")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`")));
;
diag
}
}
}
}
};Diagnostic)]
990#[diag("`#[inline]` is ignored on externally exported functions")]
991#[help(
992 "externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`"
993)]
994pub(crate) struct InlineIgnoredForExported;
995
996#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for BothFfiConstAndPure
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BothFfiConstAndPure { attr_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[ffi_const]` function cannot be `#[ffi_pure]`")));
diag.code(E0757);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
997#[diag("`#[ffi_const]` function cannot be `#[ffi_pure]`", code = E0757)]
998pub(crate) struct BothFfiConstAndPure {
999 #[primary_span]
1000 pub attr_span: Span,
1001}
1002
1003#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for RustcPubTransparent
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcPubTransparent {
attr_span: __binding_0, span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to `#[repr(transparent)]` types")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `#[repr(transparent)]` type")));
diag
}
}
}
}
};Diagnostic)]
1004#[diag("attribute should be applied to `#[repr(transparent)]` types")]
1005pub(crate) struct RustcPubTransparent {
1006 #[primary_span]
1007 pub attr_span: Span,
1008 #[label("not a `#[repr(transparent)]` type")]
1009 pub span: Span,
1010}
1011
1012#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MacroOnlyAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MacroOnlyAttribute {
attr_span: __binding_0, span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a macro")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a macro")));
diag
}
}
}
}
};Diagnostic)]
1013#[diag("attribute should be applied to a macro")]
1014pub(crate) struct MacroOnlyAttribute {
1015 #[primary_span]
1016 pub attr_span: Span,
1017 #[label("not a macro")]
1018 pub span: Span,
1019}
1020
1021#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
DocAliasEmpty<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAliasEmpty { span: __binding_0, attr_str: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} attribute cannot have empty value")));
;
diag.arg("attr_str", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1022#[diag("{$attr_str} attribute cannot have empty value")]
1023pub(crate) struct DocAliasEmpty<'a> {
1024 #[primary_span]
1025 pub span: Span,
1026 pub attr_str: &'a str,
1027}
1028
1029#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
DocAliasBadChar<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAliasBadChar {
span: __binding_0, attr_str: __binding_1, char_: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$char_} character isn't allowed in {$attr_str}")));
;
diag.arg("attr_str", __binding_1);
diag.arg("char_", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1030#[diag("{$char_} character isn't allowed in {$attr_str}")]
1031pub(crate) struct DocAliasBadChar<'a> {
1032 #[primary_span]
1033 pub span: Span,
1034 pub attr_str: &'a str,
1035 pub char_: char,
1036}
1037
1038#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
DocAliasStartEnd<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAliasStartEnd { span: __binding_0, attr_str: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} cannot start or end with ' '")));
;
diag.arg("attr_str", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1039#[diag("{$attr_str} cannot start or end with ' '")]
1040pub(crate) struct DocAliasStartEnd<'a> {
1041 #[primary_span]
1042 pub span: Span,
1043 pub attr_str: &'a str,
1044}
1045
1046#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
CguFieldsMissing<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CguFieldsMissing {
span: __binding_0, name: __binding_1, field: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name})]` is missing a `{$field}` argument")));
;
diag.arg("name", __binding_1);
diag.arg("field", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1047#[diag("`#[{$name})]` is missing a `{$field}` argument")]
1048pub(crate) struct CguFieldsMissing<'a> {
1049 #[primary_span]
1050 pub span: Span,
1051 pub name: &'a AttrPath,
1052 pub field: Symbol,
1053}
1054
1055#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotCrateLevel
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAttrNotCrateLevel {
span: __binding_0, attr_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")));
;
diag.arg("attr_name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1056#[diag("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")]
1057pub(crate) struct DocAttrNotCrateLevel {
1058 #[primary_span]
1059 pub span: Span,
1060 pub attr_name: Symbol,
1061}
1062
1063#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotParameters
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAttrNotParameters { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(...)]` isn't allowed on parameters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1064#[diag("`#[doc(...)]` isn't allowed on parameters")]
1065pub(crate) struct DocAttrNotParameters {
1066 #[primary_span]
1067 pub span: Span,
1068}
1069
1070#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocKeywordNotKeyword
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocKeywordNotKeyword {
span: __binding_0, keyword: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing keywords are allowed in core/std")));
;
diag.arg("keyword", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1071#[diag("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")]
1072#[help("only existing keywords are allowed in core/std")]
1073pub(crate) struct DocKeywordNotKeyword {
1074 #[primary_span]
1075 pub span: Span,
1076 pub keyword: Symbol,
1077}
1078
1079#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocAttributeNotAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAttributeNotAttribute {
span: __binding_0, attribute: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing builtin attributes are allowed in core/std")));
;
diag.arg("attribute", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1080#[diag("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")]
1081#[help("only existing builtin attributes are allowed in core/std")]
1082pub(crate) struct DocAttributeNotAttribute {
1083 #[primary_span]
1084 pub span: Span,
1085 pub attribute: Symbol,
1086}
1087
1088#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotTraitLevel
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAttrNotTraitLevel {
span: __binding_0, attr_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc({$attr_name})]` must be a trait attribute")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag.arg("attr_name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1089#[diag("`#![doc({$attr_name})]` must be a trait attribute")]
1090#[warning(
1091 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1092)]
1093pub(crate) struct DocAttrNotTraitLevel {
1094 #[primary_span]
1095 pub span: Span,
1096 pub attr_name: Symbol,
1097}
1098
1099#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
TargetFeatureOnLangItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TargetFeatureOnLangItem {
attr_span: __binding_0,
kind: __binding_1,
item_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[target_feature]` cannot be applied to a {$kind ->\n [panic_handler] `#[panic_handler]`\n *[other] lang item\n } function")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind ->\n [panic_handler] `#[panic_handler]`\n *[other] lang item\n } function is not allowed to have `#[target_feature]`")));
diag
}
}
}
}
};Diagnostic)]
1100#[diag(
1101 "`#[target_feature]` cannot be applied to a {$kind ->
1102 [panic_handler] `#[panic_handler]`
1103 *[other] lang item
1104 } function"
1105)]
1106pub(crate) struct TargetFeatureOnLangItem {
1107 #[primary_span]
1108 pub attr_span: Span,
1109 pub kind: Symbol,
1110 #[label(
1111 "{$kind ->
1112 [panic_handler] `#[panic_handler]`
1113 *[other] lang item
1114 } function is not allowed to have `#[target_feature]`"
1115 )]
1116 pub item_span: Span,
1117}
1118
1119#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
TrackCallerOnLangItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TrackCallerOnLangItem {
attr_span: __binding_0,
name: __binding_1,
sig_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n [panic_impl] `#[panic_handler]`\n *[other] `{$name}` lang item\n} function is not allowed to have `#[track_caller]`")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n [panic_impl] `#[panic_handler]`\n *[other] `{$name}` lang item\n } function is not allowed to have `#[track_caller]`")));
diag
}
}
}
}
};Diagnostic)]
1120#[diag(
1121 "{$name ->
1122 [panic_impl] `#[panic_handler]`
1123 *[other] `{$name}` lang item
1124} function is not allowed to have `#[track_caller]`"
1125)]
1126pub(crate) struct TrackCallerOnLangItem {
1127 #[primary_span]
1128 pub attr_span: Span,
1129 pub name: Symbol,
1130 #[label(
1131 "{$name ->
1132 [panic_impl] `#[panic_handler]`
1133 *[other] `{$name}` lang item
1134 } function is not allowed to have `#[track_caller]`"
1135 )]
1136 pub sig_span: Span,
1137}
1138
1139#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingSince {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingSince { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'since'")));
diag.code(E0542);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1140#[diag("missing 'since'", code = E0542)]
1141pub(crate) struct MissingSince {
1142 #[primary_span]
1143 pub span: Span,
1144}
1145
1146#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingNote {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingNote { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'note'")));
diag.code(E0543);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1147#[diag("missing 'note'", code = E0543)]
1148pub(crate) struct MissingNote {
1149 #[primary_span]
1150 pub span: Span,
1151}
1152
1153#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MultipleStabilityLevels {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MultipleStabilityLevels { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple stability levels")));
diag.code(E0544);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1154#[diag("multiple stability levels", code = E0544)]
1155pub(crate) struct MultipleStabilityLevels {
1156 #[primary_span]
1157 pub span: Span,
1158}
1159
1160#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidIssueString {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidIssueString { span: __binding_0, cause: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must be a non-zero numeric string or \"none\"")));
diag.code(E0545);
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
1161#[diag("`issue` must be a non-zero numeric string or \"none\"", code = E0545)]
1162pub(crate) struct InvalidIssueString {
1163 #[primary_span]
1164 pub span: Span,
1165
1166 #[subdiagnostic]
1167 pub cause: Option<InvalidIssueStringCause>,
1168}
1169
1170#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidIssueStringCause {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidIssueStringCause::MustNotBeZero { span: __binding_0 }
=> {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must not be \"0\", use \"none\" instead")),
&sub_args);
diag.span_label(__binding_0, __message);
}
InvalidIssueStringCause::Empty { span: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot parse integer from empty string")),
&sub_args);
diag.span_label(__binding_0, __message);
}
InvalidIssueStringCause::InvalidDigit { span: __binding_0 }
=> {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid digit found in string")),
&sub_args);
diag.span_label(__binding_0, __message);
}
InvalidIssueStringCause::PosOverflow { span: __binding_0 }
=> {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too large to fit in target type")),
&sub_args);
diag.span_label(__binding_0, __message);
}
InvalidIssueStringCause::NegOverflow { span: __binding_0 }
=> {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too small to fit in target type")),
&sub_args);
diag.span_label(__binding_0, __message);
}
}
}
}
};Subdiagnostic)]
1173pub(crate) enum InvalidIssueStringCause {
1174 #[label("`issue` must not be \"0\", use \"none\" instead")]
1175 MustNotBeZero {
1176 #[primary_span]
1177 span: Span,
1178 },
1179
1180 #[label("cannot parse integer from empty string")]
1181 Empty {
1182 #[primary_span]
1183 span: Span,
1184 },
1185
1186 #[label("invalid digit found in string")]
1187 InvalidDigit {
1188 #[primary_span]
1189 span: Span,
1190 },
1191
1192 #[label("number too large to fit in target type")]
1193 PosOverflow {
1194 #[primary_span]
1195 span: Span,
1196 },
1197
1198 #[label("number too small to fit in target type")]
1199 NegOverflow {
1200 #[primary_span]
1201 span: Span,
1202 },
1203}
1204
1205impl InvalidIssueStringCause {
1206 pub(crate) fn from_int_error_kind(span: Span, kind: &IntErrorKind) -> Option<Self> {
1207 match kind {
1208 IntErrorKind::Empty => Some(Self::Empty { span }),
1209 IntErrorKind::InvalidDigit => Some(Self::InvalidDigit { span }),
1210 IntErrorKind::PosOverflow => Some(Self::PosOverflow { span }),
1211 IntErrorKind::NegOverflow => Some(Self::NegOverflow { span }),
1212 IntErrorKind::Zero => Some(Self::MustNotBeZero { span }),
1213 _ => None,
1214 }
1215 }
1216}
1217
1218#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingFeature {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingFeature { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'feature'")));
diag.code(E0546);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1219#[diag("missing 'feature'", code = E0546)]
1220pub(crate) struct MissingFeature {
1221 #[primary_span]
1222 pub span: Span,
1223}
1224
1225#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonIdentFeature {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonIdentFeature { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'feature' is not an identifier")));
diag.code(E0546);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1226#[diag("'feature' is not an identifier", code = E0546)]
1227pub(crate) struct NonIdentFeature {
1228 #[primary_span]
1229 pub span: Span,
1230}
1231
1232#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingIssue {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingIssue { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'issue'")));
diag.code(E0547);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1233#[diag("missing 'issue'", code = E0547)]
1234pub(crate) struct MissingIssue {
1235 #[primary_span]
1236 pub span: Span,
1237}
1238
1239#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcPromotablePairing {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcPromotablePairing { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute")));
diag.code(E0717);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1240#[diag("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute", code = E0717)]
1241pub(crate) struct RustcPromotablePairing {
1242 #[primary_span]
1243 pub span: Span,
1244}
1245
1246#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcAllowedUnstablePairing {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcAllowedUnstablePairing { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute")));
diag.code(E0789);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1247#[diag("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute", code = E0789)]
1248pub(crate) struct RustcAllowedUnstablePairing {
1249 #[primary_span]
1250 pub span: Span,
1251}
1252
1253#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcAtumMissingParams {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcAtumMissingParams { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must have `message` and `module` params")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1254#[diag(
1255 "`rustc_allowed_through_unstable_modules` attribute must have `message` and `module` params"
1256)]
1257pub(crate) struct RustcAtumMissingParams {
1258 #[primary_span]
1259 pub span: Span,
1260}
1261
1262#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DeprecatedItemSuggestion {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeprecatedItemSuggestion {
span: __binding_0,
is_nightly: __binding_1,
details: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suggestions on deprecated items are unstable")));
;
diag.span(__binding_0);
if __binding_1 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(deprecated_suggestion)]` to the crate root")));
}
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see #94785 for more details")));
diag
}
}
}
}
};Diagnostic)]
1263#[diag("suggestions on deprecated items are unstable")]
1264pub(crate) struct DeprecatedItemSuggestion {
1265 #[primary_span]
1266 pub span: Span,
1267
1268 #[help("add `#![feature(deprecated_suggestion)]` to the crate root")]
1269 pub is_nightly: bool,
1270
1271 #[note("see #94785 for more details")]
1272 pub details: (),
1273}
1274
1275#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DeprecatedAnnotationHasNoEffect {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeprecatedAnnotationHasNoEffect { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `#[deprecated]` annotation has no effect")));
let __code_19 =
[::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 unnecessary deprecation attribute")),
__code_19, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
1276#[diag("this `#[deprecated]` annotation has no effect")]
1277pub(crate) struct DeprecatedAnnotationHasNoEffect {
1278 #[suggestion(
1279 "remove the unnecessary deprecation attribute",
1280 applicability = "machine-applicable",
1281 code = ""
1282 )]
1283 pub span: Span,
1284}
1285
1286#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NonExhaustiveWithDefaultFieldValues {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NonExhaustiveWithDefaultFieldValues {
attr_span: __binding_0, defn_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[non_exhaustive]` can't be used to annotate structs with default field values")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this struct has default field values")));
diag
}
}
}
}
};Diagnostic)]
1287#[diag("`#[non_exhaustive]` can't be used to annotate structs with default field values")]
1288pub(crate) struct NonExhaustiveWithDefaultFieldValues {
1289 #[primary_span]
1290 pub attr_span: Span,
1291 #[label("this struct has default field values")]
1292 pub defn_span: Span,
1293}
1294
1295#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ExpectedSingleVersionLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedSingleVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected single version literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1296#[diag("expected single version literal")]
1297pub(crate) struct ExpectedSingleVersionLiteral {
1298 #[primary_span]
1299 pub span: Span,
1300}
1301
1302#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ExpectedVersionLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a version literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1303#[diag("expected a version literal")]
1304pub(crate) struct ExpectedVersionLiteral {
1305 #[primary_span]
1306 pub span: Span,
1307}
1308
1309#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectsFeatureList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectsFeatureList { span: __binding_0, name: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects a list of feature names")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1310#[diag("`{$name}` expects a list of feature names")]
1311pub(crate) struct ExpectsFeatureList {
1312 #[primary_span]
1313 pub span: Span,
1314
1315 pub name: String,
1316}
1317
1318#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectsFeatures {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectsFeatures { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects feature names")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1319#[diag("`{$name}` expects feature names")]
1320pub(crate) struct ExpectsFeatures {
1321 #[primary_span]
1322 pub span: Span,
1323
1324 pub name: String,
1325}
1326
1327#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSince {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidSince { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'since' must be a Rust version number, such as \"1.31.0\"")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1328#[diag("'since' must be a Rust version number, such as \"1.31.0\"")]
1329pub(crate) struct InvalidSince {
1330 #[primary_span]
1331 pub span: Span,
1332}
1333
1334#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnknownVersionLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown version literal format, assuming it refers to a future version")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1335#[diag("unknown version literal format, assuming it refers to a future version")]
1336pub(crate) struct UnknownVersionLiteral {
1337 #[primary_span]
1338 pub span: Span,
1339}
1340
1341#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedMultiple {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnusedMultiple {
this: __binding_0, other: __binding_1, name: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$name}` attributes")));
let __code_20 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
__code_20, rustc_errors::Applicability::Unspecified,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_note(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
diag
}
}
}
}
};Diagnostic)]
1342#[diag("multiple `{$name}` attributes")]
1343pub struct UnusedMultiple {
1344 #[primary_span]
1345 #[suggestion("remove this attribute", code = "", applicability = "unspecified")]
1346 pub this: Span,
1347 #[note("attribute also specified here")]
1348 pub other: Span,
1349 pub name: Symbol,
1350}
1351
1352#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyExportName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EmptyExportName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not be empty")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1353#[diag("`export_name` may not be empty")]
1354pub(crate) struct EmptyExportName {
1355 #[primary_span]
1356 pub span: Span,
1357}
1358
1359#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptySection {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EmptySection { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not be empty")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1360#[diag("`section` may not be empty")]
1361pub(crate) struct EmptySection {
1362 #[primary_span]
1363 pub span: Span,
1364}
1365
1366#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnExport {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnExport { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1367#[diag("`export_name` may not contain null characters", code = E0648)]
1368pub(crate) struct NullOnExport {
1369 #[primary_span]
1370 pub span: Span,
1371}
1372
1373#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnLinkSection {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnLinkSection { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link_section` may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1374#[diag("`link_section` may not contain null characters", code = E0648)]
1375pub(crate) struct NullOnLinkSection {
1376 #[primary_span]
1377 pub span: Span,
1378}
1379
1380#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnLinkName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnLinkName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1381#[diag("link name may not contain null characters", code = E0648)]
1382pub(crate) struct NullOnLinkName {
1383 #[primary_span]
1384 pub span: Span,
1385}
1386
1387#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnObjcClass {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnObjcClass { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` may not contain null characters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1388#[diag("`objc::class!` may not contain null characters")]
1389pub(crate) struct NullOnObjcClass {
1390 #[primary_span]
1391 pub span: Span,
1392}
1393
1394#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnObjcSelector {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnObjcSelector { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` may not contain null characters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1395#[diag("`objc::selector!` may not contain null characters")]
1396pub(crate) struct NullOnObjcSelector {
1397 #[primary_span]
1398 pub span: Span,
1399}
1400
1401#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnSection {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NullOnSection { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1402#[diag("`section` may not contain null characters", code = E0648)]
1403pub(crate) struct NullOnSection {
1404 #[primary_span]
1405 pub span: Span,
1406}
1407
1408#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ObjcClassExpectedStringLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ObjcClassExpectedStringLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` expected a string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1409#[diag("`objc::class!` expected a string literal")]
1410pub(crate) struct ObjcClassExpectedStringLiteral {
1411 #[primary_span]
1412 pub span: Span,
1413}
1414
1415#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ObjcSelectorExpectedStringLiteral {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ObjcSelectorExpectedStringLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` expected a string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1416#[diag("`objc::selector!` expected a string literal")]
1417pub(crate) struct ObjcSelectorExpectedStringLiteral {
1418 #[primary_span]
1419 pub span: Span,
1420}
1421
1422#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyConfusables {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EmptyConfusables { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected at least one confusable name")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1423#[diag("expected at least one confusable name")]
1424pub(crate) struct EmptyConfusables {
1425 #[primary_span]
1426 pub span: Span,
1427}
1428
1429#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidTarget {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidTarget {
span: __binding_0,
attr_span: __binding_1,
name: __binding_2,
target: __binding_3,
target_span: __binding_4,
applied: __binding_5,
only: __binding_6,
attribute_args: __binding_7,
help: __binding_8,
previously_accepted: __binding_9,
on_macro_call: __binding_10 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}{$attribute_args}` attribute cannot be used on {$target}")));
let __code_21 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}{$attribute_args}` attribute can {$only}be applied to {$applied}")));
;
diag.arg("name", __binding_2);
diag.arg("target", __binding_3);
diag.arg("applied", __binding_5);
diag.arg("only", __binding_6);
diag.arg("attribute_args", __binding_7);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
__code_21, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag.span_context(__binding_4);
if let Some(__binding_8) = __binding_8 {
diag.subdiagnostic(__binding_8);
}
if __binding_9 {
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
}
if __binding_10 {
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attributes on a macro invocation apply to the invocation itself and are not forwarded to its expansion")));
}
diag
}
}
}
}
};Diagnostic)]
1430#[help("the `{$name}{$attribute_args}` attribute can {$only}be applied to {$applied}")]
1431#[diag("the `{$name}{$attribute_args}` attribute cannot be used on {$target}")]
1432pub(crate) struct InvalidTarget {
1433 #[primary_span]
1434 pub span: Span,
1435 #[suggestion(
1436 "remove the attribute",
1437 code = "",
1438 applicability = "machine-applicable",
1439 style = "tool-only"
1440 )]
1441 pub attr_span: Span,
1442 pub name: AttrPath,
1443 pub target: &'static str,
1444 #[context]
1445 pub target_span: Span,
1446 pub applied: DiagArgValue,
1447 pub only: &'static str,
1448 pub attribute_args: String,
1449 #[subdiagnostic]
1450 pub help: Option<InvalidTargetHelp>,
1451 #[warning(
1452 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1453 )]
1454 pub previously_accepted: bool,
1455 #[note(
1456 "attributes on a macro invocation apply to the invocation itself and are not forwarded to its expansion"
1457 )]
1458 pub on_macro_call: bool,
1459}
1460
1461#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidTargetHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidTargetHelp::UseExportName {
unsafe_open: __binding_0,
name: __binding_1,
unsafe_close: __binding_2 } => {
let mut suggestions = Vec::new();
let __code_22 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe("))
});
let __code_23 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("export_name"))
});
let __code_24 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
if let Some(__binding_0) = __binding_0 {
suggestions.push((__binding_0, __code_22));
}
suggestions.push((__binding_1, __code_23));
if let Some(__binding_2) = __binding_2 {
suggestions.push((__binding_2, __code_24));
}
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean to use `#[export_name]`?")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
InvalidTargetHelp::UseRustcAlign => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align(...)]` instead")),
&sub_args);
diag.help(__message);
}
InvalidTargetHelp::UseRustcAlignStatic => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align_static(...)]` instead")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
1462pub(crate) enum InvalidTargetHelp {
1463 #[multipart_suggestion(
1464 "did you mean to use `#[export_name]`?",
1465 applicability = "maybe-incorrect"
1466 )]
1467 UseExportName {
1468 #[suggestion_part(code = "unsafe(")]
1469 unsafe_open: Option<Span>,
1470 #[suggestion_part(code = "export_name")]
1471 name: Span,
1472 #[suggestion_part(code = ")")]
1473 unsafe_close: Option<Span>,
1474 },
1475 #[help("use `#[rustc_align(...)]` instead")]
1476 UseRustcAlign,
1477 #[help("use `#[rustc_align_static(...)]` instead")]
1478 UseRustcAlignStatic,
1479}
1480
1481#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InvalidAlignmentValue {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidAlignmentValue {
span: __binding_0, error_part: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid alignment value: {$error_part}")));
diag.code(E0589);
;
diag.arg("error_part", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1482#[diag("invalid alignment value: {$error_part}", code = E0589)]
1483pub(crate) struct InvalidAlignmentValue {
1484 #[primary_span]
1485 pub span: Span,
1486 pub error_part: String,
1487}
1488
1489#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnstableFeatureBoundIncompatibleStability {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnstableFeatureBoundIncompatibleStability {
span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item annotated with `#[unstable_feature_bound]` should not be stable")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1490#[diag("item annotated with `#[unstable_feature_bound]` should not be stable")]
1491#[help(
1492 "if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`"
1493)]
1494pub(crate) struct UnstableFeatureBoundIncompatibleStability {
1495 #[primary_span]
1496 pub span: Span,
1497}
1498
1499#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NakedFunctionIncompatibleAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NakedFunctionIncompatibleAttribute {
span: __binding_0,
naked_span: __binding_1,
attr: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute incompatible with `#[unsafe(naked)]`")));
diag.code(E0736);
;
diag.arg("attr", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function marked with `#[unsafe(naked)]` here")));
diag
}
}
}
}
};Diagnostic)]
1500#[diag("attribute incompatible with `#[unsafe(naked)]`", code = E0736)]
1501pub(crate) struct NakedFunctionIncompatibleAttribute {
1502 #[primary_span]
1503 #[label("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")]
1504 pub span: Span,
1505 #[label("function marked with `#[unsafe(naked)]` here")]
1506 pub naked_span: Span,
1507 pub attr: String,
1508}
1509
1510#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
LinkOrdinalOutOfRange {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
LinkOrdinalOutOfRange {
span: __binding_0, ordinal: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ordinal value in `link_ordinal` is too large: `{$ordinal}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
;
diag.arg("ordinal", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1511#[diag("ordinal value in `link_ordinal` is too large: `{$ordinal}`")]
1512#[note("the value may not exceed `u16::MAX`")]
1513pub(crate) struct LinkOrdinalOutOfRange {
1514 #[primary_span]
1515 pub span: Span,
1516 pub ordinal: u128,
1517}
1518
1519#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
RustcScalableVectorCountOutOfRange {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RustcScalableVectorCountOutOfRange {
span: __binding_0, n: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("element count in `rustc_scalable_vector` is too large: `{$n}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
;
diag.arg("n", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1520#[diag("element count in `rustc_scalable_vector` is too large: `{$n}`")]
1521#[note("the value may not exceed `u16::MAX`")]
1522pub(crate) struct RustcScalableVectorCountOutOfRange {
1523 #[primary_span]
1524 pub span: Span,
1525 pub n: u128,
1526}
1527
1528#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AttributeRequiresOpt
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AttributeRequiresOpt { span: __binding_0, opt: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute requires {$opt} to be enabled")));
;
diag.arg("opt", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1529#[diag("attribute requires {$opt} to be enabled")]
1530pub(crate) struct AttributeRequiresOpt {
1531 #[primary_span]
1532 pub span: Span,
1533 pub opt: &'static str,
1534}
1535
1536pub(crate) enum AttributeParseErrorReason<'a> {
1537 ExpectedNoArgs,
1538 ExpectedStringLiteral {
1539 byte_string: Option<Span>,
1540 },
1541 ExpectedFilenameLiteral,
1542 ExpectedIntegerLiteral,
1543 ExpectedIntegerLiteralInRange {
1544 lower_bound: isize,
1545 upper_bound: isize,
1546 },
1547 ExpectedAtLeastOneArgument,
1548 ExpectedArgument,
1549 ExpectedSingleArgument,
1550 ExpectedList,
1551 ExpectedListOrNoArgs,
1552 ExpectedListWithNumArgsOrMore {
1553 args: usize,
1554 },
1555 ExpectedNameValueOrNoArgs,
1556 ExpectedNonEmptyStringLiteral,
1557 ExpectedNotLiteral,
1558 ExpectedNameValue(Option<Symbol>),
1559 MissingNameValue(Symbol),
1560 DuplicateKey(Symbol),
1561 ExpectedSpecificArgument {
1562 possibilities: &'a [Symbol],
1563 strings: bool,
1564 list: bool,
1566 },
1567 ExpectedIdentifier,
1568}
1569
1570#[derive(#[automatically_derived]impl ::core::marker::Copy for ParsedDescription { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ParsedDescription {
}
#[automatically_derived]impl ::core::clone::Clone for ParsedDescription {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone)]
1572pub enum ParsedDescription {
1573 Attribute,
1575 Macro,
1577}
1578
1579pub(crate) struct AttributeParseError<'a> {
1580 pub(crate) span: Span,
1581 pub(crate) inner_span: Span,
1582 pub(crate) template: AttributeTemplate,
1583 pub(crate) path: AttrPath,
1584 pub(crate) description: ParsedDescription,
1585 pub(crate) reason: AttributeParseErrorReason<'a>,
1586 pub(crate) suggestions: AttributeParseErrorSuggestions,
1587}
1588
1589pub(crate) enum AttributeParseErrorSuggestions {
1590 CreatedByTemplate(Vec<String>),
1591 CreatedByParser(Vec<Suggestion>),
1592}
1593
1594impl<'a> AttributeParseError<'a> {
1595 fn render_expected_specific_argument(
1596 &self,
1597 diag: &mut Diag<'_>,
1598 possibilities: &[Symbol],
1599 strings: bool,
1600 ) {
1601 let quote = if strings { '"' } else { '`' };
1602 match possibilities {
1603 &[] => {}
1604 &[x] => {
1605 diag.span_label(
1606 self.span,
1607 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("the only valid argument here is {0}{1}{0}",
quote, x))
})format!("the only valid argument here is {quote}{x}{quote}"),
1608 );
1609 }
1610 [first, second] => {
1611 diag.span_label(
1612 self.span,
1613 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("valid arguments are {0}{1}{0} or {0}{2}{0}",
quote, first, second))
})format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"),
1614 );
1615 }
1616 [first @ .., second_to_last, last] => {
1617 let mut res = String::new();
1618 for i in first {
1619 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
})format!("{quote}{i}{quote}, "));
1620 }
1621 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
second_to_last, last))
})format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
1622
1623 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("valid arguments are {0}", res))
})format!("valid arguments are {res}"));
1624 }
1625 }
1626 }
1627
1628 fn render_expected_specific_argument_list(
1629 &self,
1630 diag: &mut Diag<'_>,
1631 possibilities: &[Symbol],
1632 strings: bool,
1633 ) {
1634 let description = self.description();
1635
1636 let quote = if strings { '"' } else { '`' };
1637 match possibilities {
1638 &[] => {}
1639 &[x] => {
1640 diag.span_label(
1641 self.span,
1642 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with {1}{2}{1} as an argument",
description, quote, x))
})format!(
1643 "this {description} is only valid with {quote}{x}{quote} as an argument"
1644 ),
1645 );
1646 }
1647 [first, second] => {
1648 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with either {1}{2}{1} or {1}{3}{1} as an argument",
description, quote, first, second))
})format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
1649 }
1650 [first @ .., second_to_last, last] => {
1651 let mut res = String::new();
1652 for i in first {
1653 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
})format!("{quote}{i}{quote}, "));
1654 }
1655 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
second_to_last, last))
})format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
1656
1657 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with one of the following arguments: {1}",
description, res))
})format!("this {description} is only valid with one of the following arguments: {res}"));
1658 }
1659 }
1660 }
1661
1662 fn render_suggestions(&self, diag: &mut Diag<'_>) {
1663 let description = self.description();
1664
1665 match &self.suggestions {
1666 AttributeParseErrorSuggestions::CreatedByTemplate(suggestions) => {
1667 diag.span_suggestions(
1668 self.inner_span,
1669 if suggestions.len() == 1 {
1670 "must be of the form".to_string()
1671 } else {
1672 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("try changing it to one of the following valid forms of the {0}",
description))
})format!(
1673 "try changing it to one of the following valid forms of the {description}"
1674 )
1675 },
1676 suggestions.iter().cloned(),
1677 Applicability::HasPlaceholders,
1678 );
1679 }
1680
1681 AttributeParseErrorSuggestions::CreatedByParser(suggestions) => {
1682 for Suggestion { msg, sp, code } in suggestions {
1683 diag.span_suggestion_verbose(
1684 *sp,
1685 msg.clone(),
1686 code.clone(),
1687 Applicability::MaybeIncorrect,
1688 );
1689 }
1690 }
1691 }
1692 }
1693
1694 fn description(&self) -> &'static str {
1695 match self.description {
1696 ParsedDescription::Attribute => "attribute",
1697 ParsedDescription::Macro => "macro",
1698 }
1699 }
1700}
1701
1702impl AttributeParseErrorSuggestions {
1703 fn len(&self) -> usize {
1704 match self {
1705 AttributeParseErrorSuggestions::CreatedByTemplate(items) => items.len(),
1706 AttributeParseErrorSuggestions::CreatedByParser(items) => items.len(),
1707 }
1708 }
1709}
1710
1711impl<'a> Diagnostic<'a> for AttributeParseError<'_> {
1712 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
1713 let name = self.path.to_string();
1714
1715 let description = self.description();
1716
1717 let mut diag = Diag::new(dcx, level, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("malformed `{0}` {1} input", name,
description))
})format!("malformed `{name}` {description} input"));
1718 diag.span(self.inner_span);
1719 diag.code(E0539);
1720 match &self.reason {
1721 AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
1722 if let Some(start_point_span) = byte_string {
1723 diag.span_suggestion_short(
1724 *start_point_span,
1725 "consider removing the prefix",
1726 "",
1727 Applicability::MaybeIncorrect,
1728 );
1729 diag.note("expected a normal string literal, not a byte string literal");
1730
1731 return diag;
1734 }
1735 diag.span_label(self.span, "expected a string literal here");
1736 }
1737 AttributeParseErrorReason::ExpectedFilenameLiteral => {
1738 diag.span_label(self.span, "expected a filename string literal here");
1739 }
1740 AttributeParseErrorReason::ExpectedIntegerLiteral => {
1741 diag.span_label(self.span, "expected an integer literal here");
1742 }
1743 AttributeParseErrorReason::ExpectedIntegerLiteralInRange {
1744 lower_bound,
1745 upper_bound,
1746 } => {
1747 diag.span_label(
1748 self.span,
1749 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected an integer literal in the range of {0}..={1}",
lower_bound, upper_bound))
})format!(
1750 "expected an integer literal in the range of {lower_bound}..={upper_bound}"
1751 ),
1752 );
1753 }
1754 AttributeParseErrorReason::ExpectedSingleArgument => {
1755 diag.span_label(self.span, "expected a single argument here");
1756 diag.code(E0805);
1757 }
1758 AttributeParseErrorReason::ExpectedArgument => {
1759 diag.span_label(self.span, "expected an argument here");
1760 diag.code(E0805);
1761 }
1762 AttributeParseErrorReason::ExpectedAtLeastOneArgument => {
1763 diag.span_label(self.span, "expected at least 1 argument here");
1764 }
1765 AttributeParseErrorReason::ExpectedList => {
1766 diag.span_label(self.span, "expected this to be a list");
1767 }
1768 AttributeParseErrorReason::ExpectedListOrNoArgs => {
1769 diag.span_label(self.span, "expected a list or no arguments here");
1770 }
1771 AttributeParseErrorReason::ExpectedListWithNumArgsOrMore { args } => {
1772 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected {0} or more items", args))
})format!("expected {args} or more items"));
1773 }
1774 AttributeParseErrorReason::ExpectedNameValueOrNoArgs => {
1775 diag.span_label(self.span, "didn't expect a list here");
1776 }
1777 AttributeParseErrorReason::ExpectedNonEmptyStringLiteral => {
1778 diag.span_label(self.span, "string is not allowed to be empty");
1779 }
1780 AttributeParseErrorReason::DuplicateKey(key) => {
1781 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("found `{0}` used as a key more than once",
key))
})format!("found `{key}` used as a key more than once"));
1782 diag.code(E0538);
1783 }
1784 AttributeParseErrorReason::ExpectedNotLiteral => {
1785 diag.span_label(self.span, "didn't expect a literal here");
1786 diag.code(E0565);
1787 }
1788 AttributeParseErrorReason::ExpectedNoArgs => {
1789 diag.span_label(self.span, "didn't expect any arguments here");
1790 diag.code(E0565);
1791 }
1792 AttributeParseErrorReason::ExpectedNameValue(None) => {
1793 if self.span != self.inner_span {
1796 diag.span_label(self.span, "expected this to be of the form `... = \"...\"`");
1797 }
1798 }
1799 AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
1800 diag.span_label(
1801 self.span,
1802 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected this to be of the form `{0} = \"...\"`",
name))
})format!("expected this to be of the form `{name} = \"...\"`"),
1803 );
1804 }
1805 AttributeParseErrorReason::MissingNameValue(name) => {
1806 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("missing argument `{0} = \"...\"`",
name))
})format!("missing argument `{name} = \"...\"`"));
1807 }
1808 AttributeParseErrorReason::ExpectedSpecificArgument {
1809 possibilities,
1810 strings,
1811 list: false,
1812 } => {
1813 self.render_expected_specific_argument(&mut diag, possibilities, *strings);
1814 }
1815 AttributeParseErrorReason::ExpectedSpecificArgument {
1816 possibilities,
1817 strings,
1818 list: true,
1819 } => {
1820 self.render_expected_specific_argument_list(&mut diag, possibilities, *strings);
1821 }
1822 AttributeParseErrorReason::ExpectedIdentifier => {
1823 diag.span_label(self.span, "expected a valid identifier here");
1824 diag.code(E0565);
1825 }
1826 }
1827
1828 if let Some(link) = self.template.docs {
1829 diag.note(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("for more information, visit <{0}>",
link))
})format!("for more information, visit <{link}>"));
1830 }
1831
1832 if self.suggestions.len() < 4 {
1833 self.render_suggestions(&mut diag);
1834 }
1835
1836 diag
1837 }
1838}
1839
1840#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAttrUnsafe {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidAttrUnsafe { 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 not an unsafe attribute")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extraneous unsafe is not allowed in attributes")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not an unsafe attribute")));
diag
}
}
}
}
};Diagnostic)]
1841#[diag("`{$name}` is not an unsafe attribute")]
1842#[note("extraneous unsafe is not allowed in attributes")]
1843pub(crate) struct InvalidAttrUnsafe {
1844 #[primary_span]
1845 #[label("this is not an unsafe attribute")]
1846 pub span: Span,
1847 pub name: AttrPath,
1848}
1849
1850#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnsafeAttrOutsideUnsafe {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeAttrOutsideUnsafe {
span: __binding_0, suggestion: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
1851#[diag("unsafe attribute used without unsafe")]
1852pub(crate) struct UnsafeAttrOutsideUnsafe {
1853 #[primary_span]
1854 #[label("usage of unsafe attribute")]
1855 pub span: Span,
1856 #[subdiagnostic]
1857 pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
1858}
1859
1860#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnsafeAttrOutsideUnsafeSuggestion
{
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnsafeAttrOutsideUnsafeSuggestion {
left: __binding_0, right: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_25 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe("))
});
let __code_26 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_25));
suggestions.push((__binding_1, __code_26));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the attribute in `unsafe(...)`")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1861#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
1862pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
1863 #[suggestion_part(code = "unsafe(")]
1864 pub left: Span,
1865 #[suggestion_part(code = ")")]
1866 pub right: Span,
1867}
1868
1869#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MetaBadDelim {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MetaBadDelim { span: __binding_0, sugg: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong meta list delimiters")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
1870#[diag("wrong meta list delimiters")]
1871pub(crate) struct MetaBadDelim {
1872 #[primary_span]
1873 pub span: Span,
1874 #[subdiagnostic]
1875 pub sugg: MetaBadDelimSugg,
1876}
1877
1878#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MetaBadDelimSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
MetaBadDelimSugg { open: __binding_0, close: __binding_1 }
=> {
let mut suggestions = Vec::new();
let __code_27 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("("))
});
let __code_28 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_27));
suggestions.push((__binding_1, __code_28));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1879#[multipart_suggestion(
1880 "the delimiters should be `(` and `)`",
1881 applicability = "machine-applicable"
1882)]
1883pub(crate) struct MetaBadDelimSugg {
1884 #[suggestion_part(code = "(")]
1885 pub open: Span,
1886 #[suggestion_part(code = ")")]
1887 pub close: Span,
1888}
1889
1890#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidMetaItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidMetaItem {
span: __binding_0,
descr: __binding_1,
quote_ident_sugg: __binding_2,
remove_neg_sugg: __binding_3,
label: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")));
;
diag.arg("descr", __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.subdiagnostic(__binding_3);
}
if let Some(__binding_4) = __binding_4 {
diag.span_label(__binding_4,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}s are not allowed here")));
}
diag
}
}
}
}
};Diagnostic)]
1891#[diag("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")]
1892pub(crate) struct InvalidMetaItem {
1893 #[primary_span]
1894 pub span: Span,
1895 pub descr: String,
1896 #[subdiagnostic]
1897 pub quote_ident_sugg: Option<InvalidMetaItemQuoteIdentSugg>,
1898 #[subdiagnostic]
1899 pub remove_neg_sugg: Option<InvalidMetaItemRemoveNegSugg>,
1900 #[label("{$descr}s are not allowed here")]
1901 pub label: Option<Span>,
1902}
1903
1904#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidMetaItemQuoteIdentSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidMetaItemQuoteIdentSugg {
before: __binding_0, after: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_29 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\""))
});
let __code_30 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\""))
});
suggestions.push((__binding_0, __code_29));
suggestions.push((__binding_1, __code_30));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("surround the identifier with quotation marks to make it into a string literal")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1905#[multipart_suggestion(
1906 "surround the identifier with quotation marks to make it into a string literal",
1907 applicability = "machine-applicable"
1908)]
1909pub(crate) struct InvalidMetaItemQuoteIdentSugg {
1910 #[suggestion_part(code = "\"")]
1911 pub before: Span,
1912 #[suggestion_part(code = "\"")]
1913 pub after: Span,
1914}
1915
1916#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidMetaItemRemoveNegSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidMetaItemRemoveNegSugg { negative_sign: __binding_0 }
=> {
let mut suggestions = Vec::new();
let __code_31 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
suggestions.push((__binding_0, __code_31));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative numbers are not literals, try removing the `-` sign")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1917#[multipart_suggestion(
1918 "negative numbers are not literals, try removing the `-` sign",
1919 applicability = "machine-applicable"
1920)]
1921pub(crate) struct InvalidMetaItemRemoveNegSugg {
1922 #[suggestion_part(code = "")]
1923 pub negative_sign: Span,
1924}
1925
1926#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
SuffixedLiteralInAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
SuffixedLiteralInAttribute { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suffixed literals are not allowed in attributes")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1927#[diag("suffixed literals are not allowed in attributes")]
1928#[help(
1929 "instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)"
1930)]
1931pub(crate) struct SuffixedLiteralInAttribute {
1932 #[primary_span]
1933 pub span: Span,
1934}
1935
1936#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AttributeInInvalidContext {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AttributeInInvalidContext {
attrs: __binding_0, count: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n [one] this attribute is\n *[other] these attributes are\n } not allowed in this context")));
;
diag.arg("count", __binding_1);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
1937#[diag(
1938 "{$count ->
1939 [one] this attribute is
1940 *[other] these attributes are
1941 } not allowed in this context"
1942)]
1943pub(crate) struct AttributeInInvalidContext {
1944 #[primary_span]
1945 pub attrs: Vec<Span>,
1946 pub count: usize,
1947}
1948
1949#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyLinkName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EmptyLinkName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must not be empty")));
diag.code(E0454);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty link name")));
diag
}
}
}
}
};Diagnostic)]
1950#[diag("link name must not be empty", code = E0454)]
1951pub(crate) struct EmptyLinkName {
1952 #[primary_span]
1953 #[label("empty link name")]
1954 pub span: Span,
1955}
1956
1957#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for Link {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
Link => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to an `extern` block with non-Rust ABI")));
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
;
diag
}
}
}
}
};Diagnostic)]
1958#[diag("attribute should be applied to an `extern` block with non-Rust ABI")]
1959#[warning(
1960 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1961)]
1962pub(crate) struct Link;
1963
1964#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for LinkFrameworkApple {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
LinkFrameworkApple { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `framework` is only supported on Apple targets")));
diag.code(E0455);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1965#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
1966pub(crate) struct LinkFrameworkApple {
1967 #[primary_span]
1968 pub span: Span,
1969}
1970
1971#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for IncompatibleWasmLink
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
IncompatibleWasmLink { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1972#[diag("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")]
1973pub(crate) struct IncompatibleWasmLink {
1974 #[primary_span]
1975 pub span: Span,
1976}
1977
1978#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for LinkRequiresName {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
LinkRequiresName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[link]` attribute requires a `name = \"string\"` argument")));
diag.code(E0459);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `name` argument")));
diag
}
}
}
}
};Diagnostic)]
1979#[diag("`#[link]` attribute requires a `name = \"string\"` argument", code = E0459)]
1980pub(crate) struct LinkRequiresName {
1981 #[primary_span]
1982 #[label("missing `name` argument")]
1983 pub span: Span,
1984}
1985
1986#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for RawDylibOnlyWindows
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RawDylibOnlyWindows { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `raw-dylib` is only supported on Windows targets")));
diag.code(E0455);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1987#[diag("link kind `raw-dylib` is only supported on Windows targets", code = E0455)]
1988pub(crate) struct RawDylibOnlyWindows {
1989 #[primary_span]
1990 pub span: Span,
1991}
1992
1993#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidLinkModifier
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidLinkModifier { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1994#[diag(
1995 "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
1996)]
1997pub(crate) struct InvalidLinkModifier {
1998 #[primary_span]
1999 pub span: Span,
2000}
2001
2002#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MultipleModifiers {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MultipleModifiers { span: __binding_0, modifier: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$modifier}` modifiers in a single `modifiers` argument")));
;
diag.arg("modifier", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2003#[diag("multiple `{$modifier}` modifiers in a single `modifiers` argument")]
2004pub(crate) struct MultipleModifiers {
2005 #[primary_span]
2006 pub span: Span,
2007 pub modifier: Symbol,
2008}
2009
2010#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImportNameTypeX86 {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ImportNameTypeX86 { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type is only supported on x86")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2011#[diag("import name type is only supported on x86")]
2012pub(crate) struct ImportNameTypeX86 {
2013 #[primary_span]
2014 pub span: Span,
2015}
2016
2017#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for BundleNeedsStatic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BundleNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `bundle` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2018#[diag("linking modifier `bundle` is only compatible with `static` linking kind")]
2019pub(crate) struct BundleNeedsStatic {
2020 #[primary_span]
2021 pub span: Span,
2022}
2023
2024#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ExportSymbolsNeedsStatic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExportSymbolsNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `export-symbols` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2025#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
2026pub(crate) struct ExportSymbolsNeedsStatic {
2027 #[primary_span]
2028 pub span: Span,
2029}
2030
2031#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
WholeArchiveNeedsStatic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
WholeArchiveNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `whole-archive` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2032#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
2033pub(crate) struct WholeArchiveNeedsStatic {
2034 #[primary_span]
2035 pub span: Span,
2036}
2037
2038#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsNeededCompatibility {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsNeededCompatibility { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2039#[diag(
2040 "linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds"
2041)]
2042pub(crate) struct AsNeededCompatibility {
2043 #[primary_span]
2044 pub span: Span,
2045}
2046
2047#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImportNameTypeRaw {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ImportNameTypeRaw { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type can only be used with link kind `raw-dylib`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2048#[diag("import name type can only be used with link kind `raw-dylib`")]
2049pub(crate) struct ImportNameTypeRaw {
2050 #[primary_span]
2051 pub span: Span,
2052}
2053
2054#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for LimitInvalid<'a>
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
LimitInvalid {
span: __binding_0,
value_span: __binding_1,
error_str: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`limit` must be a non-negative integer")));
;
diag.arg("error_str", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error_str}")));
diag
}
}
}
}
};Diagnostic)]
2055#[diag("`limit` must be a non-negative integer")]
2056pub(crate) struct LimitInvalid<'a> {
2057 #[primary_span]
2058 pub span: Span,
2059 #[label("{$error_str}")]
2060 pub value_span: Span,
2061 pub error_str: &'a str,
2062}
2063
2064#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CfgAttrBadDelim {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CfgAttrBadDelim { span: __binding_0, sugg: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong `cfg_attr` delimiters")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
2065#[diag("wrong `cfg_attr` delimiters")]
2066pub(crate) struct CfgAttrBadDelim {
2067 #[primary_span]
2068 pub span: Span,
2069 #[subdiagnostic]
2070 pub sugg: MetaBadDelimSugg,
2071}
2072
2073#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAliasMalformed {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocAliasMalformed { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2074#[diag(
2075 "doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`"
2076)]
2077pub(crate) struct DocAliasMalformed {
2078 #[primary_span]
2079 pub span: Span,
2080}
2081
2082#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownLangItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownLangItem { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of an unknown lang item: `{$name}`")));
diag.code(E0522);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of unknown lang item `{$name}`")));
diag
}
}
}
}
};Diagnostic)]
2083#[diag("definition of an unknown lang item: `{$name}`", code = E0522)]
2084pub(crate) struct UnknownLangItem {
2085 #[primary_span]
2086 #[label("definition of unknown lang item `{$name}`")]
2087 pub span: Span,
2088 pub name: Symbol,
2089}
2090
2091#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
UnsupportedInstructionSet<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsupportedInstructionSet {
span: __binding_0,
instruction_set: __binding_1,
current_target: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")));
;
diag.arg("instruction_set", __binding_1);
diag.arg("current_target", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2092#[diag("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")]
2093pub(crate) struct UnsupportedInstructionSet<'a> {
2094 #[primary_span]
2095 pub span: Span,
2096 pub instruction_set: Symbol,
2097 pub current_target: &'a TargetTuple,
2098}
2099
2100#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CustomMirPhaseRequiresDialect {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CustomMirPhaseRequiresDialect {
attr_span: __binding_0, phase_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`dialect` key required")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`phase` argument requires a `dialect` argument")));
diag
}
}
}
}
};Diagnostic)]
2101#[diag("`dialect` key required")]
2102pub(crate) struct CustomMirPhaseRequiresDialect {
2103 #[primary_span]
2104 pub attr_span: Span,
2105 #[label("`phase` argument requires a `dialect` argument")]
2106 pub phase_span: Span,
2107}
2108
2109#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CustomMirIncompatibleDialectAndPhase {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CustomMirIncompatibleDialectAndPhase {
dialect: __binding_0,
phase: __binding_1,
attr_span: __binding_2,
dialect_span: __binding_3,
phase_span: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$dialect} dialect is not compatible with the {$phase} phase")));
;
diag.arg("dialect", __binding_0);
diag.arg("phase", __binding_1);
diag.span(__binding_2);
diag.span_label(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this dialect...")));
diag.span_label(__binding_4,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... is not compatible with this phase")));
diag
}
}
}
}
};Diagnostic)]
2110#[diag("the {$dialect} dialect is not compatible with the {$phase} phase")]
2111pub(crate) struct CustomMirIncompatibleDialectAndPhase {
2112 pub dialect: MirDialect,
2113 pub phase: MirPhase,
2114 #[primary_span]
2115 pub attr_span: Span,
2116 #[label("this dialect...")]
2117 pub dialect_span: Span,
2118 #[label("... is not compatible with this phase")]
2119 pub phase_span: Span,
2120}
2121
2122#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
UnstableAttrForAlreadyStableFeature {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnstableAttrForAlreadyStableFeature {
attr_span: __binding_0, item_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't mark as unstable using an already stable feature")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is already stable")));
diag.span_help(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the attribute")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
diag
}
}
}
}
};Diagnostic)]
2123#[diag("can't mark as unstable using an already stable feature")]
2124pub(crate) struct UnstableAttrForAlreadyStableFeature {
2125 #[primary_span]
2126 #[label("this feature is already stable")]
2127 #[help("consider removing the attribute")]
2128 pub attr_span: Span,
2129 #[label("the stability attribute annotates this item")]
2130 pub item_span: Span,
2131}
2132
2133#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidMachoSection
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidMachoSection {
name_span: __binding_0, reason: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid Mach-O section specifier")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a valid Mach-O section specifier")));
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
2134#[diag("invalid Mach-O section specifier")]
2135pub(crate) struct InvalidMachoSection {
2136 #[primary_span]
2137 #[label("not a valid Mach-O section specifier")]
2138 pub name_span: Span,
2139 #[subdiagnostic]
2140 pub reason: InvalidMachoSectionReason,
2141}
2142
2143#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidMachoSectionReason {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
InvalidMachoSectionReason::MissingSection => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a Mach-O section specifier requires a segment and a section, separated by a comma")),
&sub_args);
diag.note(__message);
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")),
&sub_args);
diag.help(__message);
}
InvalidMachoSectionReason::SectionTooLong {
section: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("section".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("section name `{$section}` is longer than 16 bytes")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
2144pub(crate) enum InvalidMachoSectionReason {
2145 #[note("a Mach-O section specifier requires a segment and a section, separated by a comma")]
2146 #[help("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")]
2147 MissingSection,
2148 #[note("section name `{$section}` is longer than 16 bytes")]
2149 SectionTooLong { section: String },
2150}
2151
2152#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
SanitizeInvalidStatic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
SanitizeInvalidStatic {
span: __binding_0, field: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize]` can be used on statics if only the address is sanitized")));
;
diag.arg("field", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2153#[diag("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")]
2154#[help("`#[sanitize]` can be used on statics if only the address is sanitized")]
2155pub(crate) struct SanitizeInvalidStatic {
2156 #[primary_span]
2157 pub span: Span,
2158 pub field: &'static str,
2159}
2160
2161#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedComma {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExpectedComma { span: __binding_0, additional: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute items not separated with `,`")));
let __code_32 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(","))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `,` here")),
__code_32, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeInline);
for __binding_1 in __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
2162#[diag("attribute items not separated with `,`")]
2163pub(crate) struct ExpectedComma {
2164 #[primary_span]
2165 #[suggestion(
2166 "try adding `,` here",
2167 code = ",",
2168 applicability = "maybe-incorrect",
2169 style = "short"
2170 )]
2171 pub span: Span,
2172 #[subdiagnostic]
2173 pub additional: Vec<AdditionalCommaSuggestion>,
2174}
2175
2176#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for AdditionalCommaSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
AdditionalCommaSuggestion { span: __binding_0 } => {
let __code_33 =
[::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("try adding `,` here")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_33, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeInline);
}
}
}
}
};Subdiagnostic)]
2177#[suggestion("try adding `,` here", code = ",", applicability = "maybe-incorrect", style = "short")]
2178pub(crate) struct AdditionalCommaSuggestion {
2179 #[primary_span]
2180 pub span: Span,
2181}
2182
2183#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedDuplicate {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnusedDuplicate {
this: __binding_0, other: __binding_1, warning: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
let __code_34 =
[::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 this attribute")),
__code_34, rustc_errors::Applicability::Unspecified,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_note(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
if __binding_2 {
diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
}
diag
}
}
}
}
};Diagnostic)]
2184#[diag("unused attribute")]
2185pub(crate) struct UnusedDuplicate {
2186 #[suggestion("remove this attribute", code = "", applicability = "unspecified")]
2187 pub this: Span,
2188 #[note("attribute also specified here")]
2189 pub other: Span,
2190 #[warning(
2191 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
2192 )]
2193 pub warning: bool,
2194}
2195
2196#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MacroExportOnDeclMacro {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MacroExportOnDeclMacro { attr_span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[macro_export]` is not allowed on declarative macro definitions")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declarative macros follow the same exporting rules as regular items")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2197#[diag("`#[macro_export]` is not allowed on declarative macro definitions")]
2198#[note("declarative macros follow the same exporting rules as regular items")]
2199pub(crate) struct MacroExportOnDeclMacro {
2200 #[primary_span]
2201 pub attr_span: Span,
2202}
2203
2204#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MalformedAttribute {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MalformedAttribute { span: __binding_0, kind: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed lint attribute input")));
diag.code(E0452);
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
2205#[diag("malformed lint attribute input", code = E0452)]
2206pub(crate) struct MalformedAttribute {
2207 #[primary_span]
2208 pub span: Span,
2209 #[subdiagnostic]
2210 pub kind: MalformedAttributeKind,
2211}
2212
2213#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MalformedAttributeKind {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
MalformedAttributeKind::ReasonMustComeLast(__binding_0) => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reason in lint attribute must come last")),
&sub_args);
diag.span_label(__binding_0, __message);
}
}
}
}
};Subdiagnostic)]
2214pub(crate) enum MalformedAttributeKind {
2215 #[label("reason in lint attribute must come last")]
2216 ReasonMustComeLast(#[primary_span] Span),
2217}
2218
2219#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MalformedLintAttributeInput {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MalformedLintAttributeInput {
span: __binding_0, kind: __binding_1, help: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `{$kind}` attribute input")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not the name of a lint")));
diag.subdiagnostic(__binding_2);
diag
}
}
}
}
};Diagnostic)]
2220#[diag("malformed `{$kind}` attribute input")]
2221pub(crate) struct MalformedLintAttributeInput {
2222 #[primary_span]
2223 #[label("not the name of a lint")]
2224 pub span: Span,
2225 pub kind: Symbol,
2226 #[subdiagnostic]
2227 pub help: MalformedLintAttributeInputHelp,
2228}
2229
2230#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MalformedLintAttributeInputHelp {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
MalformedLintAttributeInputHelp::StrLit {
sym: __binding_0, kind: __binding_1 } => {
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));
sub_args.insert("kind".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 `#[{$kind}({$sym})]`")),
&sub_args);
diag.help(__message);
}
MalformedLintAttributeInputHelp::Other { kind: __binding_0 }
=> {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("kind".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("for example, write `#[{$kind}(dead_code)]` for `dead_code`")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
2231pub(crate) enum MalformedLintAttributeInputHelp {
2232 #[help("try using `#[{$kind}({$sym})]`")]
2233 StrLit { sym: Symbol, kind: Symbol },
2234 #[help("for example, write `#[{$kind}(dead_code)]` for `dead_code`")]
2235 Other { kind: Symbol },
2236}
2237
2238#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnusedNote {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
UnusedNote::EmptyList { name: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".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("attribute `{$name}` with an empty list has no effect")),
&sub_args);
diag.note(__message);
}
UnusedNote::NoLints { name: __binding_0 } => {
let mut sub_args = rustc_errors::DiagArgMap::default();
sub_args.insert("name".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("attribute `{$name}` without any lints has no effect")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
2239pub(crate) enum UnusedNote {
2240 #[note("attribute `{$name}` with an empty list has no effect")]
2241 EmptyList { name: Symbol },
2242 #[note("attribute `{$name}` without any lints has no effect")]
2243 NoLints { name: Symbol },
2244}
2245
2246#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for Unused {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
Unused { attr_span: __binding_0, note: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
let __code_35 =
[::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 this attribute")),
__code_35, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
2247#[diag("unused attribute")]
2248pub(crate) struct Unused {
2249 #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
2250 pub attr_span: Span,
2251 #[subdiagnostic]
2252 pub note: UnusedNote,
2253}
2254
2255#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NoLinkAttrUsed {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NoLinkAttrUsed => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of deprecated `no_link` attribute")));
;
diag
}
}
}
}
};Diagnostic)]
2256#[diag("use of deprecated `no_link` attribute")]
2257pub(crate) struct NoLinkAttrUsed;
2258
2259#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DocKeywordAttributeNotAnonConst {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DocKeywordAttributeNotAnonConst {
span: __binding_0, attr_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc({$attr_name} = \"...\")]` should be used on anonymous constants")));
;
diag.arg("attr_name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2260#[diag("`#[doc({$attr_name} = \"...\")]` should be used on anonymous constants")]
2261pub(crate) struct DocKeywordAttributeNotAnonConst {
2262 #[primary_span]
2263 pub span: Span,
2264 pub attr_name: Symbol,
2265}
2266
2267#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownLintHelper {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnknownLintHelper { span: __binding_0, unknown: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `lint::{$unknown}` attribute is not recognized")));
;
diag.arg("unknown", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
2268#[diag("the `lint::{$unknown}` attribute is not recognized")]
2269pub(crate) struct UnknownLintHelper {
2270 #[primary_span]
2271 pub span: Span,
2272 pub unknown: Symbol,
2273}