Skip to main content

rustc_ast_lowering/
diagnostics.rs

1use rustc_errors::codes::*;
2use rustc_errors::{DiagArgFromDisplay, DiagArgValue, DiagSymbolList, IntoDiagArg};
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Ident, Span, Symbol};
5
6#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            GenericTypeWithParentheses {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    GenericTypeWithParentheses {
                        span: __binding_0, sub: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parenthesized type parameters may only be used with a `Fn` trait")));
                        diag.code(E0214);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `Fn` traits may use parentheses")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
7#[diag("parenthesized type parameters may only be used with a `Fn` trait", code = E0214)]
8pub(crate) struct GenericTypeWithParentheses {
9    #[primary_span]
10    #[label("only `Fn` traits may use parentheses")]
11    pub span: Span,
12    #[subdiagnostic]
13    pub sub: Option<UseAngleBrackets>,
14}
15
16#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UseAngleBrackets {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UseAngleBrackets {
                        open_param: __binding_0, close_param: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_0 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("<"))
                                });
                        let __code_1 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(">"))
                                });
                        suggestions.push((__binding_0, __code_0));
                        suggestions.push((__binding_1, __code_1));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use angle brackets instead")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
17#[multipart_suggestion("use angle brackets instead", applicability = "maybe-incorrect")]
18pub(crate) struct UseAngleBrackets {
19    #[suggestion_part(code = "<")]
20    pub open_param: Span,
21    #[suggestion_part(code = ">")]
22    pub close_param: Span,
23}
24
25#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAbi {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAbi {
                        span: __binding_0,
                        abi: __binding_1,
                        command: __binding_2,
                        suggestion: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid ABI: found `{$abi}`")));
                        diag.code(E0703);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invoke `{$command}` for a full list of supported calling conventions")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.arg("command", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid ABI")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
26#[diag("invalid ABI: found `{$abi}`", code = E0703)]
27#[note("invoke `{$command}` for a full list of supported calling conventions")]
28pub(crate) struct InvalidAbi {
29    #[primary_span]
30    #[label("invalid ABI")]
31    pub span: Span,
32    pub abi: Symbol,
33    pub command: String,
34    #[subdiagnostic]
35    pub suggestion: Option<InvalidAbiSuggestion>,
36}
37
38#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            TupleStructWithDefault {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TupleStructWithDefault { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("default fields are not supported in tuple structs")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("default fields are only supported on structs")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
39#[diag("default fields are not supported in tuple structs")]
40pub(crate) struct TupleStructWithDefault {
41    #[primary_span]
42    #[label("default fields are only supported on structs")]
43    pub span: Span,
44}
45
46#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidAbiSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidAbiSuggestion {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("suggestion".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("there's a similarly named valid ABI `{$suggestion}`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
47#[suggestion(
48    "there's a similarly named valid ABI `{$suggestion}`",
49    code = "\"{suggestion}\"",
50    applicability = "maybe-incorrect",
51    style = "verbose"
52)]
53pub(crate) struct InvalidAbiSuggestion {
54    #[primary_span]
55    pub span: Span,
56    pub suggestion: String,
57}
58
59#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssocTyParentheses {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AssocTyParentheses { span: __binding_0, sub: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parenthesized generic arguments cannot be used in associated type constraints")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
60#[diag("parenthesized generic arguments cannot be used in associated type constraints")]
61pub(crate) struct AssocTyParentheses {
62    #[primary_span]
63    pub span: Span,
64    #[subdiagnostic]
65    pub sub: AssocTyParenthesesSub,
66}
67
68#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AssocTyParenthesesSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AssocTyParenthesesSub::Empty { parentheses_span: __binding_0
                        } => {
                        let mut suggestions = Vec::new();
                        let __code_3 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_3));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove these parentheses")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    AssocTyParenthesesSub::NotEmpty {
                        open_param: __binding_0, close_param: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_4 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("<"))
                                });
                        let __code_5 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(">"))
                                });
                        suggestions.push((__binding_0, __code_4));
                        suggestions.push((__binding_1, __code_5));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use angle brackets instead")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
