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