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