69pub(crate) enum AssocTyParenthesesSub {
70    #[multipart_suggestion("remove these parentheses")]
71    Empty {
72        #[suggestion_part(code = "")]
73        parentheses_span: Span,
74    },
75    #[multipart_suggestion("use angle brackets instead")]
76    NotEmpty {
77        #[suggestion_part(code = "<")]
78        open_param: Span,
79        #[suggestion_part(code = ">")]
80        close_param: Span,
81    },
82}
83
84#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            MisplacedImplTrait<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MisplacedImplTrait {
                        span: __binding_0, position: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` is not allowed in {$position}")));
                        diag.code(E0562);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` is only allowed in arguments and return types of functions and methods")));
                        ;
                        diag.arg("position", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
85#[diag("`impl Trait` is not allowed in {$position}", code = E0562)]
86#[note("`impl Trait` is only allowed in arguments and return types of functions and methods")]
87pub(crate) struct MisplacedImplTrait<'a> {
88    #[primary_span]
89    pub span: Span,
90    pub position: DiagArgFromDisplay<'a>,
91}
92
93#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MisplacedAssocTyBinding {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MisplacedAssocTyBinding {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type bounds are not allowed in `dyn` types")));
                        let __code_6 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = impl"))
                                            })].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("use `impl Trait` to introduce a type instead")),
                                __code_6, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
94#[diag("associated type bounds are not allowed in `dyn` types")]
95pub(crate) struct MisplacedAssocTyBinding {
96    #[primary_span]
97    pub span: Span,
98    #[suggestion(
99        "use `impl Trait` to introduce a type instead",
100        code = " = impl",
101        applicability = "maybe-incorrect",
102        style = "verbose"
103    )]
104    pub suggestion: Option<Span>,
105}
106
107#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnderscoreExprLhsAssign {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnderscoreExprLhsAssign { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in expressions, `_` can only be used on the left-hand side of an assignment")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`_` not allowed here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
108#[diag("in expressions, `_` can only be used on the left-hand side of an assignment")]
109pub(crate) struct UnderscoreExprLhsAssign {
110    #[primary_span]
111    #[label("`_` not allowed here")]
112    pub span: Span,
113}
114
115#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AwaitOnlyInAsyncFnAndBlocks {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AwaitOnlyInAsyncFnAndBlocks {
                        await_kw_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`await` is only allowed inside `async` functions and blocks")));
                        diag.code(E0728);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only allowed inside `async` functions and blocks")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not `async`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
116#[diag("`await` is only allowed inside `async` functions and blocks", code = E0728)]
117pub(crate) struct AwaitOnlyInAsyncFnAndBlocks {
118    #[primary_span]
119    #[label("only allowed inside `async` functions and blocks")]
120    pub await_kw_span: Span,
121    #[label("this is not `async`")]
122    pub item_span: Option<Span>,
123}
124
125#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstComptimeFn {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstComptimeFn { span: __binding_0, attr_span: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a function cannot be both `comptime` and `const`")));
                        let __code_7 =
                            [::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_7, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` implies the function can be called at runtime, too")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`comptime` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
126#[diag("a function cannot be both `comptime` and `const`")]
127pub(crate) struct ConstComptimeFn {
128    #[primary_span]
129    #[suggestion("remove the `const`", applicability = "machine-applicable", code = "")]
130    #[note("`const` implies the function can be called at runtime, too")]
131    pub span: Span,
132    #[label("`comptime` because of this")]
133    pub attr_span: Span,
134}
135
136#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CoroutineTooManyParameters {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CoroutineTooManyParameters { fn_decl_span: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("too many parameters for a coroutine (expected 0 or 1 parameters)")));
                        diag.code(E0628);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
137#[diag("too many parameters for a coroutine (expected 0 or 1 parameters)", code = E0628)]
138pub(crate) struct CoroutineTooManyParameters {
139    #[primary_span]
140    pub fn_decl_span: Span,
141}
142
143#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ClosureCannotBeStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ClosureCannotBeStatic { fn_decl_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closures cannot be static")));
                        diag.code(E0697);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
144#[diag("closures cannot be static", code = E0697)]
145pub(crate) struct ClosureCannotBeStatic {
146    #[primary_span]
147    pub fn_decl_span: Span,
148}
149
150#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MoveExprOnlyInSupportedContexts {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MoveExprOnlyInSupportedContexts { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`move(expr)` is only supported in closures, `async`, `gen`, and `async gen` blocks")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
151#[diag("`move(expr)` is only supported in closures, `async`, `gen`, and `async gen` blocks")]
152pub(crate) struct MoveExprOnlyInSupportedContexts {
153    #[primary_span]
154    pub span: Span,
155}
156
157#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NestedMoveExprWithoutEnclosingContext {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NestedMoveExprWithoutEnclosingContext { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested `move(expr)` requires another enclosing closure, `async`, `gen`, or `async gen` block")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
158#[diag(
159    "nested `move(expr)` requires another enclosing closure, `async`, `gen`, or `async gen` block"
160)]
161pub(crate) struct NestedMoveExprWithoutEnclosingContext {
162    #[primary_span]
163    pub span: Span,
164}
165
166#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            FunctionalRecordUpdateDestructuringAssignment {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FunctionalRecordUpdateDestructuringAssignment {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functional record updates are not allowed in destructuring assignments")));
                        let __code_8 =
                            [::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("consider removing the trailing pattern")),
                            __code_8, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
167#[diag("functional record updates are not allowed in destructuring assignments")]
168pub(crate) struct FunctionalRecordUpdateDestructuringAssignment {
169    #[primary_span]
170    #[suggestion(
171        "consider removing the trailing pattern",
172        code = "",
173        applicability = "machine-applicable"
174    )]
175    pub span: Span,
176}
177
178#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AsyncCoroutinesNotSupported {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AsyncCoroutinesNotSupported { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`async` coroutines are not yet supported")));
                        diag.code(E0727);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
179#[diag("`async` coroutines are not yet supported", code = E0727)]
180pub(crate) struct AsyncCoroutinesNotSupported {
181    #[primary_span]
182    pub span: Span,
183}
184
185#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InlineAsmUnsupportedTarget {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InlineAsmUnsupportedTarget { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inline assembly is unsupported on this target")));
                        diag.code(E0472);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
186#[diag("inline assembly is unsupported on this target", code = E0472)]
187pub(crate) struct InlineAsmUnsupportedTarget {
188    #[primary_span]
189    pub span: Span,
190}
191
192#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AttSyntaxOnlyX86 {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AttSyntaxOnlyX86 { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `att_syntax` option is only supported on x86")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
193#[diag("the `att_syntax` option is only supported on x86")]
194pub(crate) struct AttSyntaxOnlyX86 {
195    #[primary_span]
196    pub span: Span,
197}
198
199#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiSpecifiedMultipleTimes {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiSpecifiedMultipleTimes {
                        abi_span: __binding_0,
                        prev_name: __binding_1,
                        prev_span: __binding_2,
                        equivalent: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$prev_name}` ABI specified multiple times")));
                        ;
                        diag.arg("prev_name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previously specified here")));
                        if __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("these ABIs are equivalent on the current target")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
