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