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