200#[diag("`{$prev_name}` ABI specified multiple times")]
201pub(crate) struct AbiSpecifiedMultipleTimes {
202    #[primary_span]
203    pub abi_span: Span,
204    pub prev_name: Symbol,
205    #[label("previously specified here")]
206    pub prev_span: Span,
207    #[note("these ABIs are equivalent on the current target")]
208    pub equivalent: bool,
209}
210
211#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ClobberAbiNotSupported {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ClobberAbiNotSupported { abi_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`clobber_abi` is not supported on this target")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
212#[diag("`clobber_abi` is not supported on this target")]
213pub(crate) struct ClobberAbiNotSupported {
214    #[primary_span]
215    pub abi_span: Span,
216}
217
218#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            InvalidAbiClobberAbi<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAbiClobberAbi {
                        abi_span: __binding_0, supported_abis: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid ABI for `clobber_abi`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following ABIs are supported on this target: {$supported_abis}")));
                        ;
                        diag.arg("supported_abis", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
219#[note("the following ABIs are supported on this target: {$supported_abis}")]
220#[diag("invalid ABI for `clobber_abi`")]
221pub(crate) struct InvalidAbiClobberAbi<'a> {
222    #[primary_span]
223    pub abi_span: Span,
224    pub supported_abis: DiagSymbolList<&'a str>,
225}
226
227#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            InvalidRegister<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidRegister {
                        op_span: __binding_0, reg: __binding_1, error: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid register `{$reg}`: {$error}")));
                        ;
                        diag.arg("reg", __binding_1);
                        diag.arg("error", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
228#[diag("invalid register `{$reg}`: {$error}")]
229pub(crate) struct InvalidRegister<'a> {
230    #[primary_span]
231    pub op_span: Span,
232    pub reg: Symbol,
233    pub error: &'a str,
234}
235
236#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidRegisterClass
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidRegisterClass {
                        op_span: __binding_0,
                        reg_class: __binding_1,
                        supported_register_classes: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid register class `{$reg_class}`: unknown register class")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following register classes are supported on this target: {$supported_register_classes}")));
                        ;
                        diag.arg("reg_class", __binding_1);
                        diag.arg("supported_register_classes", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
237#[note(
238    "the following register classes are supported on this target: {$supported_register_classes}"
239)]
240#[diag("invalid register class `{$reg_class}`: unknown register class")]
241pub(crate) struct InvalidRegisterClass {
242    #[primary_span]
243    pub op_span: Span,
244    pub reg_class: Symbol,
245    pub supported_register_classes: DiagSymbolList<Symbol>,
246}
247
248#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAsmTemplateModifierRegClass {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAsmTemplateModifierRegClass {
                        placeholder_span: __binding_0,
                        op_span: __binding_1,
                        modifier: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid asm template modifier `{$modifier}` for this register class")));
                        ;
                        diag.arg("modifier", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("template modifier")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
249#[diag("invalid asm template modifier `{$modifier}` for this register class")]
250pub(crate) struct InvalidAsmTemplateModifierRegClass {
251    #[primary_span]
252    #[label("template modifier")]
253    pub placeholder_span: Span,
254    #[label("argument")]
255    pub op_span: Span,
256    pub modifier: String,
257    #[subdiagnostic]
258    pub sub: InvalidAsmTemplateModifierRegClassSub,
259}
260
261#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            InvalidAsmTemplateModifierRegClassSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidAsmTemplateModifierRegClassSub::SupportModifier {
                        class_name: __binding_0, modifiers: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("class_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("modifiers".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 `{$class_name}` register class supports the following template modifiers: {$modifiers}")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvalidAsmTemplateModifierRegClassSub::DoesNotSupportModifier {
                        class_name: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("class_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$class_name}` register class does not support template modifiers")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvalidAsmTemplateModifierRegClassSub::ModifierIsGated {
                        class_name: __binding_0,
                        feature: __binding_1,
                        stable_modifiers: __binding_2,
                        all_modifiers: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("class_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("feature".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("stable_modifiers".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("all_modifiers".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$class_name}` register class only supports the following template modifiers on stable: {$stable_modifiers}")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enabling the `{$feature}` feature will allow using: {$all_modifiers}")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
262pub(crate) enum InvalidAsmTemplateModifierRegClassSub {
263    #[note(
264        "the `{$class_name}` register class supports the following template modifiers: {$modifiers}"
265    )]
266    SupportModifier { class_name: Symbol, modifiers: DiagSymbolList<char> },
267    #[note("the `{$class_name}` register class does not support template modifiers")]
268    DoesNotSupportModifier { class_name: Symbol },
269
270    /// Enabling a feature is needed to use the requested modifier.
271    #[note(
272        "the `{$class_name}` register class only supports the following template modifiers on stable: {$stable_modifiers}"
273    )]
274    #[note("enabling the `{$feature}` feature will allow using: {$all_modifiers}")]
275    ModifierIsGated {
276        class_name: Symbol,
277        feature: Symbol,
278        stable_modifiers: DiagSymbolList<char>,
279        all_modifiers: DiagSymbolList<char>,
280    },
281}
282
283#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAsmTemplateModifierConst {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAsmTemplateModifierConst {
                        placeholder_span: __binding_0, op_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm template modifiers are not allowed for `const` arguments")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("template modifier")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
