1use rustc_abi::ExternAbi;
4use rustc_errors::codes::*;
5use rustc_errors::{Applicability, Diag, Subdiagnostic};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Ident, Span, Symbol};
8
9#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
VisibilityNotPermitted {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
VisibilityNotPermitted {
span: __binding_0,
note: __binding_1,
remove_qualifier_sugg: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility qualifiers are not permitted here")));
let __code_0 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.code(E0449);
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the qualifier")),
__code_0, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
10#[diag("visibility qualifiers are not permitted here", code = E0449)]
11pub(crate) struct VisibilityNotPermitted {
12 #[primary_span]
13 pub span: Span,
14 #[subdiagnostic]
15 pub note: VisibilityNotPermittedNote,
16 #[suggestion("remove the qualifier", code = "", applicability = "machine-applicable")]
17 pub remove_qualifier_sugg: Span,
18}
19
20#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for VisibilityNotPermittedNote {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
VisibilityNotPermittedNote::EnumVariant => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enum variants and their fields always share the visibility of the enum they are in")),
&sub_args);
diag.note(__message);
}
VisibilityNotPermittedNote::TraitImpl => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait items always share the visibility of their trait")),
&sub_args);
diag.note(__message);
}
VisibilityNotPermittedNote::IndividualImplItems => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("place qualifiers on individual impl items instead")),
&sub_args);
diag.note(__message);
}
VisibilityNotPermittedNote::IndividualForeignItems => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("place qualifiers on individual foreign items instead")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic)]
21pub(crate) enum VisibilityNotPermittedNote {
22 #[note("enum variants and their fields always share the visibility of the enum they are in")]
23 EnumVariant,
24 #[note("trait items always share the visibility of their trait")]
25 TraitImpl,
26 #[note("place qualifiers on individual impl items instead")]
27 IndividualImplItems,
28 #[note("place qualifiers on individual foreign items instead")]
29 IndividualForeignItems,
30}
31#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImplFnConst {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ImplFnConst {
span: __binding_0, parent_constness: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("redundant `const` fn marker in const impl")));
let __code_1 =
[::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("remove the `const`")),
__code_1, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this declares all associated functions implicitly const")));
diag
}
}
}
}
};Diagnostic)]
32#[diag("redundant `const` fn marker in const impl")]
33pub(crate) struct ImplFnConst {
34 #[primary_span]
35 #[suggestion("remove the `const`", code = "", applicability = "machine-applicable")]
36 pub span: Span,
37 #[label("this declares all associated functions implicitly const")]
38 pub parent_constness: Span,
39}
40
41#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NextSolverDisabledForGenericConstExprs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NextSolverDisabledForGenericConstExprs { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`feature(generic_const_exprs)` is not supported with the next-generation trait solver")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Znext-solver=globally` is currently enabled by default for testing")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reverted the setting to `-Znext-solver=coherence` for this crate")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the currently stable trait solver will be used for this crate")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
42#[diag("`feature(generic_const_exprs)` is not supported with the next-generation trait solver")]
43#[note("`-Znext-solver=globally` is currently enabled by default for testing")]
44#[note("reverted the setting to `-Znext-solver=coherence` for this crate")]
45#[note("the currently stable trait solver will be used for this crate")]
46#[note("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")]
47pub(crate) struct NextSolverDisabledForGenericConstExprs {
48 #[primary_span]
49 pub span: Span,
50}
51
52#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NextSolverDisabledForHigherRankedAssumptions {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NextSolverDisabledForHigherRankedAssumptions => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zhigher-ranked-assumptions` is not supported with the next-generation trait solver")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature flag will be superseded by `-Zassumptions-on-binders`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Znext-solver=globally` is currently enabled by default for testing")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reverted the setting to `-Znext-solver=coherence` for this crate")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the currently stable trait solver will be used for this crate")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")));
;
diag
}
}
}
}
};Diagnostic)]
53#[diag("`-Zhigher-ranked-assumptions` is not supported with the next-generation trait solver")]
54#[note("the feature flag will be superseded by `-Zassumptions-on-binders`")]
55#[note("`-Znext-solver=globally` is currently enabled by default for testing")]
56#[note("reverted the setting to `-Znext-solver=coherence` for this crate")]
57#[note("the currently stable trait solver will be used for this crate")]
58#[note("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")]
59pub(crate) struct NextSolverDisabledForHigherRankedAssumptions;
60
61#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraitFnConst {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TraitFnConst {
span: __binding_0,
in_impl: __binding_1,
const_context_label: __binding_2,
remove_const_sugg: __binding_3,
requires_multiple_changes: __binding_4,
make_impl_const_sugg: __binding_5,
make_trait_const_sugg: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in {$in_impl ->\n [true] trait impls\n *[false] traits\n } cannot be declared const")));
let __code_2 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("const "))
})].into_iter();
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("const "))
})].into_iter();
diag.code(E0379);
;
diag.arg("in_impl", __binding_1);
diag.arg("requires_multiple_changes", __binding_4);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in {$in_impl ->\n [true] trait impls\n *[false] traits\n } cannot be const")));
if let Some(__binding_2) = __binding_2 {
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this declares all associated functions implicitly const")));
}
diag.span_suggestions_with_style(__binding_3.0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `const`{$requires_multiple_changes ->\n [true] {\" ...\"}\n *[false] {\"\"}\n }")),
__code_2, __binding_3.1,
rustc_errors::SuggestionStyle::ShowCode);
if let Some(__binding_5) = __binding_5 {
diag.span_suggestions_with_style(__binding_5,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... and declare the impl to be const instead")),
__code_3, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
if let Some(__binding_6) = __binding_6 {
diag.span_suggestions_with_style(__binding_6,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... and declare the trait to be const instead")),
__code_4, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
}
}
}
};Diagnostic)]
62#[diag("functions in {$in_impl ->
63 [true] trait impls
64 *[false] traits
65 } cannot be declared const", code = E0379)]
66pub(crate) struct TraitFnConst {
67 #[primary_span]
68 #[label(
69 "functions in {$in_impl ->
70 [true] trait impls
71 *[false] traits
72 } cannot be const"
73 )]
74 pub span: Span,
75 pub in_impl: bool,
76 #[label("this declares all associated functions implicitly const")]
77 pub const_context_label: Option<Span>,
78 #[suggestion(
79 "remove the `const`{$requires_multiple_changes ->
80 [true] {\" ...\"}
81 *[false] {\"\"}
82 }",
83 code = ""
84 )]
85 pub remove_const_sugg: (Span, Applicability),
86 pub requires_multiple_changes: bool,
87 #[suggestion(
88 "... and declare the impl to be const instead",
89 code = "const ",
90 applicability = "maybe-incorrect"
91 )]
92 pub make_impl_const_sugg: Option<Span>,
93 #[suggestion(
94 "... and declare the trait to be const instead",
95 code = "const ",
96 applicability = "maybe-incorrect"
97 )]
98 pub make_trait_const_sugg: Option<Span>,
99}
100
101#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AsyncFnInConstTraitOrTraitImpl {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AsyncFnInConstTraitOrTraitImpl {
async_keyword: __binding_0,
context: __binding_1,
const_keyword: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("async functions are not allowed in `const` {$context ->\n [trait_impl] trait impls\n [impl] impls\n *[trait] traits\n }")));
;
diag.arg("context", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated functions of `const` cannot be declared `async`")));
diag
}
}
}
}
};Diagnostic)]
102#[diag(
103 "async functions are not allowed in `const` {$context ->
104 [trait_impl] trait impls
105 [impl] impls
106 *[trait] traits
107 }"
108)]
109pub(crate) struct AsyncFnInConstTraitOrTraitImpl {
110 #[primary_span]
111 pub async_keyword: Span,
112 pub context: &'static str,
113 #[label("associated functions of `const` cannot be declared `async`")]
114 pub const_keyword: Span,
115}
116
117#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenBound {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ForbiddenBound { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds cannot be used in this context")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
118#[diag("bounds cannot be used in this context")]
119pub(crate) struct ForbiddenBound {
120 #[primary_span]
121 pub spans: Vec<Span>,
122}
123
124#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenConstParam
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ForbiddenConstParam { const_param_spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("late-bound const parameters cannot be used currently")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
125#[diag("late-bound const parameters cannot be used currently")]
126pub(crate) struct ForbiddenConstParam {
127 #[primary_span]
128 pub const_param_spans: Vec<Span>,
129}
130
131#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamTooMany {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnParamTooMany {
span: __binding_0, max_num_args: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function can not have more than {$max_num_args} arguments")));
;
diag.arg("max_num_args", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
132#[diag("function can not have more than {$max_num_args} arguments")]
133pub(crate) struct FnParamTooMany {
134 #[primary_span]
135 pub span: Span,
136 pub max_num_args: usize,
137}
138
139#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
FnParamCVarArgsNotLast {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnParamCVarArgsNotLast { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` must be the last argument of a C-variadic function")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
140#[diag("`...` must be the last argument of a C-variadic function")]
141pub(crate) struct FnParamCVarArgsNotLast {
142 #[primary_span]
143 pub span: Span,
144}
145
146#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSplattedArgs
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidSplattedArgs {
max_valid_splatted_arg_index: __binding_0,
first_invalid_splatted_arg_index: __binding_1,
spans: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is only supported on argument index {$max_valid_splatted_arg_index} or less, this `#[rustc_splat]` is on index {$first_invalid_splatted_arg_index}")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list")));
;
diag.arg("max_valid_splatted_arg_index", __binding_0);
diag.arg("first_invalid_splatted_arg_index", __binding_1);
diag.span(__binding_2.clone());
for __binding_2 in __binding_2 {
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not supported here")));
}
diag
}
}
}
}
};Diagnostic)]
147#[diag(
148 "`#[rustc_splat]` is only supported on argument index {$max_valid_splatted_arg_index} or less, this `#[rustc_splat]` is on index {$first_invalid_splatted_arg_index}"
149)]
150#[help(
151 "remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list"
152)]
153pub(crate) struct InvalidSplattedArgs {
154 pub max_valid_splatted_arg_index: u16,
155
156 pub first_invalid_splatted_arg_index: u16,
157
158 #[primary_span]
159 #[label("`#[rustc_splat]` is not supported here")]
160 pub spans: Vec<Span>,
161}
162
163#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DuplicateSplattedArgs {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DuplicateSplattedArgs { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `#[rustc_splat]`s are not allowed in the same function argument list")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` from all but one argument")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
164#[diag("multiple `#[rustc_splat]`s are not allowed in the same function argument list")]
165#[help("remove `#[rustc_splat]` from all but one argument")]
166pub(crate) struct DuplicateSplattedArgs {
167 #[primary_span]
168 pub spans: Vec<Span>,
169}
170
171#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVarArgsAndSplat {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVarArgsAndSplat { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` and `#[rustc_splat]` are not allowed in the same function argument list")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or remove `...`")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
172#[diag("`...` and `#[rustc_splat]` are not allowed in the same function argument list")]
173#[help("remove `#[rustc_splat]` or remove `...`")]
174pub(crate) struct CVarArgsAndSplat {
175 #[primary_span]
176 pub spans: Vec<Span>,
177}
178
179#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
SplatNotAllowedOnClosures {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
SplatNotAllowedOnClosures { spans: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not allowed on closure arguments")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or turn the closure into a function")));
;
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
180#[diag("`#[rustc_splat]` is not allowed on closure arguments")]
181#[help("remove `#[rustc_splat]` or turn the closure into a function")]
182pub(crate) struct SplatNotAllowedOnClosures {
183 #[primary_span]
184 pub spans: Vec<Span>,
185}
186
187#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
SplatNotAllowedOnAbiCall {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
SplatNotAllowedOnAbiCall {
spans: __binding_0, abi: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not allowed in the arguments of functions with the `{$abi}` ABI")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or change the ABI")));
;
diag.arg("abi", __binding_1);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
188#[diag("`#[rustc_splat]` is not allowed in the arguments of functions with the `{$abi}` ABI")]
189#[help("remove `#[rustc_splat]` or change the ABI")]
190pub(crate) struct SplatNotAllowedOnAbiCall {
191 #[primary_span]
192 pub spans: Vec<Span>,
193 pub abi: Symbol,
194}
195
196#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamDocComment {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnParamDocComment { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("documentation comments cannot be applied to function parameters")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc comments are not allowed here")));
diag
}
}
}
}
};Diagnostic)]
197#[diag("documentation comments cannot be applied to function parameters")]
198pub(crate) struct FnParamDocComment {
199 #[primary_span]
200 #[label("doc comments are not allowed here")]
201 pub span: Span,
202}
203
204#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
EiiImplAttributeNotSupported<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
EiiImplAttributeNotSupported {
attr_span: __binding_0,
attr_name: __binding_1,
eii_name: __binding_2,
eii_span: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")));
;
diag.arg("attr_name", __binding_1);
diag.arg("eii_name", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")));
diag
}
}
}
}
};Diagnostic)]
205#[diag("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")]
206pub(crate) struct EiiImplAttributeNotSupported<'a> {
207 #[primary_span]
208 pub attr_span: Span,
209 pub attr_name: &'a str,
210 pub eii_name: String,
211 #[label("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")]
212 pub eii_span: Span,
213}
214
215#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamForbiddenSelf
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnParamForbiddenSelf { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`self` parameter is only allowed in associated functions")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated functions are those in `impl` or `trait` definitions")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not semantically valid as function parameter")));
diag
}
}
}
}
};Diagnostic)]
216#[diag("`self` parameter is only allowed in associated functions")]
217#[note("associated functions are those in `impl` or `trait` definitions")]
218pub(crate) struct FnParamForbiddenSelf {
219 #[primary_span]
220 #[label("not semantically valid as function parameter")]
221 pub span: Span,
222}
223
224#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidConstParam {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidConstParam { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` parameter is only allowed in free/trait/impl functions")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not semantically valid as function parameter")));
diag
}
}
}
}
};Diagnostic)]
225#[diag("`const` parameter is only allowed in free/trait/impl functions")]
226pub(crate) struct InvalidConstParam {
227 #[primary_span]
228 #[label("not semantically valid as function parameter")]
229 pub span: Span,
230}
231
232#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenDefault {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ForbiddenDefault { span: __binding_0, def_span: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`default` is only allowed on items in trait impls")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`default` because of this")));
diag
}
}
}
}
};Diagnostic)]
233#[diag("`default` is only allowed on items in trait impls")]
234pub(crate) struct ForbiddenDefault {
235 #[primary_span]
236 pub span: Span,
237 #[label("`default` because of this")]
238 pub def_span: Span,
239}
240
241#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenFinal {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ForbiddenFinal { span: __binding_0, def_span: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` is only allowed on associated functions in traits")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` because of this")));
diag
}
}
}
}
};Diagnostic)]
242#[diag("`final` is only allowed on associated functions in traits")]
243pub(crate) struct ForbiddenFinal {
244 #[primary_span]
245 pub span: Span,
246 #[label("`final` because of this")]
247 pub def_span: Span,
248}
249
250#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ForbiddenFinalWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ForbiddenFinalWithoutBody {
span: __binding_0, def_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` is only allowed on associated functions if they have a body")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` because of this")));
diag
}
}
}
}
};Diagnostic)]
251#[diag("`final` is only allowed on associated functions if they have a body")]
252pub(crate) struct ForbiddenFinalWithoutBody {
253 #[primary_span]
254 pub span: Span,
255 #[label("`final` because of this")]
256 pub def_span: Span,
257}
258
259#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AssocConstWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssocConstWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated constant in `impl` without body")));
let __code_5 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = <expr>;"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the constant")),
__code_5, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
260#[diag("associated constant in `impl` without body")]
261pub(crate) struct AssocConstWithoutBody {
262 #[primary_span]
263 pub span: Span,
264 #[suggestion(
265 "provide a definition for the constant",
266 code = " = <expr>;",
267 applicability = "has-placeholders"
268 )]
269 pub replace_span: Span,
270}
271
272#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssocFnWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssocFnWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated function in `impl` without body")));
let __code_6 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" {{ <body> }}"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the function")),
__code_6, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
273#[diag("associated function in `impl` without body")]
274pub(crate) struct AssocFnWithoutBody {
275 #[primary_span]
276 pub span: Span,
277 #[suggestion(
278 "provide a definition for the function",
279 code = " {{ <body> }}",
280 applicability = "has-placeholders"
281 )]
282 pub replace_span: Span,
283}
284
285#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssocTypeWithoutBody
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AssocTypeWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type in `impl` without body")));
let __code_7 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = <type>;"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the type")),
__code_7, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
286#[diag("associated type in `impl` without body")]
287pub(crate) struct AssocTypeWithoutBody {
288 #[primary_span]
289 pub span: Span,
290 #[suggestion(
291 "provide a definition for the type",
292 code = " = <type>;",
293 applicability = "has-placeholders"
294 )]
295 pub replace_span: Span,
296}
297
298#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConstWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free constant item without body")));
let __code_8 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = <expr>;"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the constant")),
__code_8, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
299#[diag("free constant item without body")]
300pub(crate) struct ConstWithoutBody {
301 #[primary_span]
302 pub span: Span,
303 #[suggestion(
304 "provide a definition for the constant",
305 code = " = <expr>;",
306 applicability = "has-placeholders"
307 )]
308 pub replace_span: Span,
309}
310
311#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for StaticWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
StaticWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free static item without body")));
let __code_9 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = <expr>;"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the static")),
__code_9, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
312#[diag("free static item without body")]
313pub(crate) struct StaticWithoutBody {
314 #[primary_span]
315 pub span: Span,
316 #[suggestion(
317 "provide a definition for the static",
318 code = " = <expr>;",
319 applicability = "has-placeholders"
320 )]
321 pub replace_span: Span,
322}
323
324#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TyAliasWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TyAliasWithoutBody {
span: __binding_0, replace_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free type alias without body")));
let __code_10 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" = <type>;"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the type")),
__code_10, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
325#[diag("free type alias without body")]
326pub(crate) struct TyAliasWithoutBody {
327 #[primary_span]
328 pub span: Span,
329 #[suggestion(
330 "provide a definition for the type",
331 code = " = <type>;",
332 applicability = "has-placeholders"
333 )]
334 pub replace_span: Span,
335}
336
337#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnWithoutBody {
span: __binding_0,
replace_span: __binding_1,
extern_block_suggestion: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free function without a body")));
let __code_11 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" {{ <body> }}"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the function")),
__code_11, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
338#[diag("free function without a body")]
339pub(crate) struct FnWithoutBody {
340 #[primary_span]
341 pub span: Span,
342 #[suggestion(
343 "provide a definition for the function",
344 code = " {{ <body> }}",
345 applicability = "has-placeholders"
346 )]
347 pub replace_span: Span,
348 #[subdiagnostic]
349 pub extern_block_suggestion: Option<ExternBlockSuggestion>,
350}
351
352#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for ExternBlockSuggestion {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
ExternBlockSuggestion::Implicit {
start_span: __binding_0, end_span: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_12 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("extern {{"))
});
let __code_13 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" }}"))
});
suggestions.push((__binding_0, __code_12));
suggestions.push((__binding_1, __code_13));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to declare an externally defined function, use an `extern` block")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
ExternBlockSuggestion::Explicit {
start_span: __binding_0,
end_span: __binding_1,
abi: __binding_2 } => {
let mut suggestions = Vec::new();
let __code_14 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("extern \"{0}\" {{",
__binding_2))
});
let __code_15 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" }}"))
});
suggestions.push((__binding_0, __code_14));
suggestions.push((__binding_1, __code_15));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to declare an externally defined function, use an `extern` block")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
353pub(crate) enum ExternBlockSuggestion {
354 #[multipart_suggestion(
355 "if you meant to declare an externally defined function, use an `extern` block",
356 applicability = "maybe-incorrect"
357 )]
358 Implicit {
359 #[suggestion_part(code = "extern {{")]
360 start_span: Span,
361 #[suggestion_part(code = " }}")]
362 end_span: Span,
363 },
364 #[multipart_suggestion(
365 "if you meant to declare an externally defined function, use an `extern` block",
366 applicability = "maybe-incorrect"
367 )]
368 Explicit {
369 #[suggestion_part(code = "extern \"{abi}\" {{")]
370 start_span: Span,
371 #[suggestion_part(code = " }}")]
372 end_span: Span,
373 abi: Symbol,
374 },
375}
376
377#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
InvalidSafetyOnExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidSafetyOnExtern {
item_span: __binding_0, block: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers")));
let __code_16 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe "))
})].into_iter();
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `unsafe` to this `extern` block")),
__code_16, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
diag
}
}
}
}
};Diagnostic)]
378#[diag("items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers")]
379pub(crate) struct InvalidSafetyOnExtern {
380 #[primary_span]
381 pub item_span: Span,
382 #[suggestion(
383 "add `unsafe` to this `extern` block",
384 code = "unsafe ",
385 applicability = "machine-applicable",
386 style = "verbose"
387 )]
388 pub block: Option<Span>,
389}
390
391#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSafetyOnItem
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidSafetyOnItem { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items outside of `unsafe extern {\"{ }\"}` cannot be declared with `safe` safety qualifier")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
392#[diag(
393 "items outside of `unsafe extern {\"{ }\"}` cannot be declared with `safe` safety qualifier"
394)]
395pub(crate) struct InvalidSafetyOnItem {
396 #[primary_span]
397 pub span: Span,
398}
399
400#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSafetyOnFnPtr
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
InvalidSafetyOnFnPtr {
span: __binding_0, safe_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointers cannot be declared with `safe` safety qualifier")));
let __code_17 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `safe` qualifier")),
__code_17, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
401#[diag("function pointers cannot be declared with `safe` safety qualifier")]
402pub(crate) struct InvalidSafetyOnFnPtr {
403 #[primary_span]
404 pub span: Span,
405 #[suggestion(
406 "remove the `safe` qualifier",
407 code = "",
408 applicability = "machine-applicable",
409 style = "verbose"
410 )]
411 pub safe_span: Span,
412}
413
414#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeStatic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("static items cannot be declared with `unsafe` safety qualifier outside of `extern` block")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
415#[diag("static items cannot be declared with `unsafe` safety qualifier outside of `extern` block")]
416pub(crate) struct UnsafeStatic {
417 #[primary_span]
418 pub span: Span,
419}
420
421#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
BoundInContext<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BoundInContext { span: __binding_0, ctx: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds on `type`s in {$ctx} have no effect")));
;
diag.arg("ctx", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
422#[diag("bounds on `type`s in {$ctx} have no effect")]
423pub(crate) struct BoundInContext<'a> {
424 #[primary_span]
425 pub span: Span,
426 pub ctx: &'a str,
427}
428
429#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
ExternTypesCannotHave<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExternTypesCannotHave {
span: __binding_0,
descr: __binding_1,
remove_descr: __binding_2,
block_span: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`type`s inside `extern` blocks cannot have {$descr}")));
let __code_18 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
;
diag.arg("descr", __binding_1);
diag.arg("remove_descr", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the {$remove_descr}")),
__code_18, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_label(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` block begins here")));
diag
}
}
}
}
};Diagnostic)]
430#[diag("`type`s inside `extern` blocks cannot have {$descr}")]
431#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
432pub(crate) struct ExternTypesCannotHave<'a> {
433 #[primary_span]
434 #[suggestion("remove the {$remove_descr}", code = "", applicability = "maybe-incorrect")]
435 pub span: Span,
436 pub descr: &'a str,
437 pub remove_descr: &'a str,
438 #[label("`extern` block begins here")]
439 pub block_span: Span,
440}
441
442#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for BodyInExtern<'a>
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
BodyInExtern {
span: __binding_0,
body: __binding_1,
block: __binding_2,
kind: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `{$kind}` inside `extern` block")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
;
diag.arg("kind", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot have a body")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the invalid body")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` blocks define existing foreign {$kind}s and {$kind}s inside of them cannot have a body")));
diag
}
}
}
}
};Diagnostic)]
443#[diag("incorrect `{$kind}` inside `extern` block")]
444#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
445pub(crate) struct BodyInExtern<'a> {
446 #[primary_span]
447 #[label("cannot have a body")]
448 pub span: Span,
449 #[label("the invalid body")]
450 pub body: Span,
451 #[label(
452 "`extern` blocks define existing foreign {$kind}s and {$kind}s inside of them cannot have a body"
453 )]
454 pub block: Span,
455 pub kind: &'a str,
456}
457
458#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnBodyInExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnBodyInExtern {
span: __binding_0, body: __binding_1, block: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect function inside `extern` block")));
let __code_19 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(";"))
})].into_iter();
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot have a body")));
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the invalid body")),
__code_19, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` blocks define existing foreign functions and functions inside of them cannot have a body")));
diag
}
}
}
}
};Diagnostic)]
459#[diag("incorrect function inside `extern` block")]
460#[help(
461 "you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block"
462)]
463#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
464pub(crate) struct FnBodyInExtern {
465 #[primary_span]
466 #[label("cannot have a body")]
467 pub span: Span,
468 #[suggestion("remove the invalid body", code = ";", applicability = "maybe-incorrect")]
469 pub body: Span,
470 #[label(
471 "`extern` blocks define existing foreign functions and functions inside of them cannot have a body"
472 )]
473 pub block: Span,
474}
475
476#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnQualifierInExtern
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FnQualifierInExtern {
span: __binding_0, block: __binding_1, kw: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in `extern` blocks cannot have `{$kw}` qualifier")));
let __code_20 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("kw", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `{$kw}` qualifier")),
__code_20, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this `extern` block")));
diag
}
}
}
}
};Diagnostic)]
477#[diag("functions in `extern` blocks cannot have `{$kw}` qualifier")]
478pub(crate) struct FnQualifierInExtern {
479 #[primary_span]
480 #[suggestion("remove the `{$kw}` qualifier", code = "", applicability = "maybe-incorrect")]
481 pub span: Span,
482 #[label("in this `extern` block")]
483 pub block: Span,
484 pub kw: &'static str,
485}
486
487#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExternItemAscii {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ExternItemAscii { span: __binding_0, block: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items in `extern` blocks cannot use non-ascii identifiers")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this `extern` block")));
diag
}
}
}
}
};Diagnostic)]
488#[diag("items in `extern` blocks cannot use non-ascii identifiers")]
489#[note(
490 "this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information"
491)]
492pub(crate) struct ExternItemAscii {
493 #[primary_span]
494 pub span: Span,
495 #[label("in this `extern` block")]
496 pub block: Span,
497}
498
499#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVariadicNoExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVariadicNoExtern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for non-extern functions")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
500#[diag("`...` is not supported for non-extern functions")]
501#[help(
502 "only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list"
503)]
504pub(crate) struct CVariadicNoExtern {
505 #[primary_span]
506 pub span: Span,
507}
508
509#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CVariadicMustBeUnsafe {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVariadicMustBeUnsafe {
span: __binding_0, unsafe_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with a C variable argument list must be unsafe")));
let __code_21 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe "))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the `unsafe` keyword to this definition")),
__code_21, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
510#[diag("functions with a C variable argument list must be unsafe")]
511pub(crate) struct CVariadicMustBeUnsafe {
512 #[primary_span]
513 pub span: Span,
514
515 #[suggestion(
516 "add the `unsafe` keyword to this definition",
517 applicability = "maybe-incorrect",
518 code = "unsafe ",
519 style = "verbose"
520 )]
521 pub unsafe_span: Span,
522}
523
524#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVariadicBadExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVariadicBadExtern {
span: __binding_0,
abi: __binding_1,
extern_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for `extern \"{$abi}\"` functions")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list")));
;
diag.arg("abi", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"{$abi}\"` because of this")));
diag
}
}
}
}
};Diagnostic)]
525#[diag("`...` is not supported for `extern \"{$abi}\"` functions")]
526#[help(
527 "only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list"
528)]
529pub(crate) struct CVariadicBadExtern {
530 #[primary_span]
531 pub span: Span,
532 pub abi: &'static str,
533 #[label("`extern \"{$abi}\"` because of this")]
534 pub extern_span: Span,
535}
536
537#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CVariadicBadNakedExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVariadicBadNakedExtern {
span: __binding_0,
abi: __binding_1,
extern_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for `extern \"{$abi}\"` naked functions")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic function must have a compatible calling convention")));
;
diag.arg("abi", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"{$abi}\"` because of this")));
diag
}
}
}
}
};Diagnostic)]
538#[diag("`...` is not supported for `extern \"{$abi}\"` naked functions")]
539#[help("C-variadic function must have a compatible calling convention")]
540pub(crate) struct CVariadicBadNakedExtern {
541 #[primary_span]
542 pub span: Span,
543 pub abi: &'static str,
544 #[label("`extern \"{$abi}\"` because of this")]
545 pub extern_span: Span,
546}
547
548#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
ItemUnderscore<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ItemUnderscore { span: __binding_0, kind: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$kind}` items in this context need a name")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`_` is not a valid name for this `{$kind}` item")));
diag
}
}
}
}
};Diagnostic)]
549#[diag("`{$kind}` items in this context need a name")]
550pub(crate) struct ItemUnderscore<'a> {
551 #[primary_span]
552 #[label("`_` is not a valid name for this `{$kind}` item")]
553 pub span: Span,
554 pub kind: &'a str,
555}
556
557#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NoMangleAscii {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NoMangleAscii { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[no_mangle]` requires ASCII identifier")));
diag.code(E0754);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
558#[diag("`#[no_mangle]` requires ASCII identifier", code = E0754)]
559pub(crate) struct NoMangleAscii {
560 #[primary_span]
561 pub span: Span,
562}
563
564#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ModuleNonAscii {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ModuleNonAscii { span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trying to load file for module `{$name}` with non-ascii identifier name")));
diag.code(E0754);
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the `#[path]` attribute to specify filesystem path")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
565#[diag("trying to load file for module `{$name}` with non-ascii identifier name", code = E0754)]
566#[help("consider using the `#[path]` attribute to specify filesystem path")]
567pub(crate) struct ModuleNonAscii {
568 #[primary_span]
569 pub span: Span,
570 pub name: Symbol,
571}
572
573#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitGeneric {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoTraitGeneric { span: __binding_0, ident: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have generic parameters")));
let __code_22 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.code(E0567);
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the parameters")),
__code_22, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto trait cannot have generic parameters")));
diag
}
}
}
}
};Diagnostic)]
574#[diag("auto traits cannot have generic parameters", code = E0567)]
575pub(crate) struct AutoTraitGeneric {
576 #[primary_span]
577 #[suggestion(
578 "remove the parameters",
579 code = "",
580 applicability = "machine-applicable",
581 style = "tool-only"
582 )]
583 pub span: Span,
584 #[label("auto trait cannot have generic parameters")]
585 pub ident: Span,
586}
587
588#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitBounds {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoTraitBounds {
span: __binding_0, removal: __binding_1, ident: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have super traits or lifetime bounds")));
let __code_23 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.code(E0568);
;
diag.span(__binding_0.clone());
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the super traits or lifetime bounds")),
__code_23, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have super traits or lifetime bounds")));
diag
}
}
}
}
};Diagnostic)]
589#[diag("auto traits cannot have super traits or lifetime bounds", code = E0568)]
590pub(crate) struct AutoTraitBounds {
591 #[primary_span]
592 pub span: Vec<Span>,
593 #[suggestion(
594 "remove the super traits or lifetime bounds",
595 code = "",
596 applicability = "machine-applicable",
597 style = "tool-only"
598 )]
599 pub removal: Span,
600 #[label("auto traits cannot have super traits or lifetime bounds")]
601 pub ident: Span,
602}
603
604#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitItems {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AutoTraitItems {
spans: __binding_0, total: __binding_1, ident: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have associated items")));
let __code_24 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.code(E0380);
;
diag.span(__binding_0.clone());
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the associated items")),
__code_24, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have associated items")));
diag
}
}
}
}
};Diagnostic)]
605#[diag("auto traits cannot have associated items", code = E0380)]
606pub(crate) struct AutoTraitItems {
607 #[primary_span]
608 pub spans: Vec<Span>,
609 #[suggestion(
610 "remove the associated items",
611 code = "",
612 applicability = "machine-applicable",
613 style = "tool-only"
614 )]
615 pub total: Span,
616 #[label("auto traits cannot have associated items")]
617 pub ident: Span,
618}
619
620#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstAutoTrait {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConstAutoTrait { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot be const")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `const` keyword")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
621#[diag("auto traits cannot be const")]
622#[help("remove the `const` keyword")]
623pub(crate) struct ConstAutoTrait {
624 #[primary_span]
625 pub span: Span,
626}
627
628#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ArgsBeforeConstraint
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ArgsBeforeConstraint {
arg_spans: __binding_0,
constraints: __binding_1,
args: __binding_2,
data: __binding_3,
suggestion: __binding_4,
constraint_len: __binding_5,
args_len: __binding_6,
constraint_spans: __binding_7,
arg_spans2: __binding_8 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic arguments must come before the first constraint")));
let __code_25 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_4))
})].into_iter();
;
diag.arg("constraint_len", __binding_5);
diag.arg("args_len", __binding_6);
diag.span(__binding_0.clone());
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$constraint_len ->\n [one] constraint\n *[other] constraints\n }")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic {$args_len ->\n [one] argument\n *[other] arguments\n }")));
diag.span_suggestions_with_style(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move the {$constraint_len ->\n [one] constraint\n *[other] constraints\n } after the generic {$args_len ->\n [one] argument\n *[other] arguments\n }")),
__code_25, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
diag.subdiagnostic(__binding_7);
diag.subdiagnostic(__binding_8);
diag
}
}
}
}
};Diagnostic)]
629#[diag("generic arguments must come before the first constraint")]
630pub(crate) struct ArgsBeforeConstraint {
631 #[primary_span]
632 pub arg_spans: Vec<Span>,
633 #[label(
634 "{$constraint_len ->
635 [one] constraint
636 *[other] constraints
637 }"
638 )]
639 pub constraints: Span,
640 #[label(
641 "generic {$args_len ->
642 [one] argument
643 *[other] arguments
644 }"
645 )]
646 pub args: Span,
647 #[suggestion(
648 "move the {$constraint_len ->
649 [one] constraint
650 *[other] constraints
651 } after the generic {$args_len ->
652 [one] argument
653 *[other] arguments
654 }",
655 code = "{suggestion}",
656 applicability = "machine-applicable",
657 style = "verbose"
658 )]
659 pub data: Span,
660 pub suggestion: String,
661 pub constraint_len: usize,
662 pub args_len: usize,
663 #[subdiagnostic]
664 pub constraint_spans: EmptyLabelManySpans,
665 #[subdiagnostic]
666 pub arg_spans2: EmptyLabelManySpans,
667}
668
669pub(crate) struct EmptyLabelManySpans(pub Vec<Span>);
670
671impl Subdiagnostic for EmptyLabelManySpans {
673 fn add_to_diag(self, diag: &mut Diag<'_>) {
674 diag.span_labels(self.0, "");
675 }
676}
677
678#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternFnPointer {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PatternFnPointer { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in function pointer types")));
diag.code(E0561);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
679#[diag("patterns aren't allowed in function pointer types", code = E0561)]
680pub(crate) struct PatternFnPointer {
681 #[primary_span]
682 pub span: Span,
683}
684
685#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
PatternParenthesizedArgList {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PatternParenthesizedArgList { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in parenthesized argument lists")));
diag.code(E0561);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
686#[diag("patterns aren't allowed in parenthesized argument lists", code = E0561)]
687pub(crate) struct PatternParenthesizedArgList {
688 #[primary_span]
689 pub span: Span,
690}
691
692#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
PathFoundCVariadicParams {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PathFoundCVariadicParams {
span: __binding_0, sugg_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic parameters aren't allowed in parenthesized argument lists")));
let __code_26 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the C-variadics")),
__code_26, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
693#[diag("C-variadic parameters aren't allowed in parenthesized argument lists")]
694pub(crate) struct PathFoundCVariadicParams {
695 #[primary_span]
696 pub span: Span,
697 #[suggestion("remove the C-variadics", applicability = "machine-applicable", code = "")]
698 pub sugg_span: Span,
699}
700
701#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraitObjectBound {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TraitObjectBound { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only a single explicit lifetime bound is permitted")));
diag.code(E0226);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
702#[diag("only a single explicit lifetime bound is permitted", code = E0226)]
703pub(crate) struct TraitObjectBound {
704 #[primary_span]
705 pub span: Span,
706}
707
708#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NestedImplTrait {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NestedImplTrait {
span: __binding_0, outer: __binding_1, inner: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested `impl Trait` is not allowed")));
diag.code(E0666);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("outer `impl Trait`")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested `impl Trait` here")));
diag
}
}
}
}
};Diagnostic)]
709#[diag("nested `impl Trait` is not allowed", code = E0666)]
710pub(crate) struct NestedImplTrait {
711 #[primary_span]
712 pub span: Span,
713 #[label("outer `impl Trait`")]
714 pub outer: Span,
715 #[label("nested `impl Trait` here")]
716 pub inner: Span,
717}
718
719#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AtLeastOneTrait {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AtLeastOneTrait { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("at least one trait must be specified")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
720#[diag("at least one trait must be specified")]
721pub(crate) struct AtLeastOneTrait {
722 #[primary_span]
723 pub span: Span,
724}
725
726#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
OutOfOrderParams<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
OutOfOrderParams {
spans: __binding_0,
sugg_span: __binding_1,
param_ord: __binding_2,
max_param: __binding_3,
ordered_params: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_ord} parameters must be declared prior to {$max_param} parameters")));
let __code_27 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_4))
})].into_iter();
;
diag.arg("param_ord", __binding_2);
diag.arg("max_param", __binding_3);
diag.span(__binding_0.clone());
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reorder the parameters: lifetimes, then consts and types")),
__code_27, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
727#[diag("{$param_ord} parameters must be declared prior to {$max_param} parameters")]
728pub(crate) struct OutOfOrderParams<'a> {
729 #[primary_span]
730 pub spans: Vec<Span>,
731 #[suggestion(
732 "reorder the parameters: lifetimes, then consts and types",
733 code = "{ordered_params}",
734 applicability = "machine-applicable"
735 )]
736 pub sugg_span: Span,
737 pub param_ord: String,
738 pub max_param: String,
739 pub ordered_params: &'a str,
740}
741
742#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ObsoleteAuto {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ObsoleteAuto { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait for .. {\"{}\"}` is an obsolete syntax")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `auto trait Trait {\"{}\"}` instead")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
743#[diag("`impl Trait for .. {\"{}\"}` is an obsolete syntax")]
744#[help("use `auto trait Trait {\"{}\"}` instead")]
745pub(crate) struct ObsoleteAuto {
746 #[primary_span]
747 pub span: Span,
748}
749
750#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeNegativeImpl {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeNegativeImpl {
span: __binding_0,
negative: __binding_1,
r#unsafe: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative impls cannot be unsafe")));
diag.code(E0198);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative because of this")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe because of this")));
diag
}
}
}
}
};Diagnostic)]
751#[diag("negative impls cannot be unsafe", code = E0198)]
752pub(crate) struct UnsafeNegativeImpl {
753 #[primary_span]
754 pub span: Span,
755 #[label("negative because of this")]
756 pub negative: Span,
757 #[label("unsafe because of this")]
758 pub r#unsafe: Span,
759}
760
761#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeItem {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnsafeItem { span: __binding_0, kind: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} cannot be declared unsafe")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
762#[diag("{$kind} cannot be declared unsafe")]
763pub(crate) struct UnsafeItem {
764 #[primary_span]
765 pub span: Span,
766 pub kind: &'static str,
767}
768
769#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MissingUnsafeOnExtern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingUnsafeOnExtern {
span: __binding_0, unsafe_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern blocks must be unsafe")));
let __code_28 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe "))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs `unsafe` before the extern keyword")),
__code_28, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
770#[diag("extern blocks must be unsafe")]
771pub(crate) struct MissingUnsafeOnExtern {
772 #[primary_span]
773 pub span: Span,
774
775 #[suggestion(
776 "needs `unsafe` before the extern keyword",
777 code = "unsafe ",
778 applicability = "machine-applicable"
779 )]
780 pub unsafe_span: Span,
781}
782
783#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MissingUnsafeOnExternLint {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingUnsafeOnExternLint { suggestion: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern blocks should be unsafe")));
let __code_29 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe "))
})].into_iter();
;
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs `unsafe` before the extern keyword")),
__code_29, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
784#[diag("extern blocks should be unsafe")]
785pub(crate) struct MissingUnsafeOnExternLint {
786 #[suggestion(
787 "needs `unsafe` before the extern keyword",
788 code = "unsafe ",
789 applicability = "machine-applicable"
790 )]
791 pub suggestion: Span,
792}
793
794#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FieldlessUnion {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FieldlessUnion { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unions cannot have zero fields")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
795#[diag("unions cannot have zero fields")]
796pub(crate) struct FieldlessUnion {
797 #[primary_span]
798 pub span: Span,
799}
800
801#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
WhereClauseAfterTypeAlias {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
WhereClauseAfterTypeAlias {
span: __binding_0, help: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clauses are not allowed after the type for type aliases")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information")));
;
diag.span(__binding_0);
if __binding_1 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(checked_type_aliases)]` to the crate attributes to enable")));
}
diag
}
}
}
}
};Diagnostic)]
802#[diag("where clauses are not allowed after the type for type aliases")]
803#[note("see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information")]
804pub(crate) struct WhereClauseAfterTypeAlias {
805 #[primary_span]
806 pub span: Span,
807 #[help("add `#![feature(checked_type_aliases)]` to the crate attributes to enable")]
808 pub help: bool,
809}
810
811#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
WhereClauseBeforeTypeAlias {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
WhereClauseBeforeTypeAlias {
span: __binding_0, sugg: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clauses are not allowed before the type for type aliases")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
812#[diag("where clauses are not allowed before the type for type aliases")]
813#[note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")]
814pub(crate) struct WhereClauseBeforeTypeAlias {
815 #[primary_span]
816 pub span: Span,
817 #[subdiagnostic]
818 pub sugg: WhereClauseBeforeTypeAliasSugg,
819}
820
821#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for WhereClauseBeforeTypeAliasSugg {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
WhereClauseBeforeTypeAliasSugg::Remove { span: __binding_0 }
=> {
let __code_30 =
[::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 this `where`")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_30, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
WhereClauseBeforeTypeAliasSugg::Move {
left: __binding_0, snippet: __binding_1, right: __binding_2
} => {
let mut suggestions = Vec::new();
let __code_31 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
let __code_32 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_1))
});
suggestions.push((__binding_0, __code_31));
suggestions.push((__binding_2, __code_32));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move it to the end of the type declaration")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowAlways);
}
}
}
}
};Subdiagnostic)]
822pub(crate) enum WhereClauseBeforeTypeAliasSugg {
823 #[suggestion("remove this `where`", applicability = "machine-applicable", code = "")]
824 Remove {
825 #[primary_span]
826 span: Span,
827 },
828 #[multipart_suggestion(
829 "move it to the end of the type declaration",
830 applicability = "machine-applicable",
831 style = "verbose"
832 )]
833 Move {
834 #[suggestion_part(code = "")]
835 left: Span,
836 snippet: String,
837 #[suggestion_part(code = "{snippet}")]
838 right: Span,
839 },
840}
841
842#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
GenericDefaultTrailing {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
GenericDefaultTrailing { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters with a default must be trailing")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
843#[diag("generic parameters with a default must be trailing")]
844pub(crate) struct GenericDefaultTrailing {
845 #[primary_span]
846 pub span: Span,
847}
848
849#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for NestedLifetimes {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NestedLifetimes { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested quantification of lifetimes")));
diag.code(E0316);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
850#[diag("nested quantification of lifetimes", code = E0316)]
851pub(crate) struct NestedLifetimes {
852 #[primary_span]
853 pub span: Span,
854}
855
856#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ConstBoundTraitObject {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConstBoundTraitObject { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const trait bounds are not allowed in trait object types")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
857#[diag("const trait bounds are not allowed in trait object types")]
858pub(crate) struct ConstBoundTraitObject {
859 #[primary_span]
860 pub span: Span,
861}
862
863#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for TildeConstDisallowed
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
TildeConstDisallowed {
span: __binding_0, reason: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`[const]` is not allowed here")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
866#[diag("`[const]` is not allowed here")]
867pub(crate) struct TildeConstDisallowed {
868 #[primary_span]
869 pub span: Span,
870 #[subdiagnostic]
871 pub reason: TildeConstReason,
872}
873
874#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for TildeConstReason {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
TildeConstReason::Closure => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closures cannot have `[const]` trait bounds")),
&sub_args);
diag.note(__message);
}
TildeConstReason::Function { ident: __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("this function is not `const`, so it cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::Trait { 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("this trait is not `const`, so it cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::TraitImpl { 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("this impl is not `const`, so it cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::Impl { 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("inherent impls cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::TraitAssocTy { 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("associated types in non-`const` traits cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::TraitImplAssocTy { 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("associated types in non-const impls cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::InherentAssocTy { 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("inherent associated types cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::Struct { 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("structs cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::Enum { 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("enums cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::Union { 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("unions cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::AnonConst { 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("anonymous constants cannot have `[const]` trait bounds")),
&sub_args);
diag.span_note(__binding_0, __message);
}
TildeConstReason::TraitObject => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait objects cannot have `[const]` trait bounds")),
&sub_args);
diag.note(__message);
}
TildeConstReason::Item => {
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this item cannot have `[const]` trait bounds")),
&sub_args);
diag.note(__message);
}
}
}
}
};Subdiagnostic, #[automatically_derived]impl ::core::marker::Copy for TildeConstReason { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for TildeConstReason {
}
#[automatically_derived]impl ::core::clone::Clone for TildeConstReason {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone)]
875pub(crate) enum TildeConstReason {
876 #[note("closures cannot have `[const]` trait bounds")]
877 Closure,
878 #[note("this function is not `const`, so it cannot have `[const]` trait bounds")]
879 Function {
880 #[primary_span]
881 ident: Span,
882 },
883 #[note("this trait is not `const`, so it cannot have `[const]` trait bounds")]
884 Trait {
885 #[primary_span]
886 span: Span,
887 },
888 #[note("this impl is not `const`, so it cannot have `[const]` trait bounds")]
889 TraitImpl {
890 #[primary_span]
891 span: Span,
892 },
893 #[note("inherent impls cannot have `[const]` trait bounds")]
894 Impl {
895 #[primary_span]
896 span: Span,
897 },
898 #[note("associated types in non-`const` traits cannot have `[const]` trait bounds")]
899 TraitAssocTy {
900 #[primary_span]
901 span: Span,
902 },
903 #[note("associated types in non-const impls cannot have `[const]` trait bounds")]
904 TraitImplAssocTy {
905 #[primary_span]
906 span: Span,
907 },
908 #[note("inherent associated types cannot have `[const]` trait bounds")]
909 InherentAssocTy {
910 #[primary_span]
911 span: Span,
912 },
913 #[note("structs cannot have `[const]` trait bounds")]
914 Struct {
915 #[primary_span]
916 span: Span,
917 },
918 #[note("enums cannot have `[const]` trait bounds")]
919 Enum {
920 #[primary_span]
921 span: Span,
922 },
923 #[note("unions cannot have `[const]` trait bounds")]
924 Union {
925 #[primary_span]
926 span: Span,
927 },
928 #[note("anonymous constants cannot have `[const]` trait bounds")]
929 AnonConst {
930 #[primary_span]
931 span: Span,
932 },
933 #[note("trait objects cannot have `[const]` trait bounds")]
934 TraitObject,
935 #[note("this item cannot have `[const]` trait bounds")]
936 Item,
937}
938
939#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstAndCoroutine {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConstAndCoroutine {
spans: __binding_0,
const_span: __binding_1,
coroutine_span: __binding_2,
span: __binding_3,
coroutine_kind: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions cannot be both `const` and `{$coroutine_kind}`")));
;
diag.arg("coroutine_kind", __binding_4);
diag.span(__binding_0.clone());
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` because of this")));
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$coroutine_kind}` because of this")));
diag.span_label(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{\"\"}")));
diag
}
}
}
}
};Diagnostic)]
940#[diag("functions cannot be both `const` and `{$coroutine_kind}`")]
941pub(crate) struct ConstAndCoroutine {
942 #[primary_span]
943 pub spans: Vec<Span>,
944 #[label("`const` because of this")]
945 pub const_span: Span,
946 #[label("`{$coroutine_kind}` because of this")]
947 pub coroutine_span: Span,
948 #[label("{\"\"}")]
949 pub span: Span,
950 pub coroutine_kind: &'static str,
951}
952
953#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
CoroutineAndCVariadic {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CoroutineAndCVariadic {
spans: __binding_0,
coroutine_kind: __binding_1,
coroutine_span: __binding_2,
variadic_span: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions cannot be both `{$coroutine_kind}` and C-variadic")));
;
diag.arg("coroutine_kind", __binding_1);
diag.span(__binding_0.clone());
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$coroutine_kind}` because of this")));
diag.span_label(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic because of this")));
diag
}
}
}
}
};Diagnostic)]
954#[diag("functions cannot be both `{$coroutine_kind}` and C-variadic")]
955pub(crate) struct CoroutineAndCVariadic {
956 #[primary_span]
957 pub spans: Vec<Span>,
958 pub coroutine_kind: &'static str,
959 #[label("`{$coroutine_kind}` because of this")]
960 pub coroutine_span: Span,
961 #[label("C-variadic because of this")]
962 pub variadic_span: Span,
963}
964
965#[derive(const _: () =
{
impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
CVariadicNotSupported<'a> {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
CVariadicNotSupported {
variadic_span: __binding_0, target: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$target}` target does not support c-variadic functions")));
;
diag.arg("target", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
966#[diag("the `{$target}` target does not support c-variadic functions")]
967pub(crate) struct CVariadicNotSupported<'a> {
968 #[primary_span]
969 pub variadic_span: Span,
970 pub target: &'a str,
971}
972
973#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternInForeign {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PatternInForeign { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in foreign function declarations")));
diag.code(E0130);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern not allowed in foreign function")));
diag
}
}
}
}
};Diagnostic)]
974#[diag("patterns aren't allowed in foreign function declarations", code = E0130)]
975pub(crate) struct PatternInForeign {
977 #[primary_span]
978 #[label("pattern not allowed in foreign function")]
979 pub span: Span,
980}
981
982#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternInBodiless {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PatternInBodiless { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in functions without bodies")));
diag.code(E0642);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern not allowed in function without body")));
diag
}
}
}
}
};Diagnostic)]
983#[diag("patterns aren't allowed in functions without bodies", code = E0642)]
984pub(crate) struct PatternInBodiless {
986 #[primary_span]
987 #[label("pattern not allowed in function without body")]
988 pub span: Span,
989}
990
991#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for FeatureOnNonNightly
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
FeatureOnNonNightly {
span: __binding_0,
channel: __binding_1,
stable_features: __binding_2,
sugg: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![feature]` may not be used on the {$channel} release channel")));
let __code_33 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.code(E0554);
;
diag.arg("channel", __binding_1);
diag.span(__binding_0);
for __binding_2 in __binding_2 {
diag.subdiagnostic(__binding_2);
}
if let Some(__binding_3) = __binding_3 {
diag.span_suggestions_with_style(__binding_3,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
__code_33, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
}
}
}
};Diagnostic)]
992#[diag("`#![feature]` may not be used on the {$channel} release channel", code = E0554)]
993pub(crate) struct FeatureOnNonNightly {
994 #[primary_span]
995 pub span: Span,
996 pub channel: &'static str,
997 #[subdiagnostic]
998 pub stable_features: Vec<StableFeature>,
999 #[suggestion("remove the attribute", code = "", applicability = "machine-applicable")]
1000 pub sugg: Option<Span>,
1001}
1002
1003#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for StableFeature {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
StableFeature { name: __binding_0, since: __binding_1 } => {
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("since".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("the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable")),
&sub_args);
diag.help(__message);
}
}
}
}
};Subdiagnostic)]
1004#[help(
1005 "the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable"
1006)]
1007pub(crate) struct StableFeature {
1008 pub name: Symbol,
1009 pub since: Symbol,
1010}
1011
1012#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for IncompatibleFeatures
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
IncompatibleFeatures {
spans: __binding_0, f1: __binding_1, f2: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove one of these features")));
;
diag.arg("f1", __binding_1);
diag.arg("f2", __binding_2);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
1013#[diag("`{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed")]
1014#[help("remove one of these features")]
1015pub(crate) struct IncompatibleFeatures {
1016 #[primary_span]
1017 pub spans: Vec<Span>,
1018 pub f1: Symbol,
1019 pub f2: Symbol,
1020}
1021
1022#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
MissingDependentFeatures {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingDependentFeatures {
parent_span: __binding_0,
parent: __binding_1,
missing: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$parent}` requires {$missing} to be enabled")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enable all of these features")));
;
diag.arg("parent", __binding_1);
diag.arg("missing", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1023#[diag("`{$parent}` requires {$missing} to be enabled")]
1024#[help("enable all of these features")]
1025pub(crate) struct MissingDependentFeatures {
1026 #[primary_span]
1027 pub parent_span: Span,
1028 pub parent: Symbol,
1029 pub missing: String,
1030}
1031
1032#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NegativeBoundUnsupported {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NegativeBoundUnsupported { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative bounds are not supported")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1033#[diag("negative bounds are not supported")]
1034pub(crate) struct NegativeBoundUnsupported {
1035 #[primary_span]
1036 pub span: Span,
1037}
1038
1039#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ConstraintOnNegativeBound {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ConstraintOnNegativeBound { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type constraints not allowed on negative bounds")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1040#[diag("associated type constraints not allowed on negative bounds")]
1041pub(crate) struct ConstraintOnNegativeBound {
1042 #[primary_span]
1043 pub span: Span,
1044}
1045
1046#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
NegativeBoundWithParentheticalNotation {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
NegativeBoundWithParentheticalNotation { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parenthetical notation may not be used for negative bounds")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1047#[diag("parenthetical notation may not be used for negative bounds")]
1048pub(crate) struct NegativeBoundWithParentheticalNotation {
1049 #[primary_span]
1050 pub span: Span,
1051}
1052
1053#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MatchArmWithNoBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MatchArmWithNoBody {
span: __binding_0, suggestion: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`match` arm with no body")));
let __code_34 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" => {{ todo!() }}"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add a body after the pattern")),
__code_34, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
1054#[diag("`match` arm with no body")]
1055pub(crate) struct MatchArmWithNoBody {
1056 #[primary_span]
1057 pub span: Span,
1058 #[suggestion(
1062 "add a body after the pattern",
1063 code = " => {{ todo!() }}",
1065 applicability = "has-placeholders",
1066 style = "verbose"
1067 )]
1068 pub suggestion: Span,
1069}
1070
1071#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
PreciseCapturingNotAllowedHere {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PreciseCapturingNotAllowedHere {
span: __binding_0, loc: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`use<...>` precise capturing syntax not allowed in {$loc}")));
;
diag.arg("loc", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1072#[diag("`use<...>` precise capturing syntax not allowed in {$loc}")]
1073pub(crate) struct PreciseCapturingNotAllowedHere {
1074 #[primary_span]
1075 pub span: Span,
1076 pub loc: &'static str,
1077}
1078
1079#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DuplicatePreciseCapturing {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DuplicatePreciseCapturing {
bound1: __binding_0, bound2: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate `use<...>` precise capturing syntax")));
;
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second `use<...>` here")));
diag
}
}
}
}
};Diagnostic)]
1080#[diag("duplicate `use<...>` precise capturing syntax")]
1081pub(crate) struct DuplicatePreciseCapturing {
1082 #[primary_span]
1083 pub bound1: Span,
1084 #[label("second `use<...>` here")]
1085 pub bound2: Span,
1086}
1087
1088#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingAbi {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingAbi { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` declarations without an explicit ABI are disallowed")));
let __code_35 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("extern \"<abi>\""))
})].into_iter();
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("prior to Rust 2024, a default ABI was inferred")));
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specify an ABI")),
__code_35, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
1089#[diag("`extern` declarations without an explicit ABI are disallowed")]
1090#[help("prior to Rust 2024, a default ABI was inferred")]
1091pub(crate) struct MissingAbi {
1092 #[primary_span]
1093 #[suggestion("specify an ABI", code = "extern \"<abi>\"", applicability = "has-placeholders")]
1094 pub span: Span,
1095}
1096
1097#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingAbiSugg {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
MissingAbiSugg { span: __binding_0, default_abi: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` declarations without an explicit ABI are deprecated")));
let __code_36 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("extern {0}",
__binding_1))
})].into_iter();
;
diag.arg("default_abi", __binding_1);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicitly specify the {$default_abi} ABI")),
__code_36, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
1098#[diag("`extern` declarations without an explicit ABI are deprecated")]
1099pub(crate) struct MissingAbiSugg {
1100 #[suggestion(
1101 "explicitly specify the {$default_abi} ABI",
1102 code = "extern {default_abi}",
1103 applicability = "machine-applicable"
1104 )]
1105 pub span: Span,
1106 pub default_abi: ExternAbi,
1107}
1108
1109#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AbiCustomSafeForeignFunction {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiCustomSafeForeignFunction {
span: __binding_0, safe_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("foreign functions with the \"custom\" ABI cannot be safe")));
let __code_37 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `safe` keyword from this definition")),
__code_37, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
1110#[diag("foreign functions with the \"custom\" ABI cannot be safe")]
1111pub(crate) struct AbiCustomSafeForeignFunction {
1112 #[primary_span]
1113 pub span: Span,
1114
1115 #[suggestion(
1116 "remove the `safe` keyword from this definition",
1117 applicability = "maybe-incorrect",
1118 code = "",
1119 style = "verbose"
1120 )]
1121 pub safe_span: Span,
1122}
1123
1124#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AbiCustomSafeFunction {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiCustomSafeFunction {
span: __binding_0,
abi: __binding_1,
unsafe_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the \"custom\" ABI must be unsafe")));
let __code_38 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe "))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the `unsafe` keyword to this definition")),
__code_38, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
1125#[diag("functions with the \"custom\" ABI must be unsafe")]
1126pub(crate) struct AbiCustomSafeFunction {
1127 #[primary_span]
1128 pub span: Span,
1129 pub abi: ExternAbi,
1130
1131 #[suggestion(
1132 "add the `unsafe` keyword to this definition",
1133 applicability = "maybe-incorrect",
1134 code = "unsafe ",
1135 style = "verbose"
1136 )]
1137 pub unsafe_span: Span,
1138}
1139
1140#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiCannotBeCoroutine
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiCannotBeCoroutine {
span: __binding_0,
abi: __binding_1,
coroutine_kind_span: __binding_2,
coroutine_kind_str: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`")));
let __code_39 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("abi", __binding_1);
diag.arg("coroutine_kind_str", __binding_3);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `{$coroutine_kind_str}` keyword from this definition")),
__code_39, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
1141#[diag("functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`")]
1142pub(crate) struct AbiCannotBeCoroutine {
1143 #[primary_span]
1144 pub span: Span,
1145 pub abi: ExternAbi,
1146
1147 #[suggestion(
1148 "remove the `{$coroutine_kind_str}` keyword from this definition",
1149 applicability = "maybe-incorrect",
1150 code = "",
1151 style = "verbose"
1152 )]
1153 pub coroutine_kind_span: Span,
1154 pub coroutine_kind_str: &'static str,
1155}
1156
1157#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AbiMustNotHaveParametersOrReturnType {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiMustNotHaveParametersOrReturnType {
spans: __binding_0,
abi: __binding_1,
suggestion_span: __binding_2,
symbol: __binding_3,
padding: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern {$abi}` function")));
let __code_40 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}fn{1}()", __binding_4,
__binding_3))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot have any parameters or return type")));
;
diag.arg("abi", __binding_1);
diag.span(__binding_0.clone());
diag.span_suggestions_with_style(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the parameters and return type")),
__code_40, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag
}
}
}
}
};Diagnostic)]
1158#[diag("invalid signature for `extern {$abi}` function")]
1159#[note("functions with the {$abi} ABI cannot have any parameters or return type")]
1160pub(crate) struct AbiMustNotHaveParametersOrReturnType {
1161 #[primary_span]
1162 pub spans: Vec<Span>,
1163 pub abi: ExternAbi,
1164
1165 #[suggestion(
1166 "remove the parameters and return type",
1167 applicability = "maybe-incorrect",
1168 code = "{padding}fn{symbol}()",
1169 style = "verbose"
1170 )]
1171 pub suggestion_span: Span,
1172 pub symbol: String,
1173 pub padding: &'static str,
1174}
1175
1176#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AbiMustNotHaveReturnType {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiMustNotHaveReturnType {
span: __binding_0, abi: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern {$abi}` function")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot have a return type")));
;
diag.arg("abi", __binding_1);
diag.span(__binding_0);
diag.span_help(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the return type")));
diag
}
}
}
}
};Diagnostic)]
1177#[diag("invalid signature for `extern {$abi}` function")]
1178#[note("functions with the {$abi} ABI cannot have a return type")]
1179pub(crate) struct AbiMustNotHaveReturnType {
1180 #[primary_span]
1181 #[help("remove the return type")]
1182 pub span: Span,
1183 pub abi: ExternAbi,
1184}
1185
1186#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiX86Interrupt {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiX86Interrupt {
spans: __binding_0, param_count: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern \"x86-interrupt\"` function")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the \"x86-interrupt\" ABI must be have either 1 or 2 parameters (but found {$param_count})")));
;
diag.arg("param_count", __binding_1);
diag.span(__binding_0.clone());
diag
}
}
}
}
};Diagnostic)]
1187#[diag("invalid signature for `extern \"x86-interrupt\"` function")]
1188#[note(
1189 "functions with the \"x86-interrupt\" ABI must be have either 1 or 2 parameters (but found {$param_count})"
1190)]
1191pub(crate) struct AbiX86Interrupt {
1192 #[primary_span]
1193 pub spans: Vec<Span>,
1194 pub param_count: usize,
1195}
1196
1197#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ScalableVectorNotTupleStruct {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ScalableVectorNotTupleStruct { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("scalable vectors must be tuple structs")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1198#[diag("scalable vectors must be tuple structs")]
1199pub(crate) struct ScalableVectorNotTupleStruct {
1200 #[primary_span]
1201 pub span: Span,
1202}
1203
1204#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
ScalableVectorBadArch {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ScalableVectorBadArch { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("scalable vectors are not supported on this architecture")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1205#[diag("scalable vectors are not supported on this architecture")]
1206pub(crate) struct ScalableVectorBadArch {
1207 #[primary_span]
1208 pub span: Span,
1209}
1210
1211#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for RequiresRustAbi {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
RequiresRustAbi {
track_caller_span: __binding_0, extern_abi_span: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[track_caller]` can only be used with the Rust ABI")));
diag.code(E0737);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `#[track_caller]` here")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not using the Rust ABI because of this")));
diag
}
}
}
}
};Diagnostic)]
1212#[diag("`#[track_caller]` can only be used with the Rust ABI", code = E0737)]
1213pub(crate) struct RequiresRustAbi {
1214 #[primary_span]
1215 #[label("using `#[track_caller]` here")]
1216 pub track_caller_span: Span,
1217 #[label("not using the Rust ABI because of this")]
1218 pub extern_abi_span: Span,
1219}
1220
1221#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedVisibility {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
UnusedVisibility { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility qualifiers have no effect on `const _` declarations")));
let __code_41 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const _` does not declare a name, so there is nothing for the qualifier to apply to")));
;
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the qualifier")),
__code_41, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::HideCodeInline);
diag
}
}
}
}
};Diagnostic)]
1222#[diag("visibility qualifiers have no effect on `const _` declarations")]
1223#[note("`const _` does not declare a name, so there is nothing for the qualifier to apply to")]
1224pub(crate) struct UnusedVisibility {
1225 #[suggestion(
1226 "remove the qualifier",
1227 style = "short",
1228 code = "",
1229 applicability = "machine-applicable"
1230 )]
1231 pub span: Span,
1232}
1233
1234#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for PatternsInFnsWithoutBodySub {
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
PatternsInFnsWithoutBodySub {
span: __binding_0, ident: __binding_1 } => {
let __code_42 =
[::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("remove `mut` from the parameter")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_42, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1235#[suggestion(
1236 "remove `mut` from the parameter",
1237 code = "{ident}",
1238 applicability = "machine-applicable"
1239)]
1240pub(crate) struct PatternsInFnsWithoutBodySub {
1241 #[primary_span]
1242 pub span: Span,
1243
1244 pub ident: Ident,
1245}
1246
1247#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
PatternsInFnsWithoutBody {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
PatternsInFnsWithoutBody::Foreign { sub: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in foreign function declarations")));
;
diag.subdiagnostic(__binding_0);
diag
}
PatternsInFnsWithoutBody::Bodiless { sub: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in functions without bodies")));
;
diag.subdiagnostic(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1248pub(crate) enum PatternsInFnsWithoutBody {
1249 #[diag("patterns aren't allowed in foreign function declarations")]
1250 Foreign {
1251 #[subdiagnostic]
1252 sub: PatternsInFnsWithoutBodySub,
1253 },
1254 #[diag("patterns aren't allowed in functions without bodies")]
1255 Bodiless {
1256 #[subdiagnostic]
1257 sub: PatternsInFnsWithoutBodySub,
1258 },
1259}
1260
1261#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
DeprecatedWhereClauseLocation {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
DeprecatedWhereClauseLocation { suggestion: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clause not allowed here")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")));
;
diag.subdiagnostic(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1262#[diag("where clause not allowed here")]
1263#[note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")]
1264pub(crate) struct DeprecatedWhereClauseLocation {
1265 #[subdiagnostic]
1266 pub suggestion: DeprecatedWhereClauseLocationSugg,
1267}
1268
1269#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for DeprecatedWhereClauseLocationSugg
{
fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
match self {
DeprecatedWhereClauseLocationSugg::MoveToEnd {
left: __binding_0, right: __binding_1, sugg: __binding_2 }
=> {
let mut suggestions = Vec::new();
let __code_43 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
let __code_44 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_2))
});
suggestions.push((__binding_0, __code_43));
suggestions.push((__binding_1, __code_44));
let mut sub_args = rustc_errors::DiagArgMap::default();
let __message =
rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move it to the end of the type declaration")),
&sub_args);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
DeprecatedWhereClauseLocationSugg::RemoveWhere {
span: __binding_0 } => {
let __code_45 =
[::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 this `where`")),
&sub_args);
diag.span_suggestions_with_style(__binding_0, __message,
__code_45, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
}
}
}
};Subdiagnostic)]
1270pub(crate) enum DeprecatedWhereClauseLocationSugg {
1271 #[multipart_suggestion(
1272 "move it to the end of the type declaration",
1273 applicability = "machine-applicable"
1274 )]
1275 MoveToEnd {
1276 #[suggestion_part(code = "")]
1277 left: Span,
1278 #[suggestion_part(code = "{sugg}")]
1279 right: Span,
1280
1281 sugg: String,
1282 },
1283 #[suggestion("remove this `where`", code = "", applicability = "machine-applicable")]
1284 RemoveWhere {
1285 #[primary_span]
1286 span: Span,
1287 },
1288}
1289
1290#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
VarargsWithoutPattern {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
VarargsWithoutPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing pattern for `...` argument")));
let __code_46 =
[::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("add a pattern for this argument")),
__code_46, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1291#[diag("missing pattern for `...` argument")]
1292pub(crate) struct VarargsWithoutPattern {
1293 #[suggestion(
1294 "add a pattern for this argument",
1295 applicability = "machine-applicable",
1296 code = "_: ..."
1297 )]
1298 #[primary_span]
1299 pub span: Span,
1300}
1301
1302#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiCustomMustBeNaked
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiCustomMustBeNaked {
span: __binding_0, naked_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `extern \"custom\"` function can only be declared externally or defined via naked functions")));
let __code_47 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("#[unsafe(naked)]\n"))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert this to an `#[unsafe(naked)]` function")),
__code_47, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeInline);
diag
}
}
}
}
};Diagnostic)]
1303#[diag(
1304 "an `extern \"custom\"` function can only be declared externally or defined via naked functions"
1305)]
1306pub(crate) struct AbiCustomMustBeNaked {
1307 #[primary_span]
1308 pub span: Span,
1309 #[suggestion(
1310 "convert this to an `#[unsafe(naked)]` function",
1311 applicability = "maybe-incorrect",
1312 code = "#[unsafe(naked)]\n",
1313 style = "short"
1314 )]
1315 pub naked_span: Span,
1316}
1317
1318#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for
AbiCustomCannotBeCold {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
AbiCustomCannotBeCold {
span: __binding_0,
cold_span: __binding_1,
abi_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `extern \"custom\"` function cannot be marked `#[cold]`")));
let __code_48 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `#[cold]` attribute")),
__code_48, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::HideCodeInline);
diag.span_label(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"custom\"` because of this")));
diag
}
}
}
}
};Diagnostic)]
1319#[diag("an `extern \"custom\"` function cannot be marked `#[cold]`")]
1320pub(crate) struct AbiCustomCannotBeCold {
1321 #[primary_span]
1322 pub span: Span,
1323
1324 #[suggestion(
1325 "remove the `#[cold]` attribute",
1326 applicability = "maybe-incorrect",
1327 code = "",
1328 style = "short"
1329 )]
1330 pub cold_span: Span,
1331
1332 #[label("`extern \"custom\"` because of this")]
1333 pub abi_span: Span,
1334}
1335
1336#[derive(const _: () =
{
impl<'_sess> rustc_errors::Diagnostic<'_sess> for ShowSpan {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
match self {
ShowSpan { span: __binding_0, kind: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("showing the spans of the {$kind}")));
;
diag.arg("kind", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1337#[diag("showing the spans of the {$kind}")]
1338pub(crate) struct ShowSpan {
1339 #[primary_span]
1340 pub span: Span,
1341 pub kind: &'static str,
1342}