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