284#[diag("asm template modifiers are not allowed for `const` arguments")]
285pub(crate) struct InvalidAsmTemplateModifierConst {
286    #[primary_span]
287    #[label("template modifier")]
288    pub placeholder_span: Span,
289    #[label("argument")]
290    pub op_span: Span,
291}
292
293#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAsmTemplateModifierSym {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAsmTemplateModifierSym {
                        placeholder_span: __binding_0, op_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm template modifiers are not allowed for `sym` arguments")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("template modifier")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
294#[diag("asm template modifiers are not allowed for `sym` arguments")]
295pub(crate) struct InvalidAsmTemplateModifierSym {
296    #[primary_span]
297    #[label("template modifier")]
298    pub placeholder_span: Span,
299    #[label("argument")]
300    pub op_span: Span,
301}
302
303#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAsmTemplateModifierLabel {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAsmTemplateModifierLabel {
                        placeholder_span: __binding_0, op_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asm template modifiers are not allowed for `label` arguments")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("template modifier")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
304#[diag("asm template modifiers are not allowed for `label` arguments")]
305pub(crate) struct InvalidAsmTemplateModifierLabel {
306    #[primary_span]
307    #[label("template modifier")]
308    pub placeholder_span: Span,
309    #[label("argument")]
310    pub op_span: Span,
311}
312
313#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RegisterClassOnlyClobber {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RegisterClassOnlyClobber {
                        op_span: __binding_0, reg_class_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("register class `{$reg_class_name}` can only be used as a clobber, not as an input or output")));
                        ;
                        diag.arg("reg_class_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
314#[diag(
315    "register class `{$reg_class_name}` can only be used as a clobber, not as an input or output"
316)]
317pub(crate) struct RegisterClassOnlyClobber {
318    #[primary_span]
319    pub op_span: Span,
320    pub reg_class_name: Symbol,
321}
322
323#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RegisterClassOnlyClobberStable {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RegisterClassOnlyClobberStable {
                        op_span: __binding_0, reg_class_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("register class `{$reg_class_name}` can only be used as a clobber in stable")));
                        ;
                        diag.arg("reg_class_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
324#[diag("register class `{$reg_class_name}` can only be used as a clobber in stable")]
325pub(crate) struct RegisterClassOnlyClobberStable {
326    #[primary_span]
327    pub op_span: Span,
328    pub reg_class_name: Symbol,
329}
330
331#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            RegisterConflict<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RegisterConflict {
                        op_span1: __binding_0,
                        op_span2: __binding_1,
                        reg1_name: __binding_2,
                        reg2_name: __binding_3,
                        in_out: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("register `{$reg1_name}` conflicts with register `{$reg2_name}`")));
                        ;
                        diag.arg("reg1_name", __binding_2);
                        diag.arg("reg2_name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("register `{$reg1_name}`")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("register `{$reg2_name}`")));
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_help(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `lateout` instead of `out` to avoid conflict")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
332#[diag("register `{$reg1_name}` conflicts with register `{$reg2_name}`")]
333pub(crate) struct RegisterConflict<'a> {
334    #[primary_span]
335    #[label("register `{$reg1_name}`")]
336    pub op_span1: Span,
337    #[label("register `{$reg2_name}`")]
338    pub op_span2: Span,
339    pub reg1_name: &'a str,
340    pub reg2_name: &'a str,
341    #[help("use `lateout` instead of `out` to avoid conflict")]
342    pub in_out: Option<Span>,
343}
344
345#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            SubTupleBinding<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SubTupleBinding {
                        span: __binding_0,
                        ident: __binding_1,
                        ident_name: __binding_2,
                        ctx: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident_name} @` is not allowed in a {$ctx}")));
                        let __code_9 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".."))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this and bind each tuple field independently")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.arg("ident_name", __binding_2);
                        diag.arg("ctx", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is only allowed in slice patterns")));
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you don't need to use the contents of {$ident}, discard the tuple's remaining fields")),
                            __code_9, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
346#[help("remove this and bind each tuple field independently")]
347#[diag("`{$ident_name} @` is not allowed in a {$ctx}")]
348pub(crate) struct SubTupleBinding<'a> {
349    #[primary_span]
350    #[label("this is only allowed in slice patterns")]
351    #[suggestion(
352        "if you don't need to use the contents of {$ident}, discard the tuple's remaining fields",
353        style = "verbose",
354        code = "..",
355        applicability = "maybe-incorrect"
356    )]
357    pub span: Span,
358    pub ident: Ident,
359    pub ident_name: Symbol,
360    pub ctx: &'a str,
361}
362
363#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ExtraDoubleDot<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExtraDoubleDot {
                        span: __binding_0, prev_span: __binding_1, ctx: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`..` can only be used once per {$ctx} pattern")));
                        ;
                        diag.arg("ctx", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can only be used once per {$ctx} pattern")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previously used here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
364#[diag("`..` can only be used once per {$ctx} pattern")]
365pub(crate) struct ExtraDoubleDot<'a> {
366    #[primary_span]
367    #[label("can only be used once per {$ctx} pattern")]
368    pub span: Span,
369    #[label("previously used here")]
370    pub prev_span: Span,
371    pub ctx: &'a str,
372}
373
374#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MisplacedDoubleDot {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MisplacedDoubleDot { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`..` patterns are not allowed here")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only allowed in tuple, tuple struct, and slice patterns")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
375#[note("only allowed in tuple, tuple struct, and slice patterns")]
376#[diag("`..` patterns are not allowed here")]
377pub(crate) struct MisplacedDoubleDot {
378    #[primary_span]
379    pub span: Span,
380}
381
382#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MatchArmWithNoBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MatchArmWithNoBody {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`match` arm with no body")));
                        let __code_10 =
                            [::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_10, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
383#[diag("`match` arm with no body")]
384pub(crate) struct MatchArmWithNoBody {
385    #[primary_span]
386    pub span: Span,
387    #[suggestion(
388        "add a body after the pattern",
389        // ignore-tidy-todo
390        code = " => todo!(),",
391        applicability = "has-placeholders"
392    )]
393    pub suggestion: Span,
394}
395
396#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NeverPatternWithBody
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NeverPatternWithBody { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a never pattern is always unreachable")));
                        let __code_11 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this will never be executed")));
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this expression")),
                            __code_11, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
397#[diag("a never pattern is always unreachable")]
398pub(crate) struct NeverPatternWithBody {
399    #[primary_span]
400    #[label("this will never be executed")]
401    #[suggestion("remove this expression", code = "", applicability = "maybe-incorrect")]
402    pub span: Span,
403}
404
405#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NeverPatternWithGuard {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NeverPatternWithGuard { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a guard on a never pattern will never be run")));
                        let __code_12 =
                            [::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 this guard")),
                            __code_12, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
406#[diag("a guard on a never pattern will never be run")]
407pub(crate) struct NeverPatternWithGuard {
408    #[primary_span]
409    #[suggestion("remove this guard", code = "", applicability = "maybe-incorrect")]
410    pub span: Span,
411}
412
413#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ArbitraryExpressionInPattern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ArbitraryExpressionInPattern {
                        span: __binding_0,
                        pattern_from_macro_note: __binding_1,
                        const_block_in_pattern_help: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("arbitrary expressions aren't allowed in patterns")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `expr` fragment specifier forces the metavariable's content to be an expression")));
                        }
                        if __binding_2 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a named `const`-item or an `if`-guard (`x if x == const {\"{ ... }\"}`) instead")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
