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