414#[diag("arbitrary expressions aren't allowed in patterns")]
415pub(crate) struct ArbitraryExpressionInPattern {
416    #[primary_span]
417    pub span: Span,
418    #[note("the `expr` fragment specifier forces the metavariable's content to be an expression")]
419    pub pattern_from_macro_note: bool,
420    #[help("use a named `const`-item or an `if`-guard (`x if x == const {\"{ ... }\"}`) instead")]
421    pub const_block_in_pattern_help: bool,
422}
423
424#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InclusiveRangeWithNoEnd {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InclusiveRangeWithNoEnd { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inclusive range with no end")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
425#[diag("inclusive range with no end")]
426pub(crate) struct InclusiveRangeWithNoEnd {
427    #[primary_span]
428    pub span: Span,
429}
430
431#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RTNSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RTNSuggestion { output: __binding_0, input: __binding_1 } =>
                        {
                        let mut suggestions = Vec::new();
                        let __code_13 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_14 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("(..)"))
                                });
                        suggestions.push((__binding_0, __code_13));
                        suggestions.push((__binding_1, __code_14));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the right argument notation and remove the return type")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
432#[multipart_suggestion(
433    "use the right argument notation and remove the return type",
434    applicability = "machine-applicable",
435    style = "verbose"
436)]
437/// Given `T: Tr<m() -> Ret>` or `T: Tr<m(Ty) -> Ret>`, suggest `T: Tr<m(..)>`.
438pub(crate) struct RTNSuggestion {
439    #[suggestion_part(code = "")]
440    pub output: Span,
441    #[suggestion_part(code = "(..)")]
442    pub input: Span,
443}
444
445#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BadReturnTypeNotation {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BadReturnTypeNotation::Inputs { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument types not allowed with return type notation")));
                        let __code_15 =
                            [::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 input types")),
                            __code_15, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                    BadReturnTypeNotation::Output {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type not allowed with return type notation")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                    BadReturnTypeNotation::NeedsDots { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation arguments must be elided with `..`")));
                        let __code_16 =
                            [::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("use the correct syntax by adding `..` to the arguments")),
                            __code_16, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                    BadReturnTypeNotation::Position { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation not allowed in this position yet")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
446pub(crate) enum BadReturnTypeNotation {
447    #[diag("argument types not allowed with return type notation")]
448    Inputs {
449        #[primary_span]
450        #[suggestion(
451            "remove the input types",
452            code = "(..)",
453            applicability = "machine-applicable",
454            style = "verbose"
455        )]
456        span: Span,
457    },
458    #[diag("return type not allowed with return type notation")]
459    Output {
460        #[primary_span]
461        span: Span,
462        #[subdiagnostic]
463        suggestion: RTNSuggestion,
464    },
465    #[diag("return type notation arguments must be elided with `..`")]
466    NeedsDots {
467        #[primary_span]
468        #[suggestion(
469            "use the correct syntax by adding `..` to the arguments",
470            code = "(..)",
471            applicability = "machine-applicable",
472            style = "verbose"
473        )]
474        span: Span,
475    },
476    #[diag("return type notation not allowed in this position yet")]
477    Position {
478        #[primary_span]
479        span: Span,
480    },
481}
482
483#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            GenericParamDefaultInBinder {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    GenericParamDefaultInBinder { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("defaults for generic parameters are not allowed in `for<...>` binders")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
484#[diag("defaults for generic parameters are not allowed in `for<...>` binders")]
485pub(crate) struct GenericParamDefaultInBinder {
486    #[primary_span]
487    pub span: Span,
488}
489
490#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AsyncBoundNotOnTrait
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AsyncBoundNotOnTrait { span: __binding_0, descr: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`async` bound modifier only allowed on trait, not `{$descr}`")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
491#[diag("`async` bound modifier only allowed on trait, not `{$descr}`")]
492pub(crate) struct AsyncBoundNotOnTrait {
493    #[primary_span]
494    pub span: Span,
495    pub descr: &'static str,
496}
497
498#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AsyncBoundOnlyForFnTraits {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AsyncBoundOnlyForFnTraits { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`async` bound modifier only allowed on `Fn`/`FnMut`/`FnOnce` traits")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
499#[diag("`async` bound modifier only allowed on `Fn`/`FnMut`/`FnOnce` traits")]
500pub(crate) struct AsyncBoundOnlyForFnTraits {
501    #[primary_span]
502    pub span: Span,
503}
504
505#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NoPreciseCapturesOnApit {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NoPreciseCapturesOnApit { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`use<...>` precise capturing syntax not allowed in argument-position `impl Trait`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
506#[diag("`use<...>` precise capturing syntax not allowed in argument-position `impl Trait`")]
507pub(crate) struct NoPreciseCapturesOnApit {
508    #[primary_span]
509    pub span: Span,
510}
511
512#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for YieldInClosure {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    YieldInClosure { span: __binding_0, suggestion: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`yield` can only be used in `#[coroutine]` closures, or `gen` blocks")));
                        let __code_17 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#[coroutine] "))
                                            })].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("use `#[coroutine]` to make this closure a coroutine")),
                                __code_17, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
513#[diag("`yield` can only be used in `#[coroutine]` closures, or `gen` blocks")]
514pub(crate) struct YieldInClosure {
515    #[primary_span]
516    pub span: Span,
517    #[suggestion(
518        "use `#[coroutine]` to make this closure a coroutine",
519        code = "#[coroutine] ",
520        applicability = "maybe-incorrect",
521        style = "verbose"
522    )]
523    pub suggestion: Option<Span>,
524}
525
526#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidLegacyConstGenericArg {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidLegacyConstGenericArg {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
527#[diag(
528    "invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items"
529)]
530pub(crate) struct InvalidLegacyConstGenericArg {
531    #[primary_span]
532    pub span: Span,
533    #[subdiagnostic]
534    pub suggestion: UseConstGenericArg,
535}
536
537#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UseConstGenericArg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UseConstGenericArg {
                        end_of_fn: __binding_0,
                        const_args: __binding_1,
                        other_args: __binding_2,
                        call_args: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_18 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("::<{0}>", __binding_1))
                                });
                        let __code_19 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                });
                        suggestions.push((__binding_0, __code_18));
                        suggestions.push((__binding_3, __code_19));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a const generic argument instead")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
538#[multipart_suggestion(
539    "try using a const generic argument instead",
540    applicability = "maybe-incorrect"
541)]
542pub(crate) struct UseConstGenericArg {
543    #[suggestion_part(code = "::<{const_args}>")]
544    pub end_of_fn: Span,
545    pub const_args: String,
546    pub other_args: String,
547    #[suggestion_part(code = "{other_args}")]
548    pub call_args: Span,
549}
550
551#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnionWithDefault {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnionWithDefault { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unions cannot have default field values")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
552#[diag("unions cannot have default field values")]
553pub(crate) struct UnionWithDefault {
554    #[primary_span]
555    pub span: Span,
556}
557
558#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnresolvedDelegationCallee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnresolvedDelegationCallee { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to resolve delegation callee")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
559#[diag("failed to resolve delegation callee")]
560pub(crate) struct UnresolvedDelegationCallee {
561    #[primary_span]
562    pub span: Span,
563}
564
565#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CycleInDelegationSignatureResolution {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CycleInDelegationSignatureResolution { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("encountered a cycle during delegation signature resolution")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
566#[diag("encountered a cycle during delegation signature resolution")]
567pub(crate) struct CycleInDelegationSignatureResolution {
568    #[primary_span]
569    pub span: Span,
570}
571
572#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationBlockSpecifiedWhenNoParams {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationBlockSpecifiedWhenNoParams { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("delegation's target expression is specified for function with no params")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
573#[diag("delegation's target expression is specified for function with no params")]
574pub(crate) struct DelegationBlockSpecifiedWhenNoParams {
575    #[primary_span]
576    pub span: Span,
577}
578
579#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationAttemptedBlockWithDefsDeletion {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationAttemptedBlockWithDefsDeletion { span: __binding_0
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempted to delete delegation's target expression that contains definitions inside")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
580#[diag("attempted to delete delegation's target expression that contains definitions inside")]
581pub(crate) struct DelegationAttemptedBlockWithDefsDeletion {
582    #[primary_span]
583    pub span: Span,
584}
585
586#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationInfersMismatch {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationInfersMismatch {
                        span: __binding_0,
                        expected: __binding_1,
                        actual: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong infer used: expected {$expected}, found: {$actual}")));
                        ;
                        diag.arg("expected", __binding_1);
                        diag.arg("actual", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
587#[diag("wrong infer used: expected {$expected}, found: {$actual}")]
588pub(crate) struct DelegationInfersMismatch {
589    #[primary_span]
590    pub span: Span,
591    pub expected: Symbol,
592    pub actual: Symbol,
593}
594
595#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationAttemptedBlockWithDefsRelowering {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationAttemptedBlockWithDefsRelowering {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempted to lower target expression with definitions more than once while mapping argument")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
596#[diag(
597    "attempted to lower target expression with definitions more than once while mapping argument"
598)]
599pub(crate) struct DelegationAttemptedBlockWithDefsRelowering {
600    #[primary_span]
601    pub span: Span,
602}
603
604/// Whether resolving `impl` or `mut` restriction paths
605#[derive(#[automatically_derived]impl ::core::fmt::Debug for ResolvingRestrictionKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                ResolvingRestrictionKind::Impl => "Impl",
                ResolvingRestrictionKind::Mut => "Mut",
            })
    }
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for ResolvingRestrictionKind {
}
#[automatically_derived]impl ::core::clone::Clone for ResolvingRestrictionKind
    {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for ResolvingRestrictionKind
    {
}Copy)]
606pub(crate) enum ResolvingRestrictionKind {
607    Impl,
608    Mut,
609}
610
611impl IntoDiagArg for ResolvingRestrictionKind {
612    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
613        use std::borrow::Cow;
614        match self {
615            ResolvingRestrictionKind::Impl => DiagArgValue::Str(Cow::Borrowed("impl")),
616            ResolvingRestrictionKind::Mut => DiagArgValue::Str(Cow::Borrowed("mut")),
617        }
618    }
619}
620
621#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RestrictionAncestorOnly {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RestrictionAncestorOnly {
                        span: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind ->\n    [impl] trait implementation\n    *[mut] field mutation\n} can only be restricted to ancestor modules")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
622#[diag(
623    "{$kind ->
624    [impl] trait implementation
625    *[mut] field mutation
626} can only be restricted to ancestor modules"
627)]
628pub(crate) struct RestrictionAncestorOnly {
629    #[primary_span]
630    pub(crate) span: Span,
631    pub(crate) kind: ResolvingRestrictionKind,
632}
633
634#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AmbiguousDelegationToInherentImpl {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AmbiguousDelegationToInherentImpl { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous delegation to inherent impl function")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
635#[diag("ambiguous delegation to inherent impl function")]
636pub(crate) struct AmbiguousDelegationToInherentImpl {
637    #[primary_span]
638    pub span: Span,
639}
640
641#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationToInherentImplMustContainParentGenerics {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationToInherentImplMustContainParentGenerics {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("delegation to inherent impl must contain parent generics")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
642#[diag("delegation to inherent impl must contain parent generics")]
643pub(crate) struct DelegationToInherentImplMustContainParentGenerics {
644    #[primary_span]
645    pub span: Span,
646}
647
648#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DelegationToInherentImplParentContainsInfer {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DelegationToInherentImplParentContainsInfer {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parent segment of delegation to inherent impl can not contain infers")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
649#[diag("parent segment of delegation to inherent impl can not contain infers")]
650pub(crate) struct DelegationToInherentImplParentContainsInfer {
651    #[primary_span]
652    pub span: Span,
653}