Skip to main content

rustc_lint/
diagnostics.rs

1// ignore-tidy-file-filelength
2use std::num::NonZero;
3
4use rustc_attr_ir::find_attr;
5use rustc_data_structures::fx::FxIndexMap;
6use rustc_errors::codes::*;
7use rustc_errors::formatting::DiagMessageAddArg;
8use rustc_errors::{
9    Applicability, Diag, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic, Level,
10    Subdiagnostic, SuggestionStyle, msg,
11};
12use rustc_hir as hir;
13use rustc_hir::def_id::{DefId, LocalDefId};
14use rustc_hir::intravisit::Visitor;
15use rustc_macros::{Diagnostic, Subdiagnostic};
16use rustc_middle::ty::inhabitedness::InhabitedPredicate;
17use rustc_middle::ty::{Clause, PolyExistentialTraitRef, Ty, TyCtxt};
18use rustc_session::Session;
19use rustc_span::edition::Edition;
20use rustc_span::{Ident, Span, Symbol, sym};
21use rustc_structures::LintName;
22
23use crate::LateContext;
24use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
25use crate::lifetime_syntax::LifetimeSyntaxCategories;
26
27#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverruledAttribute<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverruledAttribute {
                        span: __binding_0,
                        overruled: __binding_1,
                        lint_level: __binding_2,
                        lint_name: __binding_3,
                        sub: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$lint_level}({$lint_name}) incompatible with previous forbid")));
                        diag.code(E0453);
                        ;
                        diag.arg("lint_level", __binding_2);
                        diag.arg("lint_name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overruled by previous forbid")));
                        diag.subdiagnostic(__binding_4);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
28#[diag("{$lint_level}({$lint_name}) incompatible with previous forbid", code = E0453)]
29pub(crate) struct OverruledAttribute<'a> {
30    #[primary_span]
31    pub span: Span,
32    #[label("overruled by previous forbid")]
33    pub overruled: Span,
34    pub lint_level: &'a str,
35    pub lint_name: LintName,
36    #[subdiagnostic]
37    pub sub: OverruledAttributeSub,
38}
39
40pub(crate) enum OverruledAttributeSub {
41    DefaultSource { id: String },
42    NodeSource { span: Span, reason: Option<Symbol> },
43    CommandLineSource { forbidden_lint_name: LintName },
44}
45
46impl Subdiagnostic for OverruledAttributeSub {
47    fn add_to_diag(self, diag: &mut Diag<'_>) {
48        match self {
49            OverruledAttributeSub::DefaultSource { id } => {
50                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`forbid` lint level is the default for {$id}"))msg!("`forbid` lint level is the default for {$id}"));
51                diag.arg("id", id);
52            }
53            OverruledAttributeSub::NodeSource { span, reason } => {
54                diag.span_label(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`forbid` level set here"))msg!("`forbid` level set here"));
55                if let Some(rationale) = reason {
56                    diag.note(rationale.to_string());
57                }
58            }
59            OverruledAttributeSub::CommandLineSource { forbidden_lint_name } => {
60                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`forbid` lint level was set on command line (`-F {$forbidden_lint_name}`)"))msg!(
61                    "`forbid` lint level was set on command line (`-F {$forbidden_lint_name}`)"
62                ));
63                diag.arg("forbidden_lint_name", forbidden_lint_name);
64            }
65        }
66    }
67}
68
69#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnknownToolInScopedLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownToolInScopedLint {
                        span: __binding_0,
                        tool_name: __binding_1,
                        lint_name: __binding_2,
                        is_nightly_build: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown tool name `{$tool_name}` found in scoped lint: `{$lint_name}`")));
                        diag.code(E0710);
                        ;
                        diag.arg("tool_name", __binding_1);
                        diag.arg("lint_name", __binding_2);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        if __binding_3 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![register_tool({$tool_name})]` to the crate root")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
70#[diag("unknown tool name `{$tool_name}` found in scoped lint: `{$lint_name}`", code = E0710)]
71pub(crate) struct UnknownToolInScopedLint {
72    #[primary_span]
73    pub span: Option<Span>,
74    pub tool_name: Symbol,
75    pub lint_name: LintName,
76    #[help("add `#![register_tool({$tool_name})]` to the crate root")]
77    pub is_nightly_build: bool,
78}
79
80#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinNoMangleGeneric {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinNoMangleGeneric {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions generic over types or consts must be mangled")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
81#[diag("functions generic over types or consts must be mangled")]
82pub(crate) struct BuiltinNoMangleGeneric {
83    #[primary_span]
84    pub span: Span,
85    // Use of `#[no_mangle]` suggests FFI intent; correct
86    // fix may be to monomorphize source by hand
87    #[suggestion(
88        "remove this attribute",
89        style = "short",
90        code = "",
91        applicability = "maybe-incorrect"
92    )]
93    pub suggestion: Span,
94}
95
96#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinEllipsisInclusiveRangePatterns {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinEllipsisInclusiveRangePatterns {
                        span: __binding_0,
                        suggestion: __binding_1,
                        replace: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` range patterns are deprecated")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.code(E0783);
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `..=` for an inclusive range")),
                            __code_3, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
97#[diag("`...` range patterns are deprecated", code = E0783)]
98pub(crate) struct BuiltinEllipsisInclusiveRangePatterns {
99    #[primary_span]
100    pub span: Span,
101    #[suggestion(
102        "use `..=` for an inclusive range",
103        style = "short",
104        code = "{replace}",
105        applicability = "machine-applicable"
106    )]
107    pub suggestion: Span,
108    pub replace: String,
109}
110
111#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RequestedLevel {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RequestedLevel { level: __binding_0, lint_name: __binding_1
                        } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("level".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("lint_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("requested on the command line with `{$level} {$lint_name}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
112#[note("requested on the command line with `{$level} {$lint_name}`")]
113pub(crate) struct RequestedLevel {
114    pub level: rustc_lint_defs::Level,
115    pub lint_name: LintName,
116}
117
118#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsupportedGroup {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsupportedGroup { lint_group: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$lint_group}` lint group is not supported with ´--force-warn´")));
                        diag.code(E0602);
                        ;
                        diag.arg("lint_group", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
119#[diag("`{$lint_group}` lint group is not supported with ´--force-warn´", code = E0602)]
120pub(crate) struct UnsupportedGroup {
121    pub lint_group: String,
122}
123
124#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CheckNameUnknownTool
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CheckNameUnknownTool {
                        tool_name: __binding_0, sub: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown lint tool: `{$tool_name}`")));
                        diag.code(E0602);
                        ;
                        diag.arg("tool_name", __binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
125#[diag("unknown lint tool: `{$tool_name}`", code = E0602)]
126pub(crate) struct CheckNameUnknownTool {
127    pub tool_name: Symbol,
128    #[subdiagnostic]
129    pub sub: RequestedLevel,
130}
131
132// array_into_iter.rs
133#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ShadowedIntoIterDiag
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ShadowedIntoIterDiag {
                        target: __binding_0,
                        edition: __binding_1,
                        suggestion: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this method call resolves to `<&{$target} as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<{$target} as IntoIterator>::into_iter` in Rust {$edition}")));
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("iter"))
                                            })].into_iter();
                        ;
                        diag.arg("target", __binding_0);
                        diag.arg("edition", __binding_1);
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.iter()` instead of `.into_iter()` to avoid ambiguity")),
                            __code_4, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
134#[diag(
135    "this method call resolves to `<&{$target} as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<{$target} as IntoIterator>::into_iter` in Rust {$edition}"
136)]
137pub(crate) struct ShadowedIntoIterDiag {
138    pub target: &'static str,
139    pub edition: &'static str,
140    #[suggestion(
141        "use `.iter()` instead of `.into_iter()` to avoid ambiguity",
142        code = "iter",
143        applicability = "machine-applicable"
144    )]
145    pub suggestion: Span,
146    #[subdiagnostic]
147    pub sub: Option<ShadowedIntoIterDiagSub>,
148}
149
150#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ShadowedIntoIterDiagSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ShadowedIntoIterDiagSub::RemoveIntoIter { span: __binding_0
                        } => {
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or remove `.into_iter()` to iterate by value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_5, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    ShadowedIntoIterDiagSub::UseExplicitIntoIter {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_6 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("IntoIterator::into_iter("))
                                });
                        let __code_7 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_6));
                        suggestions.push((__binding_1, __code_7));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
151pub(crate) enum ShadowedIntoIterDiagSub {
152    #[suggestion(
153        "or remove `.into_iter()` to iterate by value",
154        code = "",
155        applicability = "maybe-incorrect"
156    )]
157    RemoveIntoIter {
158        #[primary_span]
159        span: Span,
160    },
161    #[multipart_suggestion(
162        "or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value",
163        applicability = "maybe-incorrect"
164    )]
165    UseExplicitIntoIter {
166        #[suggestion_part(code = "IntoIterator::into_iter(")]
167        start_span: Span,
168        #[suggestion_part(code = ")")]
169        end_span: Span,
170    },
171}
172
173// autorefs.rs
174#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ImplicitUnsafeAutorefsDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImplicitUnsafeAutorefsDiag {
                        raw_ptr_span: __binding_0,
                        raw_ptr_ty: __binding_1,
                        origin: __binding_2,
                        method: __binding_3,
                        suggestion: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implicit autoref creates a reference to the dereference of a raw pointer")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("creating a reference requires the pointer target to be valid and imposes aliasing requirements")));
                        ;
                        diag.arg("raw_ptr_ty", __binding_1);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this raw pointer has type `{$raw_ptr_ty}`")));
                        diag.subdiagnostic(__binding_2);
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag.subdiagnostic(__binding_4);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
175#[diag("implicit autoref creates a reference to the dereference of a raw pointer")]
176#[note(
177    "creating a reference requires the pointer target to be valid and imposes aliasing requirements"
178)]
179pub(crate) struct ImplicitUnsafeAutorefsDiag<'a> {
180    #[label("this raw pointer has type `{$raw_ptr_ty}`")]
181    pub raw_ptr_span: Span,
182    pub raw_ptr_ty: Ty<'a>,
183    #[subdiagnostic]
184    pub origin: ImplicitUnsafeAutorefsOrigin<'a>,
185    #[subdiagnostic]
186    pub method: Option<ImplicitUnsafeAutorefsMethodNote>,
187    #[subdiagnostic]
188    pub suggestion: ImplicitUnsafeAutorefsSuggestion,
189}
190
191#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            ImplicitUnsafeAutorefsOrigin<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ImplicitUnsafeAutorefsOrigin::Autoref {
                        autoref_span: __binding_0, autoref_ty: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("autoref_ty".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("autoref is being applied to this expression, resulting in: `{$autoref_ty}`")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    ImplicitUnsafeAutorefsOrigin::OverloadedDeref => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
192pub(crate) enum ImplicitUnsafeAutorefsOrigin<'a> {
193    #[note("autoref is being applied to this expression, resulting in: `{$autoref_ty}`")]
194    Autoref {
195        #[primary_span]
196        autoref_span: Span,
197        autoref_ty: Ty<'a>,
198    },
199    #[note(
200        "references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations"
201    )]
202    OverloadedDeref,
203}
204
205#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ImplicitUnsafeAutorefsMethodNote
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ImplicitUnsafeAutorefsMethodNote {
                        def_span: __binding_0, method_name: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("method_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("method calls to `{$method_name}` require a reference")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
206#[note("method calls to `{$method_name}` require a reference")]
207pub(crate) struct ImplicitUnsafeAutorefsMethodNote {
208    #[primary_span]
209    pub def_span: Span,
210    pub method_name: Symbol,
211}
212
213#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ImplicitUnsafeAutorefsSuggestion
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ImplicitUnsafeAutorefsSuggestion {
                        mutbl: __binding_0,
                        deref: __binding_1,
                        start_span: __binding_2,
                        end_span: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_8 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("({1}{0}", __binding_1,
                                            __binding_0))
                                });
                        let __code_9 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_2, __code_8));
                        suggestions.push((__binding_3, __code_9));
                        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 raw pointer method instead; or if this reference is intentional, make it explicit")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
214#[multipart_suggestion(
215    "try using a raw pointer method instead; or if this reference is intentional, make it explicit",
216    applicability = "maybe-incorrect"
217)]
218pub(crate) struct ImplicitUnsafeAutorefsSuggestion {
219    pub mutbl: &'static str,
220    pub deref: &'static str,
221    #[suggestion_part(code = "({mutbl}{deref}")]
222    pub start_span: Span,
223    #[suggestion_part(code = ")")]
224    pub end_span: Span,
225}
226
227// builtin.rs
228#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BuiltinWhileTrue {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinWhileTrue {
                        suggestion: __binding_0, replace: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("denote infinite loops with `loop {\"{\"} ... {\"}\"}`")));
                        let __code_10 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `loop`")),
                            __code_10, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
229#[diag("denote infinite loops with `loop {\"{\"} ... {\"}\"}`")]
230pub(crate) struct BuiltinWhileTrue {
231    #[suggestion(
232        "use `loop`",
233        style = "short",
234        code = "{replace}",
235        applicability = "machine-applicable"
236    )]
237    pub suggestion: Span,
238    pub replace: String,
239}
240
241#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinNonShorthandFieldPatterns {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinNonShorthandFieldPatterns {
                        ident: __binding_0,
                        suggestion: __binding_1,
                        prefix: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$ident}:` in this pattern is redundant")));
                        let __code_11 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}{0}", __binding_0,
                                                        __binding_2))
                                            })].into_iter();
                        ;
                        diag.arg("ident", __binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use shorthand field pattern")),
                            __code_11, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
242#[diag("the `{$ident}:` in this pattern is redundant")]
243pub(crate) struct BuiltinNonShorthandFieldPatterns {
244    pub ident: Ident,
245    #[suggestion(
246        "use shorthand field pattern",
247        code = "{prefix}{ident}",
248        applicability = "machine-applicable"
249    )]
250    pub suggestion: Span,
251    pub prefix: &'static str,
252}
253
254#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BuiltinUnsafe {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinUnsafe::AllowInternalUnsafe => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::UnsafeBlock => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of an `unsafe` block")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::UnsafeExternBlock => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of an `unsafe extern` block")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::UnsafeTrait => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of an `unsafe` trait")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::UnsafeImpl => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementation of an `unsafe` trait")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::DeclUnsafeFn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of an `unsafe` function")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::DeclUnsafeMethod => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of an `unsafe` method")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::ImplUnsafeMethod => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementation of an `unsafe` method")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::GlobalAsm => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of `core::arch::global_asm`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using this macro is unsafe even though it does not need an `unsafe` block")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
255pub(crate) enum BuiltinUnsafe {
256    #[diag(
257        "`allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site"
258    )]
259    AllowInternalUnsafe,
260    #[diag("usage of an `unsafe` block")]
261    UnsafeBlock,
262    #[diag("usage of an `unsafe extern` block")]
263    UnsafeExternBlock,
264    #[diag("declaration of an `unsafe` trait")]
265    UnsafeTrait,
266    #[diag("implementation of an `unsafe` trait")]
267    UnsafeImpl,
268    #[diag("declaration of an `unsafe` function")]
269    DeclUnsafeFn,
270    #[diag("declaration of an `unsafe` method")]
271    DeclUnsafeMethod,
272    #[diag("implementation of an `unsafe` method")]
273    ImplUnsafeMethod,
274    #[diag("usage of `core::arch::global_asm`")]
275    #[note("using this macro is unsafe even though it does not need an `unsafe` block")]
276    GlobalAsm,
277}
278
279#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinMissingDoc<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinMissingDoc { article: __binding_0, desc: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing documentation for {$article} {$desc}")));
                        ;
                        diag.arg("article", __binding_0);
                        diag.arg("desc", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
280#[diag("missing documentation for {$article} {$desc}")]
281pub(crate) struct BuiltinMissingDoc<'a> {
282    pub article: &'a str,
283    pub desc: &'a str,
284}
285
286#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinMissingCopyImpl {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinMissingCopyImpl => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type could implement `Copy`; consider adding `impl Copy`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
287#[diag("type could implement `Copy`; consider adding `impl Copy`")]
288pub(crate) struct BuiltinMissingCopyImpl;
289
290pub(crate) struct BuiltinMissingDebugImpl<'a> {
291    pub tcx: TyCtxt<'a>,
292    pub def_id: DefId,
293}
294
295// Needed for def_path_str
296impl<'a> Diagnostic<'a> for BuiltinMissingDebugImpl<'_> {
297    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
298        let Self { tcx, def_id } = self;
299        Diag::new(
300            dcx,
301            level,
302            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type does not implement `{$debug}`; consider adding `#[derive(Debug)]` or a manual implementation"))msg!("type does not implement `{$debug}`; consider adding `#[derive(Debug)]` or a manual implementation"),
303        ).with_arg("debug", tcx.def_path_str(def_id))
304    }
305}
306
307#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinAnonymousParams<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinAnonymousParams {
                        suggestion: __binding_0, ty_snip: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("anonymous parameters are deprecated and will be removed in the next edition")));
                        let __code_12 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("_: {0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try naming the parameter or explicitly ignoring it")),
                            __code_12, __binding_0.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
308#[diag("anonymous parameters are deprecated and will be removed in the next edition")]
309pub(crate) struct BuiltinAnonymousParams<'a> {
310    #[suggestion("try naming the parameter or explicitly ignoring it", code = "_: {ty_snip}")]
311    pub suggestion: (Span, Applicability),
312    pub ty_snip: &'a str,
313}
314
315#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinUnusedDocComment<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinUnusedDocComment {
                        kind: __binding_0, label: __binding_1, sub: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused doc comment")));
                        ;
                        diag.arg("kind", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rustdoc does not generate documentation for {$kind}")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
316#[diag("unused doc comment")]
317pub(crate) struct BuiltinUnusedDocComment<'a> {
318    pub kind: &'a str,
319    #[label("rustdoc does not generate documentation for {$kind}")]
320    pub label: Span,
321    #[subdiagnostic]
322    pub sub: BuiltinUnusedDocCommentSub,
323}
324
325#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BuiltinUnusedDocCommentSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    BuiltinUnusedDocCommentSub::PlainHelp => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `//` for a plain comment")),
                                &sub_args);
                        diag.help(__message);
                    }
                    BuiltinUnusedDocCommentSub::BlockHelp => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `/* */` for a plain comment")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
326pub(crate) enum BuiltinUnusedDocCommentSub {
327    #[help("use `//` for a plain comment")]
328    PlainHelp,
329    #[help("use `/* */` for a plain comment")]
330    BlockHelp,
331}
332
333#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BuiltinConstNoMangle
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinConstNoMangle { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const items should never be `#[no_mangle]`")));
                        let __code_13 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("pub static "))
                                            })].into_iter();
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_suggestions_with_style(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try a static value")),
                                __code_13, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
334#[diag("const items should never be `#[no_mangle]`")]
335pub(crate) struct BuiltinConstNoMangle {
336    #[suggestion("try a static value", code = "pub static ", applicability = "machine-applicable")]
337    pub suggestion: Option<Span>,
338}
339
340#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinMutablesTransmutes {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinMutablesTransmutes => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
341#[diag(
342    "transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell"
343)]
344pub(crate) struct BuiltinMutablesTransmutes;
345
346#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinUnstableFeatures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinUnstableFeatures => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of an unstable feature")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
347#[diag("use of an unstable feature")]
348pub(crate) struct BuiltinUnstableFeatures;
349
350// lint_ungated_async_fn_track_caller
351pub(crate) struct BuiltinUngatedAsyncFnTrackCaller<'a> {
352    pub label: Span,
353    pub session: &'a Session,
354}
355
356impl<'a> Diagnostic<'a> for BuiltinUngatedAsyncFnTrackCaller<'_> {
357    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
358        let mut diag = Diag::new(dcx, level, "`#[track_caller]` on async functions is a no-op")
359            .with_span_label(self.label, "this function will not propagate the caller location");
360        rustc_session::diagnostics::add_feature_diagnostics(
361            &mut diag,
362            self.session,
363            sym::async_fn_track_caller,
364        );
365        diag
366    }
367}
368
369#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinUnreachablePub<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinUnreachablePub {
                        what: __binding_0,
                        new_vis: __binding_1,
                        suggestion: __binding_2,
                        help: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable `pub` {$what}")));
                        let __code_14 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.arg("what", __binding_0);
                        diag.span_suggestions_with_style(__binding_2.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider restricting its visibility")),
                            __code_14, __binding_2.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if __binding_3 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider exporting it for use by other crates")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
370#[diag("unreachable `pub` {$what}")]
371pub(crate) struct BuiltinUnreachablePub<'a> {
372    pub what: &'a str,
373    pub new_vis: &'a str,
374    #[suggestion("consider restricting its visibility", code = "{new_vis}")]
375    pub suggestion: (Span, Applicability),
376    #[help("or consider exporting it for use by other crates")]
377    pub help: bool,
378}
379
380#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MacroExprFragment2024 {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MacroExprFragment2024 { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `expr` fragment specifier will accept more expressions in the 2024 edition")));
                        let __code_15 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("expr_2021"))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to keep the existing behavior, use the `expr_2021` fragment specifier")),
                            __code_15, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
381#[diag("the `expr` fragment specifier will accept more expressions in the 2024 edition")]
382pub(crate) struct MacroExprFragment2024 {
383    #[suggestion(
384        "to keep the existing behavior, use the `expr_2021` fragment specifier",
385        code = "expr_2021",
386        applicability = "machine-applicable"
387    )]
388    pub suggestion: Span,
389}
390
391pub(crate) struct BuiltinTypeAliasBounds<'tcx> {
392    pub in_where_clause: bool,
393    pub label: Span,
394    pub suggestions: Vec<(Span, String)>,
395
396    pub def_id: LocalDefId,
397    pub preds: &'tcx [hir::WherePredicate<'tcx>],
398    pub ty: Option<&'tcx hir::Ty<'tcx>>,
399    pub tcx: TyCtxt<'tcx>,
400}
401
402impl<'a> Diagnostic<'a> for BuiltinTypeAliasBounds<'_> {
403    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
404        // We perform various checks (i.e., query calls & the walk) in here instead of in
405        // `<TypeAliasBounds as LateLintPass>` to avoid doing throwaway work in case the lint
406        // ends up getting suppressed.
407
408        let is_marked = {
        {
            'done:
                {
                for i in
                    ::rustc_attr_ir::HasAttrs::get_attrs(self.def_id, &self.tcx)
                    {
                    #[allow(unused_imports)]
                    use ::rustc_attr_ir::AttributeKind::*;
                    let i: &::rustc_attr_ir::Attribute = i;
                    match i {
                        ::rustc_attr_ir::Attribute::Parsed(UncheckedTypeAlias) => {
                            break 'done Some(());
                        }
                        ::rustc_attr_ir::Attribute::Tool(..) |
                            ::rustc_attr_ir::Attribute::DeriveHelper(..) =>
                            {}
                            #[deny(unreachable_patterns)]
                            _ => {}
                    }
                }
                None
            }
        }
    }.is_some()find_attr!(self.tcx, self.def_id, UncheckedTypeAlias);
409
410        let kind = if is_marked { "unchecked " } else { "" };
411        let msg = if self.in_where_clause {
412            ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("where clauses on {0}type aliases are not enforced",
                kind))
    })format!("where clauses on {kind}type aliases are not enforced")
413        } else {
414            ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("bounds on generic parameters in {0}type aliases are not enforced",
                kind))
    })format!("bounds on generic parameters in {kind}type aliases are not enforced")
415        };
416
417        let mut diag = Diag::new(dcx, level, msg).with_span_label(
418            self.label,
419            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("will not be checked at usage sites of the type alias"))msg!("will not be checked at usage sites of the type alias"),
420        );
421
422        if !is_marked {
423            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is a known limitation of the type checker that may be lifted in a future edition.\n                see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information"))msg!(
424                "this is a known limitation of the type checker that may be lifted in a future edition.
425                see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information"
426            ));
427            if self.tcx.sess.is_nightly_build() {
428                diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics"))msg!("add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics"));
429            }
430        }
431
432        let mut collector = ShorthandAssocTyCollector { qselves: Vec::new() };
433        if let Some(ty) = self.ty {
434            collector.visit_ty_unambig(ty);
435        }
436
437        let affect_object_lifetime_defaults = self
438            .preds
439            .iter()
440            .filter(|pred| pred.kind.in_where_clause() == self.in_where_clause)
441            .any(|pred| TypeAliasBounds::affects_object_lifetime_defaults(pred));
442
443        // If there are any shorthand assoc tys, then the bounds can't be removed automatically.
444        // The user first needs to fully qualify the assoc tys.
445        let applicability = if !collector.qselves.is_empty() || affect_object_lifetime_defaults {
446            Applicability::MaybeIncorrect
447        } else {
448            Applicability::MachineApplicable
449        };
450
451        diag.arg("count", self.suggestions.len());
452        diag.multipart_suggestion(
453            if self.in_where_clause {
454                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this where clause"))msg!("remove this where clause")
455            } else {
456                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove {$count ->\n                        [one] this bound\n                        *[other] these bounds\n                    }"))msg!(
457                    "remove {$count ->
458                        [one] this bound
459                        *[other] these bounds
460                    }"
461                )
462            },
463            self.suggestions,
464            applicability,
465        );
466
467        // Suggest fully qualifying paths of the form `T::Assoc` with `T` type param via
468        // `<T as /* Trait */>::Assoc` to remove their reliance on any type param bounds.
469        //
470        // Instead of attempting to figure out the necessary trait ref, just use a
471        // placeholder. Since we don't record type-dependent resolutions for non-body
472        // items like type aliases, we can't simply deduce the corresp. trait from
473        // the HIR path alone without rerunning parts of HIR ty lowering here
474        // (namely `probe_single_ty_param_bound_for_assoc_ty`) which is infeasible.
475        //
476        // (We could employ some simple heuristics but that's likely not worth it).
477        for qself in collector.qselves {
478            diag.multipart_suggestion(
479                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fully qualify this associated type"))msg!("fully qualify this associated type"),
480                ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [(qself.shrink_to_lo(), "<".into()),
                (qself.shrink_to_hi(), " as /* Trait */>".into())]))vec![
481                    (qself.shrink_to_lo(), "<".into()),
482                    (qself.shrink_to_hi(), " as /* Trait */>".into()),
483                ],
484                Applicability::HasPlaceholders,
485            );
486        }
487        diag
488    }
489}
490
491#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinTrivialBounds<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinTrivialBounds {
                        clause_kind_name: __binding_0, clause: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$clause_kind_name} bound {$clause} does not depend on any type or lifetime parameters")));
                        ;
                        diag.arg("clause_kind_name", __binding_0);
                        diag.arg("clause", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
492#[diag("{$clause_kind_name} bound {$clause} does not depend on any type or lifetime parameters")]
493pub(crate) struct BuiltinTrivialBounds<'a> {
494    pub clause_kind_name: &'a str,
495    pub clause: Clause<'a>,
496}
497
498#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinDoubleNegations {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinDoubleNegations { add_parens: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of a double negation")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the prefix `--` could be misinterpreted as a decrement operator which exists in other languages")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `-= 1` if you meant to decrement the value")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
499#[diag("use of a double negation")]
500#[note(
501    "the prefix `--` could be misinterpreted as a decrement operator which exists in other languages"
502)]
503#[note("use `-= 1` if you meant to decrement the value")]
504pub(crate) struct BuiltinDoubleNegations {
505    #[subdiagnostic]
506    pub add_parens: BuiltinDoubleNegationsAddParens,
507}
508
509#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BuiltinDoubleNegationsAddParens {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    BuiltinDoubleNegationsAddParens {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_16 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_17 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_16));
                        suggestions.push((__binding_1, __code_17));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses for clarity")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
510#[multipart_suggestion("add parentheses for clarity", applicability = "maybe-incorrect")]
511pub(crate) struct BuiltinDoubleNegationsAddParens {
512    #[suggestion_part(code = "(")]
513    pub start_span: Span,
514    #[suggestion_part(code = ")")]
515    pub end_span: Span,
516}
517
518#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinEllipsisInclusiveRangePatternsLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinEllipsisInclusiveRangePatternsLint::Parenthesise {
                        suggestion: __binding_0, replace: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` range patterns are deprecated")));
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `..=` for an inclusive range")),
                            __code_18, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                    BuiltinEllipsisInclusiveRangePatternsLint::NonParenthesise {
                        suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` range patterns are deprecated")));
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("..="))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `..=` for an inclusive range")),
                            __code_19, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
519pub(crate) enum BuiltinEllipsisInclusiveRangePatternsLint {
520    #[diag("`...` range patterns are deprecated")]
521    Parenthesise {
522        #[suggestion(
523            "use `..=` for an inclusive range",
524            code = "{replace}",
525            applicability = "machine-applicable"
526        )]
527        suggestion: Span,
528        replace: String,
529    },
530    #[diag("`...` range patterns are deprecated")]
531    NonParenthesise {
532        #[suggestion(
533            "use `..=` for an inclusive range",
534            style = "short",
535            code = "..=",
536            applicability = "machine-applicable"
537        )]
538        suggestion: Span,
539    },
540}
541
542#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BuiltinKeywordIdents
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinKeywordIdents {
                        kw: __binding_0,
                        next: __binding_1,
                        suggestion: __binding_2,
                        prefix: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$kw}` is a keyword in the {$next} edition")));
                        let __code_20 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}r#{0}", __binding_0,
                                                        __binding_3))
                                            })].into_iter();
                        ;
                        diag.arg("kw", __binding_0);
                        diag.arg("next", __binding_1);
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can use a raw identifier to stay compatible")),
                            __code_20, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
543#[diag("`{$kw}` is a keyword in the {$next} edition")]
544pub(crate) struct BuiltinKeywordIdents {
545    pub kw: Ident,
546    pub next: Edition,
547    #[suggestion(
548        "you can use a raw identifier to stay compatible",
549        code = "{prefix}r#{kw}",
550        applicability = "machine-applicable"
551    )]
552    pub suggestion: Span,
553    pub prefix: &'static str,
554}
555
556#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinExplicitOutlives {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinExplicitOutlives { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("outlives requirements can be inferred")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
557#[diag("outlives requirements can be inferred")]
558pub(crate) struct BuiltinExplicitOutlives {
559    #[subdiagnostic]
560    pub suggestion: BuiltinExplicitOutlivesSuggestion,
561}
562
563#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BuiltinExplicitOutlivesSuggestion
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    BuiltinExplicitOutlivesSuggestion {
                        spans: __binding_0,
                        applicability: __binding_1,
                        count: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_21 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        for __binding_0 in __binding_0 {
                            suggestions.push((__binding_0, __code_21.clone()));
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("count".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove {$count ->\n        [one] this bound\n        *[other] these bounds\n    }")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            __binding_1, rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
564#[multipart_suggestion(
565    "remove {$count ->
566        [one] this bound
567        *[other] these bounds
568    }"
569)]
570pub(crate) struct BuiltinExplicitOutlivesSuggestion {
571    #[suggestion_part(code = "")]
572    pub spans: Vec<Span>,
573    #[applicability]
574    pub applicability: Applicability,
575    pub count: usize,
576}
577
578#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinIncompleteFeatures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinIncompleteFeatures {
                        name: __binding_0, note: __binding_1, help: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$name}` is incomplete and may not be safe to use and/or cause compiler crashes")));
                        ;
                        diag.arg("name", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
579#[diag(
580    "the feature `{$name}` is incomplete and may not be safe to use and/or cause compiler crashes"
581)]
582pub(crate) struct BuiltinIncompleteFeatures {
583    pub name: Symbol,
584    #[subdiagnostic]
585    pub note: Option<BuiltinFeatureIssueNote>,
586    #[subdiagnostic]
587    pub help: Option<BuiltinIncompleteFeaturesHelp>,
588}
589
590#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinInternalFeatures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinInternalFeatures { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$name}` is internal to the compiler or standard library")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using it is strongly discouraged")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
591#[diag("the feature `{$name}` is internal to the compiler or standard library")]
592#[note("using it is strongly discouraged")]
593pub(crate) struct BuiltinInternalFeatures {
594    pub name: Symbol,
595}
596
597#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BuiltinIncompleteFeaturesHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    BuiltinIncompleteFeaturesHelp { name: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `min_{$name}` instead, which is more stable and complete")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
598#[help("consider using `min_{$name}` instead, which is more stable and complete")]
599pub(crate) struct BuiltinIncompleteFeaturesHelp {
600    pub name: Symbol,
601}
602
603#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BuiltinFeatureIssueNote {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    BuiltinFeatureIssueNote { n: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("n".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("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
604#[note("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")]
605pub(crate) struct BuiltinFeatureIssueNote {
606    pub n: NonZero<u32>,
607}
608
609pub(crate) struct BuiltinUnpermittedTypeInit<'a> {
610    pub msg: DiagMessage,
611    pub ty: Ty<'a>,
612    pub label: Span,
613    pub sub: BuiltinUnpermittedTypeInitSub,
614    pub tcx: TyCtxt<'a>,
615}
616
617impl<'a> Diagnostic<'a> for BuiltinUnpermittedTypeInit<'_> {
618    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
619        let mut diag = Diag::new(dcx, level, self.msg)
620            .with_arg("ty", self.ty)
621            .with_span_label(self.label, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this code causes undefined behavior when executed"))msg!("this code causes undefined behavior when executed"));
622        if let InhabitedPredicate::True = self.ty.inhabited_predicate(self.tcx) {
623            // Only suggest late `MaybeUninit::assume_init` initialization if the type is inhabited.
624            diag.span_label(
625                self.label,
626                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done"))msg!("help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done"),
627            );
628        }
629        self.sub.add_to_diag(&mut diag);
630        diag
631    }
632}
633
634// FIXME(davidtwco): make translatable
635pub(crate) struct BuiltinUnpermittedTypeInitSub {
636    pub err: InitError,
637}
638
639impl Subdiagnostic for BuiltinUnpermittedTypeInitSub {
640    fn add_to_diag(self, diag: &mut Diag<'_>) {
641        let mut err = self.err;
642        loop {
643            if let Some(span) = err.span {
644                diag.span_note(span, err.message);
645            } else {
646                diag.note(err.message);
647            }
648            if let Some(e) = err.nested {
649                err = *e;
650            } else {
651                break;
652            }
653        }
654    }
655}
656
657#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BuiltinClashingExtern<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinClashingExtern::SameName {
                        this: __binding_0,
                        orig: __binding_1,
                        previous_decl_label: __binding_2,
                        mismatch_label: __binding_3,
                        sub: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$this}` redeclared with a different signature")));
                        ;
                        diag.arg("this", __binding_0);
                        diag.arg("orig", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$orig}` previously declared here")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this signature doesn't match the previous declaration")));
                        diag.subdiagnostic(__binding_4);
                        diag
                    }
                    BuiltinClashingExtern::DiffName {
                        this: __binding_0,
                        orig: __binding_1,
                        previous_decl_label: __binding_2,
                        mismatch_label: __binding_3,
                        sub: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$this}` redeclares `{$orig}` with a different signature")));
                        ;
                        diag.arg("this", __binding_0);
                        diag.arg("orig", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$orig}` previously declared here")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this signature doesn't match the previous declaration")));
                        diag.subdiagnostic(__binding_4);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
658pub(crate) enum BuiltinClashingExtern<'a> {
659    #[diag("`{$this}` redeclared with a different signature")]
660    SameName {
661        this: Symbol,
662        orig: Symbol,
663        #[label("`{$orig}` previously declared here")]
664        previous_decl_label: Span,
665        #[label("this signature doesn't match the previous declaration")]
666        mismatch_label: Span,
667        #[subdiagnostic]
668        sub: BuiltinClashingExternSub<'a>,
669    },
670    #[diag("`{$this}` redeclares `{$orig}` with a different signature")]
671    DiffName {
672        this: Symbol,
673        orig: Symbol,
674        #[label("`{$orig}` previously declared here")]
675        previous_decl_label: Span,
676        #[label("this signature doesn't match the previous declaration")]
677        mismatch_label: Span,
678        #[subdiagnostic]
679        sub: BuiltinClashingExternSub<'a>,
680    },
681}
682
683// FIXME(davidtwco): translatable expected/found
684pub(crate) struct BuiltinClashingExternSub<'a> {
685    pub tcx: TyCtxt<'a>,
686    pub expected: Ty<'a>,
687    pub found: Ty<'a>,
688}
689
690impl Subdiagnostic for BuiltinClashingExternSub<'_> {
691    fn add_to_diag(self, diag: &mut Diag<'_>) {
692        let mut expected_str = DiagStyledString::new();
693        expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
694        let mut found_str = DiagStyledString::new();
695        found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
696        diag.note_expected_found("", expected_str, "", found_str);
697    }
698}
699
700#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BuiltinDerefNullptr
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinDerefNullptr { label: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereferencing a null pointer")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this code causes undefined behavior when executed")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
701#[diag("dereferencing a null pointer")]
702pub(crate) struct BuiltinDerefNullptr {
703    #[label("this code causes undefined behavior when executed")]
704    pub label: Span,
705}
706
707#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            BuiltinSpecialModuleNameUsed {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BuiltinSpecialModuleNameUsed::Lib => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found module declaration for lib.rs")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lib.rs is the root of this crate's library target")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to refer to it from other targets, use the library's name as the path")));
                        ;
                        diag
                    }
                    BuiltinSpecialModuleNameUsed::Main => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found module declaration for main.rs")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a binary crate cannot be used as library")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
708pub(crate) enum BuiltinSpecialModuleNameUsed {
709    #[diag("found module declaration for lib.rs")]
710    #[note("lib.rs is the root of this crate's library target")]
711    #[help("to refer to it from other targets, use the library's name as the path")]
712    Lib,
713    #[diag("found module declaration for main.rs")]
714    #[note("a binary crate cannot be used as library")]
715    Main,
716}
717
718// c_void_return.rs
719#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVoidReturn {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVoidReturn { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`c_void` should not be used as a return type")));
                        let __code_22 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returning `()` in Rust is equivalent to returning `void` in C")));
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the return type to implicitly return `()`")),
                            __code_22, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
720#[diag("`c_void` should not be used as a return type")]
721#[help("returning `()` in Rust is equivalent to returning `void` in C")]
722pub(crate) struct CVoidReturn {
723    #[suggestion(
724        "remove the return type to implicitly return `()`",
725        code = "",
726        applicability = "maybe-incorrect"
727    )]
728    pub suggestion: Span,
729}
730
731// c_void_return.rs
732#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExternCVoidReturn {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExternCVoidReturn { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declarations returning `c_void` are not compatible with C functions returning `void`")));
                        let __code_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returning `()` in Rust is equivalent to returning `void` in C")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`c_void` is only used through raw pointers for compatibility with `void` pointers")));
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the return type to implicitly return `()`")),
                            __code_23, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
733#[diag("declarations returning `c_void` are not compatible with C functions returning `void`")]
734#[help("returning `()` in Rust is equivalent to returning `void` in C")]
735#[note("`c_void` is only used through raw pointers for compatibility with `void` pointers")]
736pub(crate) struct ExternCVoidReturn {
737    #[suggestion(
738        "remove the return type to implicitly return `()`",
739        code = "",
740        applicability = "maybe-incorrect"
741    )]
742    pub suggestion: Span,
743}
744
745// deref_into_dyn_supertrait.rs
746#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            SupertraitAsDerefTarget<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SupertraitAsDerefTarget {
                        self_ty: __binding_0,
                        supertrait_principal: __binding_1,
                        target_principal: __binding_2,
                        label: __binding_3,
                        label2: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `Deref` implementation is covered by an implicit supertrait coercion")));
                        ;
                        diag.arg("self_ty", __binding_0);
                        diag.arg("supertrait_principal", __binding_1);
                        diag.arg("target_principal", __binding_2);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$self_ty}` implements `Deref<Target = dyn {$target_principal}>` which conflicts with supertrait `{$supertrait_principal}`")));
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
747#[diag("this `Deref` implementation is covered by an implicit supertrait coercion")]
748pub(crate) struct SupertraitAsDerefTarget<'a> {
749    pub self_ty: Ty<'a>,
750    pub supertrait_principal: PolyExistentialTraitRef<'a>,
751    pub target_principal: PolyExistentialTraitRef<'a>,
752    #[label(
753        "`{$self_ty}` implements `Deref<Target = dyn {$target_principal}>` which conflicts with supertrait `{$supertrait_principal}`"
754    )]
755    pub label: Span,
756    #[subdiagnostic]
757    pub label2: Option<SupertraitAsDerefTargetLabel<'a>>,
758}
759
760#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            SupertraitAsDerefTargetLabel<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    SupertraitAsDerefTargetLabel {
                        label: __binding_0, self_ty: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("self_ty".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("target type is a supertrait of `{$self_ty}`")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
761#[label("target type is a supertrait of `{$self_ty}`")]
762pub(crate) struct SupertraitAsDerefTargetLabel<'a> {
763    #[primary_span]
764    pub label: Span,
765    pub self_ty: Ty<'a>,
766}
767
768// enum_intrinsics_non_enums.rs
769#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            EnumIntrinsicsMemDiscriminate<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EnumIntrinsicsMemDiscriminate {
                        ty_param: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the return value of `mem::discriminant` is unspecified when called with a non-enum type")));
                        ;
                        diag.arg("ty_param", __binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
770#[diag("the return value of `mem::discriminant` is unspecified when called with a non-enum type")]
771pub(crate) struct EnumIntrinsicsMemDiscriminate<'a> {
772    pub ty_param: Ty<'a>,
773    #[note(
774        "the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum"
775    )]
776    pub note: Span,
777}
778
779#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            EnumIntrinsicsMemVariant<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EnumIntrinsicsMemVariant { ty_param: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the return value of `mem::variant_count` is unspecified when called with a non-enum type")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum")));
                        ;
                        diag.arg("ty_param", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
780#[diag("the return value of `mem::variant_count` is unspecified when called with a non-enum type")]
781#[note(
782    "the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum"
783)]
784pub(crate) struct EnumIntrinsicsMemVariant<'a> {
785    pub ty_param: Ty<'a>,
786}
787
788// expect.rs
789#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for Expectation {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    Expectation { rationale: __binding_0, note: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this lint expectation is unfulfilled")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        if __binding_1 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
790#[diag("this lint expectation is unfulfilled")]
791pub(crate) struct Expectation {
792    #[subdiagnostic]
793    pub rationale: Option<ExpectationNote>,
794    #[note(
795        "the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message"
796    )]
797    pub note: bool,
798}
799
800#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectationNote {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ExpectationNote { rationale: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("rationale".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("{$rationale}")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
801#[note("{$rationale}")]
802pub(crate) struct ExpectationNote {
803    pub rationale: Symbol,
804}
805
806// ptr_nulls.rs
807#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UselessPtrNullChecksDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UselessPtrNullChecksDiag::FnPtr {
                        orig_ty: __binding_0, label: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointers are not nullable, so checking them for null will always return false")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value")));
                        ;
                        diag.arg("orig_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expression has type `{$orig_ty}`")));
                        diag
                    }
                    UselessPtrNullChecksDiag::Ref {
                        orig_ty: __binding_0, label: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references are not nullable, so checking them for null will always return false")));
                        ;
                        diag.arg("orig_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expression has type `{$orig_ty}`")));
                        diag
                    }
                    UselessPtrNullChecksDiag::FnRet { fn_name: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returned pointer of `{$fn_name}` call is never null, so checking it for null will always return false")));
                        ;
                        diag.arg("fn_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
808pub(crate) enum UselessPtrNullChecksDiag<'a> {
809    #[diag(
810        "function pointers are not nullable, so checking them for null will always return false"
811    )]
812    #[help(
813        "wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value"
814    )]
815    FnPtr {
816        orig_ty: Ty<'a>,
817        #[label("expression has type `{$orig_ty}`")]
818        label: Span,
819    },
820    #[diag("references are not nullable, so checking them for null will always return false")]
821    Ref {
822        orig_ty: Ty<'a>,
823        #[label("expression has type `{$orig_ty}`")]
824        label: Span,
825    },
826    #[diag(
827        "returned pointer of `{$fn_name}` call is never null, so checking it for null will always return false"
828    )]
829    FnRet { fn_name: Ident },
830}
831
832#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidNullArgumentsDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidNullArgumentsDiag::NullPtrInline {
                        null_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calling this function with a null pointer is undefined behavior, even if the result of the function is unused")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("null pointer originates from here")));
                        diag
                    }
                    InvalidNullArgumentsDiag::NullPtrThroughBinding {
                        null_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calling this function with a null pointer is undefined behavior, even if the result of the function is unused")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>")));
                        ;
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("null pointer originates from here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
833pub(crate) enum InvalidNullArgumentsDiag {
834    #[diag(
835        "calling this function with a null pointer is undefined behavior, even if the result of the function is unused"
836    )]
837    #[help(
838        "for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>"
839    )]
840    NullPtrInline {
841        #[label("null pointer originates from here")]
842        null_span: Span,
843    },
844    #[diag(
845        "calling this function with a null pointer is undefined behavior, even if the result of the function is unused"
846    )]
847    #[help(
848        "for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>"
849    )]
850    NullPtrThroughBinding {
851        #[note("null pointer originates from here")]
852        null_span: Span,
853    },
854}
855
856// for_loops_over_fallibles.rs
857#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ForLoopsOverFalliblesDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForLoopsOverFalliblesDiag {
                        article: __binding_0,
                        ref_prefix: __binding_1,
                        ty: __binding_2,
                        sub: __binding_3,
                        question_mark: __binding_4,
                        suggestion: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for loop over {$article} `{$ref_prefix}{$ty}`. This is more readably written as an `if let` statement")));
                        ;
                        diag.arg("article", __binding_0);
                        diag.arg("ref_prefix", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.subdiagnostic(__binding_3);
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag.subdiagnostic(__binding_5);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
858#[diag(
859    "for loop over {$article} `{$ref_prefix}{$ty}`. This is more readably written as an `if let` statement"
860)]
861pub(crate) struct ForLoopsOverFalliblesDiag<'a> {
862    pub article: &'static str,
863    pub ref_prefix: &'static str,
864    pub ty: &'static str,
865    #[subdiagnostic]
866    pub sub: ForLoopsOverFalliblesLoopSub<'a>,
867    #[subdiagnostic]
868    pub question_mark: Option<ForLoopsOverFalliblesQuestionMark>,
869    #[subdiagnostic]
870    pub suggestion: ForLoopsOverFalliblesSuggestion<'a>,
871}
872
873#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            ForLoopsOverFalliblesLoopSub<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ForLoopsOverFalliblesLoopSub::RemoveNext {
                        suggestion: __binding_0, recv_snip: __binding_1 } => {
                        let __code_24 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".by_ref()"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("recv_snip".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("to iterate over `{$recv_snip}` remove the call to `next`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_24, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    ForLoopsOverFalliblesLoopSub::UseWhileLet {
                        start_span: __binding_0,
                        end_span: __binding_1,
                        var: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_25 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("while let {0}(",
                                            __binding_2))
                                });
                        let __code_26 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(") = "))
                                });
                        suggestions.push((__binding_0, __code_25));
                        suggestions.push((__binding_1, __code_26));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to check pattern in a loop use `while let`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
874pub(crate) enum ForLoopsOverFalliblesLoopSub<'a> {
875    #[suggestion(
876        "to iterate over `{$recv_snip}` remove the call to `next`",
877        code = ".by_ref()",
878        applicability = "maybe-incorrect"
879    )]
880    RemoveNext {
881        #[primary_span]
882        suggestion: Span,
883        recv_snip: String,
884    },
885    #[multipart_suggestion(
886        "to check pattern in a loop use `while let`",
887        applicability = "maybe-incorrect"
888    )]
889    UseWhileLet {
890        #[suggestion_part(code = "while let {var}(")]
891        start_span: Span,
892        #[suggestion_part(code = ") = ")]
893        end_span: Span,
894        var: &'a str,
895    },
896}
897
898#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ForLoopsOverFalliblesQuestionMark
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ForLoopsOverFalliblesQuestionMark { suggestion: __binding_0
                        } => {
                        let __code_27 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("?"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider unwrapping the `Result` with `?` to iterate over its contents")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_27, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
899#[suggestion(
900    "consider unwrapping the `Result` with `?` to iterate over its contents",
901    code = "?",
902    applicability = "maybe-incorrect"
903)]
904pub(crate) struct ForLoopsOverFalliblesQuestionMark {
905    #[primary_span]
906    pub suggestion: Span,
907}
908
909#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            ForLoopsOverFalliblesSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ForLoopsOverFalliblesSuggestion {
                        var: __binding_0,
                        start_span: __binding_1,
                        end_span: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_28 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("if let {0}(",
                                            __binding_0))
                                });
                        let __code_29 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(") = "))
                                });
                        suggestions.push((__binding_1, __code_28));
                        suggestions.push((__binding_2, __code_29));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `if let` to clear intent")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
910#[multipart_suggestion(
911    "consider using `if let` to clear intent",
912    applicability = "maybe-incorrect"
913)]
914pub(crate) struct ForLoopsOverFalliblesSuggestion<'a> {
915    pub var: &'a str,
916    #[suggestion_part(code = "if let {var}(")]
917    pub start_span: Span,
918    #[suggestion_part(code = ") = ")]
919    pub end_span: Span,
920}
921
922#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UseLetUnderscoreIgnoreSuggestion
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UseLetUnderscoreIgnoreSuggestion::Note => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the expression or result")),
                                &sub_args);
                        diag.note(__message);
                    }
                    UseLetUnderscoreIgnoreSuggestion::Suggestion {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_30 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_31 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_30));
                        suggestions.push((__binding_1, __code_31));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the expression or result")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
923pub(crate) enum UseLetUnderscoreIgnoreSuggestion {
924    #[note("use `let _ = ...` to ignore the expression or result")]
925    Note,
926    #[multipart_suggestion(
927        "use `let _ = ...` to ignore the expression or result",
928        style = "verbose",
929        applicability = "maybe-incorrect"
930    )]
931    Suggestion {
932        #[suggestion_part(code = "let _ = ")]
933        start_span: Span,
934        #[suggestion_part(code = "")]
935        end_span: Span,
936    },
937}
938
939// runtime_symbols.rs
940#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            RedefiningRuntimeSymbolsDiag<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RedefiningRuntimeSymbolsDiag::Invalid {
                        symbol_name: __binding_0,
                        expected_fn_sig: __binding_1,
                        found_fn_sig: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid definition of the runtime `{$symbol_name}` symbol used by the standard library")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `{$expected_fn_sig}` (for the current target)\n{\"   \"}found `{$found_fn_sig}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = \"{$symbol_name}\")]`, or `#[link_name = \"{$symbol_name}\"]`")));
                        ;
                        diag.arg("symbol_name", __binding_0);
                        diag.arg("expected_fn_sig", __binding_1);
                        diag.arg("found_fn_sig", __binding_2);
                        diag
                    }
                    RedefiningRuntimeSymbolsDiag::Suspicious {
                        symbol_name: __binding_0,
                        expected_fn_sig: __binding_1,
                        found_fn_sig: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suspicious definition of the runtime `{$symbol_name}` symbol used by the standard library")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `{$expected_fn_sig}` (for the current target)\n{\"   \"}found `{$found_fn_sig}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = \"{$symbol_name}\")]`, or `#[link_name = \"{$symbol_name}\"]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("allow this lint if the signature is compatible")));
                        ;
                        diag.arg("symbol_name", __binding_0);
                        diag.arg("expected_fn_sig", __binding_1);
                        diag.arg("found_fn_sig", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
941pub(crate) enum RedefiningRuntimeSymbolsDiag<'tcx> {
942    #[diag(
943        "invalid definition of the runtime `{$symbol_name}` symbol used by the standard library"
944    )]
945    #[note(
946        "expected `{$expected_fn_sig}` (for the current target)\n{\"   \"}found `{$found_fn_sig}`"
947    )]
948    #[help(
949        "either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = \"{$symbol_name}\")]`, or `#[link_name = \"{$symbol_name}\"]`"
950    )]
951    Invalid { symbol_name: String, expected_fn_sig: Ty<'tcx>, found_fn_sig: Ty<'tcx> },
952    #[diag(
953        "suspicious definition of the runtime `{$symbol_name}` symbol used by the standard library"
954    )]
955    #[note(
956        "expected `{$expected_fn_sig}` (for the current target)\n{\"   \"}found `{$found_fn_sig}`"
957    )]
958    #[help(
959        "either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = \"{$symbol_name}\")]`, or `#[link_name = \"{$symbol_name}\"]`"
960    )]
961    #[help("allow this lint if the signature is compatible")]
962    Suspicious { symbol_name: String, expected_fn_sig: Ty<'tcx>, found_fn_sig: Ty<'tcx> },
963}
964
965// drop_forget_useless.rs
966#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for DropRefDiag<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DropRefDiag {
                        arg_ty: __binding_0, label: __binding_1, sugg: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `std::mem::drop` with a reference instead of an owned value does nothing")));
                        ;
                        diag.arg("arg_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
967#[diag("calls to `std::mem::drop` with a reference instead of an owned value does nothing")]
968pub(crate) struct DropRefDiag<'a> {
969    pub arg_ty: Ty<'a>,
970    #[label("argument has type `{$arg_ty}`")]
971    pub label: Span,
972    #[subdiagnostic]
973    pub sugg: UseLetUnderscoreIgnoreSuggestion,
974}
975
976#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for DropCopyDiag<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DropCopyDiag {
                        arg_ty: __binding_0, label: __binding_1, sugg: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `std::mem::drop` with a value that implements `Copy` does nothing")));
                        ;
                        diag.arg("arg_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
977#[diag("calls to `std::mem::drop` with a value that implements `Copy` does nothing")]
978pub(crate) struct DropCopyDiag<'a> {
979    pub arg_ty: Ty<'a>,
980    #[label("argument has type `{$arg_ty}`")]
981    pub label: Span,
982    #[subdiagnostic]
983    pub sugg: UseLetUnderscoreIgnoreSuggestion,
984}
985
986#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DropInPlaceRefDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DropInPlaceRefDiag {
                        from_fn: __binding_0,
                        arg_ty: __binding_1,
                        label: __binding_2,
                        sugg: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to {$from_fn ->\n        [true] `std::ptr::drop_in_place`\n        *[false] `drop_in_place`\n    } with a pointer to a reference instead of a pointer to an owned value does nothing")));
                        ;
                        diag.arg("from_fn", __binding_0);
                        diag.arg("arg_ty", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
987#[diag(
988    "calls to {$from_fn ->
989        [true] `std::ptr::drop_in_place`
990        *[false] `drop_in_place`
991    } with a pointer to a reference instead of a pointer to an owned value does nothing"
992)]
993pub(crate) struct DropInPlaceRefDiag<'a> {
994    pub from_fn: bool,
995    pub arg_ty: Ty<'a>,
996    #[label("argument has type `{$arg_ty}`")]
997    pub label: Span,
998    #[subdiagnostic]
999    pub sugg: UseLetUnderscoreIgnoreSuggestion,
1000}
1001
1002#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DropInPlaceCopyDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DropInPlaceCopyDiag {
                        from_fn: __binding_0,
                        arg_ty: __binding_1,
                        label: __binding_2,
                        sugg: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to {$from_fn ->\n        [true] `std::ptr::drop_in_place`\n        *[false] `drop_in_place`\n    } with a pointer to a value that implements `Copy` does nothing")));
                        ;
                        diag.arg("from_fn", __binding_0);
                        diag.arg("arg_ty", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1003#[diag(
1004    "calls to {$from_fn ->
1005        [true] `std::ptr::drop_in_place`
1006        *[false] `drop_in_place`
1007    } with a pointer to a value that implements `Copy` does nothing"
1008)]
1009pub(crate) struct DropInPlaceCopyDiag<'a> {
1010    pub from_fn: bool,
1011    pub arg_ty: Ty<'a>,
1012    #[label("argument has type `{$arg_ty}`")]
1013    pub label: Span,
1014    #[subdiagnostic]
1015    pub sugg: UseLetUnderscoreIgnoreSuggestion,
1016}
1017
1018#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ForgetRefDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForgetRefDiag {
                        arg_ty: __binding_0, label: __binding_1, sugg: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `std::mem::forget` with a reference instead of an owned value does nothing")));
                        ;
                        diag.arg("arg_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1019#[diag("calls to `std::mem::forget` with a reference instead of an owned value does nothing")]
1020pub(crate) struct ForgetRefDiag<'a> {
1021    pub arg_ty: Ty<'a>,
1022    #[label("argument has type `{$arg_ty}`")]
1023    pub label: Span,
1024    #[subdiagnostic]
1025    pub sugg: UseLetUnderscoreIgnoreSuggestion,
1026}
1027
1028#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ForgetCopyDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForgetCopyDiag {
                        arg_ty: __binding_0, label: __binding_1, sugg: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `std::mem::forget` with a value that implements `Copy` does nothing")));
                        ;
                        diag.arg("arg_ty", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1029#[diag("calls to `std::mem::forget` with a value that implements `Copy` does nothing")]
1030pub(crate) struct ForgetCopyDiag<'a> {
1031    pub arg_ty: Ty<'a>,
1032    #[label("argument has type `{$arg_ty}`")]
1033    pub label: Span,
1034    #[subdiagnostic]
1035    pub sugg: UseLetUnderscoreIgnoreSuggestion,
1036}
1037
1038#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UndroppedManuallyDropsDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UndroppedManuallyDropsDiag {
                        krate: __binding_0,
                        arg_ty: __binding_1,
                        label: __binding_2,
                        suggestion: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `{$krate}::mem::drop` with `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing")));
                        ;
                        diag.arg("krate", __binding_0);
                        diag.arg("arg_ty", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1039#[diag(
1040    "calls to `{$krate}::mem::drop` with `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing"
1041)]
1042pub(crate) struct UndroppedManuallyDropsDiag<'a> {
1043    pub krate: &'static str,
1044    pub arg_ty: Ty<'a>,
1045    #[label("argument has type `{$arg_ty}`")]
1046    pub label: Span,
1047    #[subdiagnostic]
1048    pub suggestion: UndroppedManuallyDropsSuggestion,
1049}
1050
1051#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UndroppedManuallyDropsSuggestion
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UndroppedManuallyDropsSuggestion {
                        krate: __binding_0,
                        start_span: __binding_1,
                        end_span: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_32 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}::mem::ManuallyDrop::into_inner(",
                                            __binding_0))
                                });
                        let __code_33 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_1, __code_32));
                        suggestions.push((__binding_2, __code_33));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::mem::ManuallyDrop::into_inner` to get the inner value")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1052#[multipart_suggestion(
1053    "use `{$krate}::mem::ManuallyDrop::into_inner` to get the inner value",
1054    applicability = "machine-applicable"
1055)]
1056pub(crate) struct UndroppedManuallyDropsSuggestion {
1057    pub krate: &'static str,
1058    #[suggestion_part(code = "{krate}::mem::ManuallyDrop::into_inner(")]
1059    pub start_span: Span,
1060    #[suggestion_part(code = ")")]
1061    pub end_span: Span,
1062}
1063
1064#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UndroppedManuallyDropsInPlaceDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UndroppedManuallyDropsInPlaceDiag {
                        krate: __binding_0,
                        arg_ty: __binding_1,
                        label: __binding_2,
                        suggestion: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `drop_in_place` with a pointer to a `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing")));
                        ;
                        diag.arg("krate", __binding_0);
                        diag.arg("arg_ty", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument has type `{$arg_ty}`")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1065#[diag(
1066    "calls to `drop_in_place` with a pointer to a `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing"
1067)]
1068pub(crate) struct UndroppedManuallyDropsInPlaceDiag<'a> {
1069    pub krate: &'static str,
1070    pub arg_ty: Ty<'a>,
1071    #[label("argument has type `{$arg_ty}`")]
1072    pub label: Span,
1073    #[subdiagnostic]
1074    pub suggestion: UndroppedManuallyDropsInPlaceSuggestion,
1075}
1076
1077#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UndroppedManuallyDropsInPlaceSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UndroppedManuallyDropsInPlaceSuggestion {
                        krate: __binding_0,
                        start_span: __binding_1,
                        end_span: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_34 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}::mem::ManuallyDrop::drop(&mut *",
                                            __binding_0))
                                });
                        let __code_35 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_1, __code_34));
                        suggestions.push((__binding_2, __code_35));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::mem::ManuallyDrop::drop` to drop the inner value")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1078#[multipart_suggestion(
1079    "use `{$krate}::mem::ManuallyDrop::drop` to drop the inner value",
1080    applicability = "maybe-incorrect"
1081)]
1082pub(crate) struct UndroppedManuallyDropsInPlaceSuggestion {
1083    pub krate: &'static str,
1084    #[suggestion_part(code = "{krate}::mem::ManuallyDrop::drop(&mut *")]
1085    pub start_span: Span,
1086    #[suggestion_part(code = ")")]
1087    pub end_span: Span,
1088}
1089
1090// invalid_from_utf8.rs
1091#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidFromUtf8Diag
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidFromUtf8Diag::Unchecked {
                        method: __binding_0,
                        valid_up_to: __binding_1,
                        label: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `{$method}` with an invalid literal are undefined behavior")));
                        ;
                        diag.arg("method", __binding_0);
                        diag.arg("valid_up_to", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal was valid UTF-8 up to the {$valid_up_to} bytes")));
                        diag
                    }
                    InvalidFromUtf8Diag::Checked {
                        method: __binding_0,
                        valid_up_to: __binding_1,
                        label: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calls to `{$method}` with an invalid literal always return an error")));
                        ;
                        diag.arg("method", __binding_0);
                        diag.arg("valid_up_to", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal was valid UTF-8 up to the {$valid_up_to} bytes")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1092pub(crate) enum InvalidFromUtf8Diag {
1093    #[diag("calls to `{$method}` with an invalid literal are undefined behavior")]
1094    Unchecked {
1095        method: String,
1096        valid_up_to: usize,
1097        #[label("the literal was valid UTF-8 up to the {$valid_up_to} bytes")]
1098        label: Span,
1099    },
1100    #[diag("calls to `{$method}` with an invalid literal always return an error")]
1101    Checked {
1102        method: String,
1103        valid_up_to: usize,
1104        #[label("the literal was valid UTF-8 up to the {$valid_up_to} bytes")]
1105        label: Span,
1106    },
1107}
1108
1109// interior_mutable_consts.rs
1110#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            ConstItemInteriorMutationsDiag<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstItemInteriorMutationsDiag {
                        method_name: __binding_0,
                        const_name: __binding_1,
                        const_ty: __binding_2,
                        receiver_span: __binding_3,
                        sugg_static: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of an interior mutable `const` item with call to `{$method_name}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("each usage of a `const` item creates a new temporary")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only the temporaries and never the original `const {$const_name}` will be modified")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more details on interior mutability see <https://doc.rust-lang.org/reference/interior-mutability.html>")));
                        ;
                        diag.arg("method_name", __binding_0);
                        diag.arg("const_name", __binding_1);
                        diag.arg("const_ty", __binding_2);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$const_name}` is a interior mutable `const` item of type `{$const_ty}`")));
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1111#[diag("mutation of an interior mutable `const` item with call to `{$method_name}`")]
1112#[note("each usage of a `const` item creates a new temporary")]
1113#[note("only the temporaries and never the original `const {$const_name}` will be modified")]
1114#[help(
1115    "for more details on interior mutability see <https://doc.rust-lang.org/reference/interior-mutability.html>"
1116)]
1117pub(crate) struct ConstItemInteriorMutationsDiag<'tcx> {
1118    pub method_name: Ident,
1119    pub const_name: Ident,
1120    pub const_ty: Ty<'tcx>,
1121    #[label("`{$const_name}` is a interior mutable `const` item of type `{$const_ty}`")]
1122    pub receiver_span: Span,
1123    #[subdiagnostic]
1124    pub sugg_static: Option<ConstItemInteriorMutationsSuggestionStatic>,
1125}
1126
1127#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            ConstItemInteriorMutationsSuggestionStatic {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ConstItemInteriorMutationsSuggestionStatic::Spanful {
                        const_: __binding_0,
                        before: __binding_1,
                        const_name: __binding_2 } => {
                        let __code_36 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}static ",
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("const_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for a shared instance of `{$const_name}`, consider making it a `static` item instead")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_36, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    ConstItemInteriorMutationsSuggestionStatic::Spanless {
                        const_name: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("const_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("for a shared instance of `{$const_name}`, consider making it a `static` item instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1128pub(crate) enum ConstItemInteriorMutationsSuggestionStatic {
1129    #[suggestion(
1130        "for a shared instance of `{$const_name}`, consider making it a `static` item instead",
1131        code = "{before}static ",
1132        style = "verbose",
1133        applicability = "maybe-incorrect"
1134    )]
1135    Spanful {
1136        #[primary_span]
1137        const_: Span,
1138        before: &'static str,
1139        const_name: Ident,
1140    },
1141    #[help("for a shared instance of `{$const_name}`, consider making it a `static` item instead")]
1142    Spanless { const_name: Ident },
1143}
1144
1145// reference_casting.rs
1146#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            InvalidReferenceCastingDiag<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidReferenceCastingDiag::BorrowAsMut {
                        orig_cast: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting happened here")));
                        }
                        diag
                    }
                    InvalidReferenceCastingDiag::AssignToRef {
                        orig_cast: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("assigning to `&T` is undefined behavior, consider using an `UnsafeCell`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting happened here")));
                        }
                        diag
                    }
                    InvalidReferenceCastingDiag::BiggerLayout {
                        orig_cast: __binding_0,
                        alloc: __binding_1,
                        from_ty: __binding_2,
                        from_size: __binding_3,
                        to_ty: __binding_4,
                        to_size: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting from `{$from_ty}` ({$from_size} bytes) to `{$to_ty}` ({$to_size} bytes)")));
                        ;
                        diag.arg("from_ty", __binding_2);
                        diag.arg("from_size", __binding_3);
                        diag.arg("to_ty", __binding_4);
                        diag.arg("to_size", __binding_5);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("casting happened here")));
                        }
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("backing allocation comes from here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1147pub(crate) enum InvalidReferenceCastingDiag<'tcx> {
1148    #[diag(
1149        "casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`"
1150    )]
1151    #[note(
1152        "for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>"
1153    )]
1154    BorrowAsMut {
1155        #[label("casting happened here")]
1156        orig_cast: Option<Span>,
1157    },
1158    #[diag("assigning to `&T` is undefined behavior, consider using an `UnsafeCell`")]
1159    #[note(
1160        "for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>"
1161    )]
1162    AssignToRef {
1163        #[label("casting happened here")]
1164        orig_cast: Option<Span>,
1165    },
1166    #[diag(
1167        "casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused"
1168    )]
1169    #[note("casting from `{$from_ty}` ({$from_size} bytes) to `{$to_ty}` ({$to_size} bytes)")]
1170    BiggerLayout {
1171        #[label("casting happened here")]
1172        orig_cast: Option<Span>,
1173        #[label("backing allocation comes from here")]
1174        alloc: Span,
1175        from_ty: Ty<'tcx>,
1176        from_size: u64,
1177        to_ty: Ty<'tcx>,
1178        to_size: u64,
1179    },
1180}
1181
1182// map_unit_fn.rs
1183#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MappingToUnit {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MappingToUnit {
                        function_label: __binding_0,
                        argument_label: __binding_1,
                        map_label: __binding_2,
                        suggestion: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Iterator::map` call that discard the iterator's values")));
                        let __code_37 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("for_each"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function returns `()`, which is likely not what you wanted")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("called `Iterator::map` with callable that returns `()`")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items")));
                        diag.span_suggestions_with_style(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to use `Iterator::for_each`")),
                            __code_37, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1184#[diag("`Iterator::map` call that discard the iterator's values")]
1185#[note(
1186    "`Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated"
1187)]
1188pub(crate) struct MappingToUnit {
1189    #[label("this function returns `()`, which is likely not what you wanted")]
1190    pub function_label: Span,
1191    #[label("called `Iterator::map` with callable that returns `()`")]
1192    pub argument_label: Span,
1193    #[label(
1194        "after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items"
1195    )]
1196    pub map_label: Span,
1197    #[suggestion(
1198        "you might have meant to use `Iterator::for_each`",
1199        style = "verbose",
1200        code = "for_each",
1201        applicability = "maybe-incorrect"
1202    )]
1203    pub suggestion: Span,
1204}
1205
1206// internal.rs
1207#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DefaultHashTypesDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DefaultHashTypesDiag {
                        preferred: __binding_0, used: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("prefer `{$preferred}` over `{$used}`, it has better performance")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a `use rustc_data_structures::fx::{$preferred}` may be necessary")));
                        ;
                        diag.arg("preferred", __binding_0);
                        diag.arg("used", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1208#[diag("prefer `{$preferred}` over `{$used}`, it has better performance")]
1209#[note("a `use rustc_data_structures::fx::{$preferred}` may be necessary")]
1210pub(crate) struct DefaultHashTypesDiag<'a> {
1211    pub preferred: &'a str,
1212    pub used: Symbol,
1213}
1214
1215#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for QueryInstability {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    QueryInstability { query: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `{$query}` can result in unstable query results")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you believe this case to be fine, allow this lint and add a comment explaining your rationale")));
                        ;
                        diag.arg("query", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1216#[diag("using `{$query}` can result in unstable query results")]
1217#[note(
1218    "if you believe this case to be fine, allow this lint and add a comment explaining your rationale"
1219)]
1220pub(crate) struct QueryInstability {
1221    pub query: Symbol,
1222}
1223
1224#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for QueryUntracked {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    QueryUntracked { method: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$method}` accesses information that is not tracked by the query system")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you believe this case to be fine, allow this lint and add a comment explaining your rationale")));
                        ;
                        diag.arg("method", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1225#[diag("`{$method}` accesses information that is not tracked by the query system")]
1226#[note(
1227    "if you believe this case to be fine, allow this lint and add a comment explaining your rationale"
1228)]
1229pub(crate) struct QueryUntracked {
1230    pub method: Symbol,
1231}
1232
1233#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            SymbolInternStringLiteralDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SymbolInternStringLiteralDiag { fn_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `{$fn_name}` on a string literal")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding the symbol to `compiler/rustc_span/src/symbol.rs`")));
                        ;
                        diag.arg("fn_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1234#[diag("using `{$fn_name}` on a string literal")]
1235#[help("consider adding the symbol to `compiler/rustc_span/src/symbol.rs`")]
1236pub(crate) struct SymbolInternStringLiteralDiag {
1237    pub fn_name: &'static str,
1238}
1239
1240#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TykindKind {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TykindKind { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of `ty::TyKind::<kind>`")));
                        let __code_38 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("ty"))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `ty::<kind>` directly")),
                            __code_38, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1241#[diag("usage of `ty::TyKind::<kind>`")]
1242pub(crate) struct TykindKind {
1243    #[suggestion(
1244        "try using `ty::<kind>` directly",
1245        code = "ty",
1246        applicability = "maybe-incorrect"
1247    )]
1248    pub suggestion: Span,
1249}
1250
1251#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TykindDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TykindDiag => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of `ty::TyKind`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `Ty` instead")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1252#[diag("usage of `ty::TyKind`")]
1253#[help("try using `Ty` instead")]
1254pub(crate) struct TykindDiag;
1255
1256#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TyQualified {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TyQualified { ty: __binding_0, suggestion: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of qualified `ty::{$ty}`")));
                        let __code_39 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_0))
                                            })].into_iter();
                        ;
                        diag.arg("ty", __binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try importing it and using it unqualified")),
                            __code_39, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1257#[diag("usage of qualified `ty::{$ty}`")]
1258pub(crate) struct TyQualified {
1259    pub ty: String,
1260    #[suggestion(
1261        "try importing it and using it unqualified",
1262        code = "{ty}",
1263        applicability = "maybe-incorrect"
1264    )]
1265    pub suggestion: Span,
1266}
1267
1268#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TypeIrInherentUsage
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TypeIrInherentUsage => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("do not use `rustc_type_ir::inherent` unless you're inside of the trait solver")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the method or struct you're looking for is likely defined somewhere else downstream in the compiler")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1269#[diag("do not use `rustc_type_ir::inherent` unless you're inside of the trait solver")]
1270#[note(
1271    "the method or struct you're looking for is likely defined somewhere else downstream in the compiler"
1272)]
1273pub(crate) struct TypeIrInherentUsage;
1274
1275#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TypeIrTraitUsage {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TypeIrTraitUsage => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the method or struct you're looking for is likely defined somewhere else downstream in the compiler")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1276#[diag(
1277    "do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver"
1278)]
1279#[note(
1280    "the method or struct you're looking for is likely defined somewhere else downstream in the compiler"
1281)]
1282pub(crate) struct TypeIrTraitUsage;
1283
1284#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TypeIrDirectUse {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TypeIrDirectUse => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("do not use `rustc_type_ir` unless you are implementing type system internals")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `rustc_middle::ty` instead")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1285#[diag("do not use `rustc_type_ir` unless you are implementing type system internals")]
1286#[note("use `rustc_middle::ty` instead")]
1287pub(crate) struct TypeIrDirectUse;
1288
1289#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NonGlobImportTypeIrInherent {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonGlobImportTypeIrInherent {
                        suggestion: __binding_0, snippet: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-glob import of `rustc_type_ir::inherent`")));
                        let __code_40 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_suggestions_with_style(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a glob import instead")),
                                __code_40, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1290#[diag("non-glob import of `rustc_type_ir::inherent`")]
1291pub(crate) struct NonGlobImportTypeIrInherent {
1292    #[suggestion(
1293        "try using a glob import instead",
1294        code = "{snippet}",
1295        applicability = "maybe-incorrect"
1296    )]
1297    pub suggestion: Option<Span>,
1298    pub snippet: &'static str,
1299}
1300
1301#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for LintPassByHand {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    LintPassByHand => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing `LintPass` by hand")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `declare_lint_pass!` or `impl_lint_pass!` instead")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1302#[diag("implementing `LintPass` by hand")]
1303#[help("try using `declare_lint_pass!` or `impl_lint_pass!` instead")]
1304pub(crate) struct LintPassByHand;
1305
1306#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BadOptAccessDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BadOptAccessDiag { msg: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$msg}")));
                        ;
                        diag.arg("msg", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1307#[diag("{$msg}")]
1308pub(crate) struct BadOptAccessDiag<'a> {
1309    pub msg: &'a str,
1310}
1311
1312#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ImplicitSysrootCrateImportDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImplicitSysrootCrateImportDiag { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dangerous use of `extern crate {$name}` which is not guaranteed to exist exactly once in the sysroot")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a cargo dependency or using a re-export of the dependency provided by a rustc_* crate")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1313#[diag(
1314    "dangerous use of `extern crate {$name}` which is not guaranteed to exist exactly once in the sysroot"
1315)]
1316#[help(
1317    "try using a cargo dependency or using a re-export of the dependency provided by a rustc_* crate"
1318)]
1319pub(crate) struct ImplicitSysrootCrateImportDiag<'a> {
1320    pub name: &'a str,
1321}
1322
1323#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AttributeKindInFindAttr {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AttributeKindInFindAttr => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of `AttributeKind` in `find_attr!(...)` invocation")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`find_attr!(...)` already imports `AttributeKind::*`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `AttributeKind`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1324#[diag("use of `AttributeKind` in `find_attr!(...)` invocation")]
1325#[note("`find_attr!(...)` already imports `AttributeKind::*`")]
1326#[help("remove `AttributeKind`")]
1327pub(crate) struct AttributeKindInFindAttr;
1328
1329#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcMustMatchExhaustivelyNotExhaustive {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RustcMustMatchExhaustivelyNotExhaustive {
                        attr_span: __binding_0,
                        pat_span: __binding_1,
                        message: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("match is not exhaustive")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicitly list all variants of the enum in a `match`")));
                        ;
                        diag.arg("message", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("required because of this attribute")));
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$message}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1330#[diag("match is not exhaustive")]
1331#[help("explicitly list all variants of the enum in a `match`")]
1332pub(crate) struct RustcMustMatchExhaustivelyNotExhaustive {
1333    #[label("required because of this attribute")]
1334    pub attr_span: Span,
1335
1336    #[note("{$message}")]
1337    pub pat_span: Span,
1338    pub message: &'static str,
1339}
1340
1341// let_underscore.rs
1342#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonBindingLet {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonBindingLet::SyncLock { pat: __binding_0, sub: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-binding let on a synchronization lock")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this lock is not assigned to a binding and is immediately dropped")));
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                    NonBindingLet::DropGuard {
                        pat: __binding_0, sub: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-binding let on a `DropGuard`")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `DropGuard` is not assigned to a binding and is immediately dropped")));
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                    NonBindingLet::DropType { sub: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-binding let on a type that has a destructor")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1343pub(crate) enum NonBindingLet {
1344    #[diag("non-binding let on a synchronization lock")]
1345    SyncLock {
1346        #[label("this lock is not assigned to a binding and is immediately dropped")]
1347        pat: Span,
1348        #[subdiagnostic]
1349        sub: NonBindingLetSub,
1350    },
1351    #[diag("non-binding let on a `DropGuard`")]
1352    DropGuard {
1353        #[label("this `DropGuard` is not assigned to a binding and is immediately dropped")]
1354        pat: Span,
1355        #[subdiagnostic]
1356        sub: NonBindingLetSub,
1357    },
1358    #[diag("non-binding let on a type that has a destructor")]
1359    DropType {
1360        #[subdiagnostic]
1361        sub: NonBindingLetSub,
1362    },
1363}
1364
1365pub(crate) struct NonBindingLetSub {
1366    pub suggestion: Span,
1367    pub drop_fn_start_end: Option<(Span, Span)>,
1368    pub is_assign_desugar: bool,
1369}
1370
1371impl Subdiagnostic for NonBindingLetSub {
1372    fn add_to_diag(self, diag: &mut Diag<'_>) {
1373        let can_suggest_binding = self.drop_fn_start_end.is_some() || !self.is_assign_desugar;
1374
1375        if can_suggest_binding {
1376            let prefix = if self.is_assign_desugar { "let " } else { "" };
1377            diag.span_suggestion_verbose(
1378                self.suggestion,
1379                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider binding to an unused variable to avoid immediately dropping the value"))msg!(
1380                    "consider binding to an unused variable to avoid immediately dropping the value"
1381                ),
1382                ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}_unused", prefix))
    })format!("{prefix}_unused"),
1383                Applicability::MachineApplicable,
1384            );
1385        } else {
1386            diag.span_help(
1387                self.suggestion,
1388                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider binding to an unused variable to avoid immediately dropping the value"))msg!(
1389                    "consider binding to an unused variable to avoid immediately dropping the value"
1390                ),
1391            );
1392        }
1393        if let Some(drop_fn_start_end) = self.drop_fn_start_end {
1394            diag.multipart_suggestion(
1395                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider immediately dropping the value"))msg!("consider immediately dropping the value"),
1396                ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [(drop_fn_start_end.0, "drop(".to_string()),
                (drop_fn_start_end.1, ")".to_string())]))vec![
1397                    (drop_fn_start_end.0, "drop(".to_string()),
1398                    (drop_fn_start_end.1, ")".to_string()),
1399                ],
1400                Applicability::MachineApplicable,
1401            );
1402        } else {
1403            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider immediately dropping the value using `drop(..)` after the `let` statement"))msg!(
1404                "consider immediately dropping the value using `drop(..)` after the `let` statement"
1405            ));
1406        }
1407    }
1408}
1409
1410// levels.rs
1411#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverruledAttributeLint<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverruledAttributeLint {
                        overruled: __binding_0,
                        lint_level: __binding_1,
                        lint_name: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$lint_level}({$lint_name}) incompatible with previous forbid")));
                        ;
                        diag.arg("lint_level", __binding_1);
                        diag.arg("lint_name", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overruled by previous forbid")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1412#[diag("{$lint_level}({$lint_name}) incompatible with previous forbid")]
1413pub(crate) struct OverruledAttributeLint<'a> {
1414    #[label("overruled by previous forbid")]
1415    pub overruled: Span,
1416    pub lint_level: &'a str,
1417    pub lint_name: LintName,
1418    #[subdiagnostic]
1419    pub sub: OverruledAttributeSub,
1420}
1421
1422#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DeprecatedLintName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DeprecatedLintName {
                        lint_name: __binding_0,
                        suggestion: __binding_1,
                        replacement: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint name `{$lint_name}` is deprecated and may not have an effect in the future")));
                        let __code_41 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        ;
                        diag.arg("lint_name", __binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("change it to")),
                            __code_41, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1423#[diag("lint name `{$lint_name}` is deprecated and may not have an effect in the future")]
1424pub(crate) struct DeprecatedLintName {
1425    pub lint_name: LintName,
1426    #[suggestion("change it to", code = "{replacement}", applicability = "machine-applicable")]
1427    pub suggestion: Span,
1428    pub replacement: LintName,
1429}
1430
1431#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DeprecatedLintNameFromCommandLine {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DeprecatedLintNameFromCommandLine {
                        lint_name: __binding_0,
                        replacement: __binding_1,
                        requested_level: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint name `{$lint_name}` is deprecated and may not have an effect in the future")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("change it to {$replacement}")));
                        ;
                        diag.arg("lint_name", __binding_0);
                        diag.arg("replacement", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1432#[diag("lint name `{$lint_name}` is deprecated and may not have an effect in the future")]
1433#[help("change it to {$replacement}")]
1434pub(crate) struct DeprecatedLintNameFromCommandLine {
1435    pub lint_name: LintName,
1436    pub replacement: LintName,
1437    #[subdiagnostic]
1438    pub requested_level: RequestedLevel,
1439}
1440
1441#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for RenamedLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RenamedLint {
                        name: __binding_0,
                        replacement: __binding_1,
                        suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint `{$name}` has been renamed to `{$replacement}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("replacement", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1442#[diag("lint `{$name}` has been renamed to `{$replacement}`")]
1443pub(crate) struct RenamedLint {
1444    pub name: LintName,
1445    pub replacement: LintName,
1446    #[subdiagnostic]
1447    pub suggestion: RenamedLintSuggestion,
1448}
1449
1450#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RenamedLintSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RenamedLintSuggestion::WithSpan {
                        suggestion: __binding_0, replacement: __binding_1 } => {
                        let __code_42 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the new name")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_42, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    RenamedLintSuggestion::WithoutSpan {
                        replacement: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("replacement".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the new name `{$replacement}`")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1451pub(crate) enum RenamedLintSuggestion {
1452    #[suggestion("use the new name", code = "{replacement}", applicability = "machine-applicable")]
1453    WithSpan {
1454        #[primary_span]
1455        suggestion: Span,
1456        replacement: LintName,
1457    },
1458    #[help("use the new name `{$replacement}`")]
1459    WithoutSpan { replacement: LintName },
1460}
1461
1462#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RenamedLintFromCommandLine {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RenamedLintFromCommandLine {
                        lint_name: __binding_0,
                        replacement: __binding_1,
                        suggestion: __binding_2,
                        requested_level: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint `{$lint_name}` has been renamed to `{$replacement}`")));
                        ;
                        diag.arg("lint_name", __binding_0);
                        diag.arg("replacement", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1463#[diag("lint `{$lint_name}` has been renamed to `{$replacement}`")]
1464pub(crate) struct RenamedLintFromCommandLine {
1465    pub lint_name: LintName,
1466    pub replacement: LintName,
1467    #[subdiagnostic]
1468    pub suggestion: RenamedLintSuggestion,
1469    #[subdiagnostic]
1470    pub requested_level: RequestedLevel,
1471}
1472
1473#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for RemovedLint<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RemovedLint { name: __binding_0, reason: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint `{$name}` has been removed: {$reason}")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("reason", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1474#[diag("lint `{$name}` has been removed: {$reason}")]
1475pub(crate) struct RemovedLint<'a> {
1476    pub name: LintName,
1477    pub reason: &'a str,
1478}
1479
1480#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            RemovedLintFromCommandLine<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RemovedLintFromCommandLine {
                        lint_name: __binding_0,
                        reason: __binding_1,
                        requested_level: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lint `{$lint_name}` has been removed: {$reason}")));
                        ;
                        diag.arg("lint_name", __binding_0);
                        diag.arg("reason", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1481#[diag("lint `{$lint_name}` has been removed: {$reason}")]
1482pub(crate) struct RemovedLintFromCommandLine<'a> {
1483    pub lint_name: LintName,
1484    pub reason: &'a str,
1485    #[subdiagnostic]
1486    pub requested_level: RequestedLevel,
1487}
1488
1489#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownLint { name: __binding_0, suggestion: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown lint: `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1490#[diag("unknown lint: `{$name}`")]
1491pub(crate) struct UnknownLint {
1492    pub name: LintName,
1493    #[subdiagnostic]
1494    pub suggestion: Option<UnknownLintSuggestion>,
1495}
1496
1497#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownLintSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnknownLintSuggestion::WithSpan {
                        suggestion: __binding_0,
                        replacement: __binding_1,
                        from_rustc: __binding_2 } => {
                        let __code_43 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("from_rustc".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$from_rustc ->\n            [true] a lint with a similar name exists in `rustc` lints\n            *[false] did you mean\n        }")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_43, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    UnknownLintSuggestion::WithoutSpan {
                        replacement: __binding_0, from_rustc: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("replacement".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("from_rustc".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$from_rustc ->\n            [true] a lint with a similar name exists in `rustc` lints: `{$replacement}`\n            *[false] did you mean: `{$replacement}`\n        }")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1498pub(crate) enum UnknownLintSuggestion {
1499    #[suggestion(
1500        "{$from_rustc ->
1501            [true] a lint with a similar name exists in `rustc` lints
1502            *[false] did you mean
1503        }",
1504        code = "{replacement}",
1505        applicability = "maybe-incorrect"
1506    )]
1507    WithSpan {
1508        #[primary_span]
1509        suggestion: Span,
1510        replacement: LintName,
1511        from_rustc: bool,
1512    },
1513    #[help(
1514        "{$from_rustc ->
1515            [true] a lint with a similar name exists in `rustc` lints: `{$replacement}`
1516            *[false] did you mean: `{$replacement}`
1517        }"
1518    )]
1519    WithoutSpan { replacement: LintName, from_rustc: bool },
1520}
1521
1522#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnknownLintFromCommandLine {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownLintFromCommandLine {
                        lint_name: __binding_0,
                        suggestion: __binding_1,
                        requested_level: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown lint: `{$lint_name}`")));
                        diag.code(E0602);
                        ;
                        diag.arg("lint_name", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1523#[diag("unknown lint: `{$lint_name}`", code = E0602)]
1524pub(crate) struct UnknownLintFromCommandLine {
1525    pub lint_name: LintName,
1526    #[subdiagnostic]
1527    pub suggestion: Option<UnknownLintSuggestion>,
1528    #[subdiagnostic]
1529    pub requested_level: RequestedLevel,
1530}
1531
1532#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            IgnoredUnlessCrateSpecified<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IgnoredUnlessCrateSpecified {
                        level: __binding_0, lint_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$level}({$lint_name}) is ignored unless specified at crate level")));
                        ;
                        diag.arg("level", __binding_0);
                        diag.arg("lint_name", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1533#[diag("{$level}({$lint_name}) is ignored unless specified at crate level")]
1534pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
1535    pub level: &'a str,
1536    pub lint_name: LintName,
1537}
1538
1539// dangling.rs
1540#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            DanglingPointersFromTemporaries<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DanglingPointersFromTemporaries {
                        callee: __binding_0,
                        ty: __binding_1,
                        ptr_span: __binding_2,
                        temporary_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this creates a dangling pointer because temporary `{$ty}` is dropped at end of statement")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bind the `{$ty}` to a variable such that it outlives the pointer returned by `{$callee}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a dangling pointer is safe, but dereferencing one is undefined behavior")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returning a pointer to a local variable will always result in a dangling pointer")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")));
                        ;
                        diag.arg("callee", __binding_0);
                        diag.arg("ty", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pointer created here")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `{$ty}` is dropped at end of statement")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1541#[diag("this creates a dangling pointer because temporary `{$ty}` is dropped at end of statement")]
1542#[help("bind the `{$ty}` to a variable such that it outlives the pointer returned by `{$callee}`")]
1543#[note("a dangling pointer is safe, but dereferencing one is undefined behavior")]
1544#[note("returning a pointer to a local variable will always result in a dangling pointer")]
1545#[note("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")]
1546// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
1547pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
1548    pub callee: Ident,
1549    pub ty: Ty<'tcx>,
1550    #[label("pointer created here")]
1551    pub ptr_span: Span,
1552    #[label("this `{$ty}` is dropped at end of statement")]
1553    pub temporary_span: Span,
1554}
1555
1556#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            DanglingPointersFromLocals<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DanglingPointersFromLocals {
                        ret_ty: __binding_0,
                        ret_ty_span: __binding_1,
                        fn_kind: __binding_2,
                        local_var: __binding_3,
                        local_var_name: __binding_4,
                        local_var_ty: __binding_5,
                        created_at: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a dangling pointer is safe, but dereferencing one is undefined behavior")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")));
                        ;
                        diag.arg("ret_ty", __binding_0);
                        diag.arg("fn_kind", __binding_2);
                        diag.arg("local_var_name", __binding_4);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type is `{$ret_ty}`")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}")));
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_label(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dangling pointer created here")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1557#[diag("{$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`")]
1558#[note("a dangling pointer is safe, but dereferencing one is undefined behavior")]
1559#[note("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")]
1560pub(crate) struct DanglingPointersFromLocals<'tcx> {
1561    pub ret_ty: Ty<'tcx>,
1562    #[label("return type is `{$ret_ty}`")]
1563    pub ret_ty_span: Span,
1564    pub fn_kind: &'static str,
1565    #[label("local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}")]
1566    pub local_var: Span,
1567    pub local_var_name: Ident,
1568    pub local_var_ty: Ty<'tcx>,
1569    #[label("dangling pointer created here")]
1570    pub created_at: Option<Span>,
1571}
1572
1573// multiple_supertrait_upcastable.rs
1574#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MultipleSupertraitUpcastable {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MultipleSupertraitUpcastable { ident: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is dyn-compatible and has multiple supertraits")));
                        ;
                        diag.arg("ident", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1575#[diag("`{$ident}` is dyn-compatible and has multiple supertraits")]
1576pub(crate) struct MultipleSupertraitUpcastable {
1577    pub ident: Ident,
1578}
1579
1580// non_ascii_idents.rs
1581#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            IdentifierNonAsciiChar {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IdentifierNonAsciiChar => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("identifier contains non-ASCII characters")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1582#[diag("identifier contains non-ASCII characters")]
1583pub(crate) struct IdentifierNonAsciiChar;
1584
1585#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            IdentifierUncommonCodepoints {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IdentifierUncommonCodepoints {
                        codepoints: __binding_0,
                        codepoints_len: __binding_1,
                        identifier_type: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("identifier contains {$codepoints_len ->\n        [one] { $identifier_type ->\n            [Exclusion] a character from an archaic script\n            [Technical] a character that is for non-linguistic, specialized usage\n            [Limited_Use] a character from a script in limited use\n            [Not_NFKC] a non normalized (NFKC) character\n            *[other] an uncommon character\n        }\n        *[other] { $identifier_type ->\n            [Exclusion] {$codepoints_len} characters from archaic scripts\n            [Technical] {$codepoints_len} characters that are for non-linguistic, specialized usage\n            [Limited_Use] {$codepoints_len} characters from scripts in limited use\n            [Not_NFKC] {$codepoints_len} non normalized (NFKC) characters\n            *[other] uncommon characters\n        }\n    }: {$codepoints}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$codepoints_len ->\n        [one] this character is\n        *[other] these characters are\n    } included in the{$identifier_type ->\n        [Restricted] {\"\"}\n        *[other] {\" \"}{$identifier_type}\n    } Unicode general security profile")));
                        ;
                        diag.arg("codepoints", __binding_0);
                        diag.arg("codepoints_len", __binding_1);
                        diag.arg("identifier_type", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1586#[diag(
1587    "identifier contains {$codepoints_len ->
1588        [one] { $identifier_type ->
1589            [Exclusion] a character from an archaic script
1590            [Technical] a character that is for non-linguistic, specialized usage
1591            [Limited_Use] a character from a script in limited use
1592            [Not_NFKC] a non normalized (NFKC) character
1593            *[other] an uncommon character
1594        }
1595        *[other] { $identifier_type ->
1596            [Exclusion] {$codepoints_len} characters from archaic scripts
1597            [Technical] {$codepoints_len} characters that are for non-linguistic, specialized usage
1598            [Limited_Use] {$codepoints_len} characters from scripts in limited use
1599            [Not_NFKC] {$codepoints_len} non normalized (NFKC) characters
1600            *[other] uncommon characters
1601        }
1602    }: {$codepoints}"
1603)]
1604#[note(
1605    r#"{$codepoints_len ->
1606        [one] this character is
1607        *[other] these characters are
1608    } included in the{$identifier_type ->
1609        [Restricted] {""}
1610        *[other] {" "}{$identifier_type}
1611    } Unicode general security profile"#
1612)]
1613pub(crate) struct IdentifierUncommonCodepoints {
1614    pub codepoints: Vec<char>,
1615    pub codepoints_len: usize,
1616    pub identifier_type: &'static str,
1617}
1618
1619#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ConfusableIdentifierPair {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConfusableIdentifierPair {
                        existing_sym: __binding_0,
                        sym: __binding_1,
                        label: __binding_2,
                        main_label: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found both `{$existing_sym}` and `{$sym}` as identifiers, which look alike")));
                        ;
                        diag.arg("existing_sym", __binding_0);
                        diag.arg("sym", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("other identifier used here")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this identifier can be confused with `{$existing_sym}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1620#[diag("found both `{$existing_sym}` and `{$sym}` as identifiers, which look alike")]
1621pub(crate) struct ConfusableIdentifierPair {
1622    pub existing_sym: Symbol,
1623    pub sym: Symbol,
1624    #[label("other identifier used here")]
1625    pub label: Span,
1626    #[label("this identifier can be confused with `{$existing_sym}`")]
1627    pub main_label: Span,
1628}
1629
1630#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MixedScriptConfusables {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MixedScriptConfusables {
                        set: __binding_0, includes: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the usage includes {$includes}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please recheck to make sure their usages are indeed what you want")));
                        ;
                        diag.arg("set", __binding_0);
                        diag.arg("includes", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1631#[diag(
1632    "the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables"
1633)]
1634#[note("the usage includes {$includes}")]
1635#[note("please recheck to make sure their usages are indeed what you want")]
1636pub(crate) struct MixedScriptConfusables {
1637    pub set: String,
1638    pub includes: String,
1639}
1640
1641// non_fmt_panic.rs
1642pub(crate) struct NonFmtPanicUnused {
1643    pub count: usize,
1644    pub suggestion: Option<Span>,
1645}
1646
1647// Used because of two suggestions based on one Option<Span>
1648impl<'a> Diagnostic<'a> for NonFmtPanicUnused {
1649    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
1650        let mut diag = Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("panic message contains {$count ->\n                [one] an unused\n                *[other] unused\n            } formatting {$count ->\n                [one] placeholder\n                *[other] placeholders\n            }"))msg!(
1651            "panic message contains {$count ->
1652                [one] an unused
1653                *[other] unused
1654            } formatting {$count ->
1655                [one] placeholder
1656                *[other] placeholders
1657            }"
1658        ))
1659            .with_arg("count", self.count)
1660            .with_note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this message is not used as a format string when given without arguments, but will be in Rust 2021"))msg!("this message is not used as a format string when given without arguments, but will be in Rust 2021"));
1661        if let Some(span) = self.suggestion {
1662            diag.span_suggestion_verbose(
1663                span.shrink_to_hi(),
1664                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the missing {$count ->\n                        [one] argument\n                        *[other] arguments\n                    }"))msg!(
1665                    "add the missing {$count ->
1666                        [one] argument
1667                        *[other] arguments
1668                    }"
1669                ),
1670                ", ...",
1671                Applicability::HasPlaceholders,
1672            );
1673            diag.span_suggestion_verbose(
1674                span.shrink_to_lo(),
1675                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or add a \"{\"{\"}{\"}\"}\" format string to use the message literally"))msg!(r#"or add a "{"{"}{"}"}" format string to use the message literally"#),
1676                "\"{}\", ",
1677                Applicability::MachineApplicable,
1678            );
1679        }
1680        diag
1681    }
1682}
1683
1684#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonFmtPanicBraces {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonFmtPanicBraces {
                        count: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("panic message contains {$count ->\n        [one] a brace\n        *[other] braces\n    }")));
                        let __code_44 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{{}}\", "))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this message is not used as a format string, but will be in Rust 2021")));
                        ;
                        diag.arg("count", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_suggestions_with_style(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add a \"{\"{\"}{\"}\"}\" format string to use the message literally")),
                                __code_44, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1685#[diag(
1686    "panic message contains {$count ->
1687        [one] a brace
1688        *[other] braces
1689    }"
1690)]
1691#[note("this message is not used as a format string, but will be in Rust 2021")]
1692pub(crate) struct NonFmtPanicBraces {
1693    pub count: usize,
1694    #[suggestion(
1695        "add a \"{\"{\"}{\"}\"}\" format string to use the message literally",
1696        code = "\"{{}}\", ",
1697        applicability = "machine-applicable"
1698    )]
1699    pub suggestion: Option<Span>,
1700}
1701
1702// nonstandard_style.rs
1703#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            NonCamelCaseType<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonCamelCaseType {
                        sort: __binding_0, name: __binding_1, sub: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$sort} `{$name}` should have an upper camel case name")));
                        ;
                        diag.arg("sort", __binding_0);
                        diag.arg("name", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1704#[diag("{$sort} `{$name}` should have an upper camel case name")]
1705pub(crate) struct NonCamelCaseType<'a> {
1706    pub sort: &'a str,
1707    pub name: &'a str,
1708    #[subdiagnostic]
1709    pub sub: NonCamelCaseTypeSub,
1710}
1711
1712#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NonCamelCaseTypeSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    NonCamelCaseTypeSub::Label { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("should have an UpperCamelCase name")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    NonCamelCaseTypeSub::Suggestion {
                        span: __binding_0, replace: __binding_1 } => {
                        let __code_45 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper camel case")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_45, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1713pub(crate) enum NonCamelCaseTypeSub {
1714    #[label("should have an UpperCamelCase name")]
1715    Label {
1716        #[primary_span]
1717        span: Span,
1718    },
1719    #[suggestion(
1720        "convert the identifier to upper camel case",
1721        code = "{replace}",
1722        applicability = "maybe-incorrect"
1723    )]
1724    Suggestion {
1725        #[primary_span]
1726        span: Span,
1727        replace: String,
1728    },
1729}
1730
1731#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            NonSnakeCaseDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonSnakeCaseDiag {
                        sort: __binding_0, name: __binding_1, sub: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$sort} `{$name}` should have a snake case name")));
                        ;
                        diag.arg("sort", __binding_0);
                        diag.arg("name", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1732#[diag("{$sort} `{$name}` should have a snake case name")]
1733pub(crate) struct NonSnakeCaseDiag<'a> {
1734    pub sort: &'a str,
1735    pub name: &'a str,
1736    #[subdiagnostic]
1737    pub sub: NonSnakeCaseDiagSub,
1738}
1739
1740pub(crate) enum NonSnakeCaseDiagSub {
1741    Label { span: Span },
1742    Help { sc: String },
1743    RenameOrConvertSuggestion { span: Span, suggestion: Ident },
1744    ConvertSuggestion { span: Span, suggestion: String },
1745    SuggestionAndNote { sc: String, span: Span },
1746}
1747
1748impl Subdiagnostic for NonSnakeCaseDiagSub {
1749    fn add_to_diag(self, diag: &mut Diag<'_>) {
1750        match self {
1751            NonSnakeCaseDiagSub::Label { span } => {
1752                diag.span_label(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("should have a snake_case name"))msg!("should have a snake_case name"));
1753            }
1754            NonSnakeCaseDiagSub::Help { sc } => {
1755                diag.arg("sc", sc);
1756                diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to snake case: `{$sc}`"))msg!("convert the identifier to snake case: `{$sc}`"));
1757            }
1758            NonSnakeCaseDiagSub::ConvertSuggestion { span, suggestion } => {
1759                diag.span_suggestion(
1760                    span,
1761                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to snake case"))msg!("convert the identifier to snake case"),
1762                    suggestion,
1763                    Applicability::MaybeIncorrect,
1764                );
1765            }
1766            NonSnakeCaseDiagSub::RenameOrConvertSuggestion { span, suggestion } => {
1767                diag.span_suggestion(
1768                    span,
1769                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rename the identifier or convert it to a snake case raw identifier"))msg!("rename the identifier or convert it to a snake case raw identifier"),
1770                    suggestion,
1771                    Applicability::MaybeIncorrect,
1772                );
1773            }
1774            NonSnakeCaseDiagSub::SuggestionAndNote { sc, span } => {
1775                diag.arg("sc", sc);
1776                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$sc}` cannot be used as a raw identifier"))msg!("`{$sc}` cannot be used as a raw identifier"));
1777                diag.span_suggestion(
1778                    span,
1779                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rename the identifier"))msg!("rename the identifier"),
1780                    "",
1781                    Applicability::MaybeIncorrect,
1782                );
1783            }
1784        }
1785    }
1786}
1787
1788#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            NonUpperCaseGlobal<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonUpperCaseGlobal {
                        sort: __binding_0,
                        name: __binding_1,
                        sub: __binding_2,
                        usages: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$sort} `{$name}` should have an upper case name")));
                        ;
                        diag.arg("sort", __binding_0);
                        diag.arg("name", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        for __binding_3 in __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1789#[diag("{$sort} `{$name}` should have an upper case name")]
1790pub(crate) struct NonUpperCaseGlobal<'a> {
1791    pub sort: &'a str,
1792    pub name: &'a str,
1793    #[subdiagnostic]
1794    pub sub: NonUpperCaseGlobalSub,
1795    #[subdiagnostic]
1796    pub usages: Vec<NonUpperCaseGlobalSubTool>,
1797}
1798
1799#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NonUpperCaseGlobalSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    NonUpperCaseGlobalSub::Label { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("should have an UPPER_CASE name")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    NonUpperCaseGlobalSub::Suggestion {
                        span: __binding_0,
                        applicability: __binding_1,
                        replace: __binding_2 } => {
                        let __code_46 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper case")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_46, __binding_1,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1800pub(crate) enum NonUpperCaseGlobalSub {
1801    #[label("should have an UPPER_CASE name")]
1802    Label {
1803        #[primary_span]
1804        span: Span,
1805    },
1806    #[suggestion("convert the identifier to upper case", code = "{replace}")]
1807    Suggestion {
1808        #[primary_span]
1809        span: Span,
1810        #[applicability]
1811        applicability: Applicability,
1812        replace: String,
1813    },
1814}
1815
1816#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NonUpperCaseGlobalSubTool {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    NonUpperCaseGlobalSubTool {
                        span: __binding_0, replace: __binding_1 } => {
                        let __code_47 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper case")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_47, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                    }
                }
            }
        }
    };Subdiagnostic)]
1817#[suggestion(
1818    "convert the identifier to upper case",
1819    code = "{replace}",
1820    applicability = "machine-applicable",
1821    style = "tool-only"
1822)]
1823pub(crate) struct NonUpperCaseGlobalSubTool {
1824    #[primary_span]
1825    pub(crate) span: Span,
1826    pub(crate) replace: String,
1827}
1828
1829// noop_method_call.rs
1830#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            NoopMethodCallDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NoopMethodCallDiag {
                        method: __binding_0,
                        orig_ty: __binding_1,
                        trait_: __binding_2,
                        label: __binding_3,
                        suggest_derive: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to `.{$method}()` on a reference in this situation does nothing")));
                        let __code_48 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let __code_49 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#[derive(Clone)]\n"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type `{$orig_ty}` does not implement `{$trait_}`, so calling `{$method}` on `&{$orig_ty}` copies the reference, which does not do anything and can be removed")));
                        ;
                        diag.arg("method", __binding_0);
                        diag.arg("orig_ty", __binding_1);
                        diag.arg("trait_", __binding_2);
                        diag.span_suggestions_with_style(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this redundant call")),
                            __code_48, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_suggestions_with_style(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to clone `{$orig_ty}`, implement `Clone` for it")),
                                __code_49, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1831#[diag("call to `.{$method}()` on a reference in this situation does nothing")]
1832#[note(
1833    "the type `{$orig_ty}` does not implement `{$trait_}`, so calling `{$method}` on `&{$orig_ty}` copies the reference, which does not do anything and can be removed"
1834)]
1835pub(crate) struct NoopMethodCallDiag<'a> {
1836    pub method: Ident,
1837    pub orig_ty: Ty<'a>,
1838    pub trait_: Symbol,
1839    #[suggestion("remove this redundant call", code = "", applicability = "machine-applicable")]
1840    pub label: Span,
1841    #[suggestion(
1842        "if you meant to clone `{$orig_ty}`, implement `Clone` for it",
1843        code = "#[derive(Clone)]\n",
1844        applicability = "maybe-incorrect"
1845    )]
1846    pub suggest_derive: Option<Span>,
1847}
1848
1849#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            SuspiciousDoubleRefDerefDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SuspiciousDoubleRefDerefDiag { ty: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1850#[diag(
1851    "using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type"
1852)]
1853pub(crate) struct SuspiciousDoubleRefDerefDiag<'a> {
1854    pub ty: Ty<'a>,
1855}
1856
1857#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            SuspiciousDoubleRefCloneDiag<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SuspiciousDoubleRefCloneDiag { ty: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `.clone()` on a double reference, which returns `{$ty}` instead of cloning the inner type")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1858#[diag(
1859    "using `.clone()` on a double reference, which returns `{$ty}` instead of cloning the inner type"
1860)]
1861pub(crate) struct SuspiciousDoubleRefCloneDiag<'a> {
1862    pub ty: Ty<'a>,
1863}
1864
1865// non_local_defs.rs
1866pub(crate) enum NonLocalDefinitionsDiag {
1867    Impl {
1868        depth: u32,
1869        body_kind_descr: &'static str,
1870        body_name: String,
1871        cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
1872        const_anon: Option<Option<Span>>,
1873        doctest: bool,
1874        macro_to_change: Option<(String, &'static str)>,
1875    },
1876    MacroRules {
1877        depth: u32,
1878        body_kind_descr: &'static str,
1879        body_name: String,
1880        doctest: bool,
1881        cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
1882    },
1883}
1884
1885impl<'a> Diagnostic<'a> for NonLocalDefinitionsDiag {
1886    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
1887        let mut diag = Diag::new(dcx, level, "");
1888        match self {
1889            NonLocalDefinitionsDiag::Impl {
1890                depth,
1891                body_kind_descr,
1892                body_name,
1893                cargo_update,
1894                const_anon,
1895                doctest,
1896                macro_to_change,
1897            } => {
1898                diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-local `impl` definition, `impl` blocks should be written at the same level as their item"))msg!("non-local `impl` definition, `impl` blocks should be written at the same level as their item"));
1899                diag.arg("depth", depth);
1900                diag.arg("body_kind_descr", body_kind_descr);
1901                diag.arg("body_name", body_name);
1902
1903                if let Some((macro_to_change, macro_kind)) = macro_to_change {
1904                    diag.arg("macro_to_change", macro_to_change);
1905                    diag.arg("macro_kind", macro_kind);
1906                    diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$macro_kind} `{$macro_to_change}` defines the non-local `impl`, and may need to be changed"))msg!("the {$macro_kind} `{$macro_to_change}` defines the non-local `impl`, and may need to be changed"));
1907                }
1908                if let Some(cargo_update) = cargo_update {
1909                    diag.subdiagnostic(cargo_update);
1910                }
1911
1912                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`"))msg!("an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`"));
1913
1914                if doctest {
1915                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("make this doc-test a standalone test with its own `fn main() {\"{\"} ... {\"}\"}`"))msg!("make this doc-test a standalone test with its own `fn main() {\"{\"} ... {\"}\"}`"));
1916                }
1917
1918                if let Some(const_anon) = const_anon {
1919                    diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items in an anonymous const item (`const _: () = {\"{\"} ... {\"}\"}`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint"))msg!("items in an anonymous const item (`const _: () = {\"{\"} ... {\"}\"}`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint"));
1920                    if let Some(const_anon) = const_anon {
1921                        diag.span_suggestion_verbose(
1922                            const_anon,
1923                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a const-anon item to suppress this lint"))msg!("use a const-anon item to suppress this lint"),
1924                            "_",
1925                            Applicability::MachineApplicable,
1926                        );
1927                    }
1928                }
1929            }
1930            NonLocalDefinitionsDiag::MacroRules {
1931                depth,
1932                body_kind_descr,
1933                body_name,
1934                doctest,
1935                cargo_update,
1936            } => {
1937                diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module"))msg!("non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module"));
1938                diag.arg("depth", depth);
1939                diag.arg("body_kind_descr", body_kind_descr);
1940                diag.arg("body_name", body_name);
1941
1942                if doctest {
1943                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() {\"{\"} ... {\"}\"}`"))msg!(r#"remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() {"{"} ... {"}"}`"#));
1944                } else {
1945                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr} {$depth ->\n                            [one] `{$body_name}`\n                            *[other] `{$body_name}` and up {$depth} bodies\n                        }"))msg!(
1946                        "remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr} {$depth ->
1947                            [one] `{$body_name}`
1948                            *[other] `{$body_name}` and up {$depth} bodies
1949                        }"
1950                    ));
1951                }
1952
1953                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute"))msg!("a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute"));
1954
1955                if let Some(cargo_update) = cargo_update {
1956                    diag.subdiagnostic(cargo_update);
1957                }
1958            }
1959        }
1960        diag
1961    }
1962}
1963
1964#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            NonLocalDefinitionsCargoUpdateNote {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    NonLocalDefinitionsCargoUpdateNote {
                        macro_kind: __binding_0,
                        macro_name: __binding_1,
                        crate_name: __binding_2 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("macro_kind".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("macro_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("crate_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$macro_kind} `{$macro_name}` may come from an old version of the `{$crate_name}` crate, try updating your dependency with `cargo update -p {$crate_name}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1965#[note(
1966    "the {$macro_kind} `{$macro_name}` may come from an old version of the `{$crate_name}` crate, try updating your dependency with `cargo update -p {$crate_name}`"
1967)]
1968pub(crate) struct NonLocalDefinitionsCargoUpdateNote {
1969    pub macro_kind: &'static str,
1970    pub macro_name: Symbol,
1971    pub crate_name: Symbol,
1972}
1973
1974// precedence.rs
1975#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AmbiguousNegativeLiteralsDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AmbiguousNegativeLiteralsDiag {
                        negative_literal: __binding_0, current_behavior: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-` has lower precedence than method calls, which might be unexpected")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1976#[diag("`-` has lower precedence than method calls, which might be unexpected")]
1977#[note("e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`")]
1978pub(crate) struct AmbiguousNegativeLiteralsDiag {
1979    #[subdiagnostic]
1980    pub negative_literal: AmbiguousNegativeLiteralsNegativeLiteralSuggestion,
1981    #[subdiagnostic]
1982    pub current_behavior: AmbiguousNegativeLiteralsCurrentBehaviorSuggestion,
1983}
1984
1985#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AmbiguousNegativeLiteralsNegativeLiteralSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousNegativeLiteralsNegativeLiteralSuggestion {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_50 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_51 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_50));
                        suggestions.push((__binding_1, __code_51));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses around the `-` and the literal to call the method on a negative literal")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1986#[multipart_suggestion(
1987    "add parentheses around the `-` and the literal to call the method on a negative literal",
1988    applicability = "maybe-incorrect"
1989)]
1990pub(crate) struct AmbiguousNegativeLiteralsNegativeLiteralSuggestion {
1991    #[suggestion_part(code = "(")]
1992    pub start_span: Span,
1993    #[suggestion_part(code = ")")]
1994    pub end_span: Span,
1995}
1996
1997#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AmbiguousNegativeLiteralsCurrentBehaviorSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousNegativeLiteralsCurrentBehaviorSuggestion {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_52 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_53 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_52));
                        suggestions.push((__binding_1, __code_53));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses around the literal and the method call to keep the current behavior")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1998#[multipart_suggestion(
1999    "add parentheses around the literal and the method call to keep the current behavior",
2000    applicability = "maybe-incorrect"
2001)]
2002pub(crate) struct AmbiguousNegativeLiteralsCurrentBehaviorSuggestion {
2003    #[suggestion_part(code = "(")]
2004    pub start_span: Span,
2005    #[suggestion_part(code = ")")]
2006    pub end_span: Span,
2007}
2008
2009// disallowed_pass_by_ref.rs
2010#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DisallowedPassByRefDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DisallowedPassByRefDiag {
                        ty: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("passing `{$ty}` by reference")));
                        let __code_54 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_0))
                                            })].into_iter();
                        ;
                        diag.arg("ty", __binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try passing by value")),
                            __code_54, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2011#[diag("passing `{$ty}` by reference")]
2012pub(crate) struct DisallowedPassByRefDiag {
2013    pub ty: String,
2014    #[suggestion("try passing by value", code = "{ty}", applicability = "maybe-incorrect")]
2015    pub suggestion: Span,
2016}
2017
2018// redundant_semicolon.rs
2019#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RedundantSemicolonsDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RedundantSemicolonsDiag {
                        multiple: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary trailing {$multiple ->\n        [true] semicolons\n        *[false] semicolon\n    }")));
                        ;
                        diag.arg("multiple", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2020#[diag(
2021    "unnecessary trailing {$multiple ->
2022        [true] semicolons
2023        *[false] semicolon
2024    }"
2025)]
2026pub(crate) struct RedundantSemicolonsDiag {
2027    pub multiple: bool,
2028    #[subdiagnostic]
2029    pub suggestion: Option<RedundantSemicolonsSuggestion>,
2030}
2031
2032#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RedundantSemicolonsSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RedundantSemicolonsSuggestion {
                        multiple_semicolons: __binding_0, span: __binding_1 } => {
                        let __code_55 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("multiple_semicolons".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("remove {$multiple_semicolons ->\n        [true] these semicolons\n        *[false] this semicolon\n    }")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_1, __message,
                            __code_55, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
2033#[suggestion(
2034    "remove {$multiple_semicolons ->
2035        [true] these semicolons
2036        *[false] this semicolon
2037    }",
2038    code = "",
2039    applicability = "maybe-incorrect"
2040)]
2041pub(crate) struct RedundantSemicolonsSuggestion {
2042    pub multiple_semicolons: bool,
2043    #[primary_span]
2044    pub span: Span,
2045}
2046
2047// traits.rs
2048pub(crate) struct DropTraitConstraintsDiag<'a> {
2049    pub clause: Clause<'a>,
2050    pub tcx: TyCtxt<'a>,
2051    pub def_id: DefId,
2052}
2053
2054// Needed for def_path_str
2055impl<'a> Diagnostic<'a> for DropTraitConstraintsDiag<'_> {
2056    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2057        Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds on `{$clause}` are most likely incorrect, consider instead using `{$needs_drop}` to detect whether a type can be trivially dropped"))msg!("bounds on `{$clause}` are most likely incorrect, consider instead using `{$needs_drop}` to detect whether a type can be trivially dropped"))
2058            .with_arg("clause", self.clause)
2059            .with_arg("needs_drop", self.tcx.def_path_str(self.def_id))
2060    }
2061}
2062
2063pub(crate) struct DropGlue<'a> {
2064    pub tcx: TyCtxt<'a>,
2065    pub def_id: DefId,
2066}
2067
2068// Needed for def_path_str
2069impl<'a> Diagnostic<'a> for DropGlue<'_> {
2070    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2071        Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("types that do not implement `Drop` can still have drop glue, consider instead using `{$needs_drop}` to detect whether a type is trivially dropped"))msg!("types that do not implement `Drop` can still have drop glue, consider instead using `{$needs_drop}` to detect whether a type is trivially dropped"))
2072            .with_arg("needs_drop", self.tcx.def_path_str(self.def_id))
2073    }
2074}
2075
2076// transmute.rs
2077#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            IntegerToPtrTransmutes<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IntegerToPtrTransmutes {
                        without_prov: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("transmuting an integer to a pointer creates a pointer without provenance")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is dangerous because dereferencing the resulting pointer is undefined behavior")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("exposed provenance semantics can be used to create a pointer based on some previously exposed provenance")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2078#[diag("transmuting an integer to a pointer creates a pointer without provenance")]
2079#[note("this is dangerous because dereferencing the resulting pointer is undefined behavior")]
2080#[note(
2081    "exposed provenance semantics can be used to create a pointer based on some previously exposed provenance"
2082)]
2083#[help(
2084    "for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>"
2085)]
2086#[help(
2087    "for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>"
2088)]
2089pub(crate) struct IntegerToPtrTransmutes<'tcx> {
2090    #[subdiagnostic]
2091    pub without_prov: Option<IntegerToPtrWithoutProvHelp>,
2092    #[subdiagnostic]
2093    pub suggestion: Option<IntegerToPtrTransmutesSuggestion<'tcx>>,
2094}
2095
2096#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for IntegerToPtrWithoutProvHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    IntegerToPtrWithoutProvHelp { krate: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you truly mean to create a pointer without provenance, use `{$krate}::ptr::without_provenance_mut`")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2097#[help(
2098    "if you truly mean to create a pointer without provenance, use `{$krate}::ptr::without_provenance_mut`"
2099)]
2100pub(crate) struct IntegerToPtrWithoutProvHelp {
2101    pub krate: &'static str,
2102}
2103
2104#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for
            IntegerToPtrTransmutesSuggestion<'tcx> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    IntegerToPtrTransmutesSuggestion::ToPtr {
                        krate: __binding_0,
                        dst: __binding_1,
                        suffix: __binding_2,
                        start_call: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_56 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}::ptr::with_exposed_provenance{2}::<{0}>(",
                                            __binding_1, __binding_0, __binding_2))
                                });
                        suggestions.push((__binding_3, __code_56));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("suffix".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    IntegerToPtrTransmutesSuggestion::ToRef {
                        krate: __binding_0,
                        dst: __binding_1,
                        suffix: __binding_2,
                        ref_mutbl: __binding_3,
                        start_call: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_57 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&{2}*{1}::ptr::with_exposed_provenance{3}::<{0}>(",
                                            __binding_1, __binding_0, __binding_3, __binding_2))
                                });
                        suggestions.push((__binding_4, __code_57));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("suffix".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2105pub(crate) enum IntegerToPtrTransmutesSuggestion<'tcx> {
2106    #[multipart_suggestion(
2107        "use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
2108        applicability = "machine-applicable",
2109        style = "verbose"
2110    )]
2111    ToPtr {
2112        krate: &'static str,
2113        dst: Ty<'tcx>,
2114        suffix: &'static str,
2115        #[suggestion_part(code = "{krate}::ptr::with_exposed_provenance{suffix}::<{dst}>(")]
2116        start_call: Span,
2117    },
2118    #[multipart_suggestion(
2119        "use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
2120        applicability = "machine-applicable",
2121        style = "verbose"
2122    )]
2123    ToRef {
2124        krate: &'static str,
2125        dst: Ty<'tcx>,
2126        suffix: &'static str,
2127        ref_mutbl: &'static str,
2128        #[suggestion_part(
2129            code = "&{ref_mutbl}*{krate}::ptr::with_exposed_provenance{suffix}::<{dst}>("
2130        )]
2131        start_call: Span,
2132    },
2133}
2134
2135// types.rs
2136#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            RangeEndpointOutOfRange<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RangeEndpointOutOfRange { ty: __binding_0, sub: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("range endpoint is out of range for `{$ty}`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2137#[diag("range endpoint is out of range for `{$ty}`")]
2138pub(crate) struct RangeEndpointOutOfRange<'a> {
2139    pub ty: &'a str,
2140    #[subdiagnostic]
2141    pub sub: UseInclusiveRange<'a>,
2142}
2143
2144#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for UseInclusiveRange<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UseInclusiveRange::WithoutParen {
                        sugg: __binding_0,
                        start: __binding_1,
                        literal: __binding_2,
                        suffix: __binding_3 } => {
                        let __code_58 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}..={0}{2}",
                                                        __binding_2, __binding_1, __binding_3))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use an inclusive range instead")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_58, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    UseInclusiveRange::WithParen {
                        eq_sugg: __binding_0,
                        lit_sugg: __binding_1,
                        literal: __binding_2,
                        suffix: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_59 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("="))
                                });
                        let __code_60 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}{1}", __binding_2,
                                            __binding_3))
                                });
                        suggestions.push((__binding_0, __code_59));
                        suggestions.push((__binding_1, __code_60));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use an inclusive range instead")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
2145pub(crate) enum UseInclusiveRange<'a> {
2146    #[suggestion(
2147        "use an inclusive range instead",
2148        code = "{start}..={literal}{suffix}",
2149        applicability = "machine-applicable"
2150    )]
2151    WithoutParen {
2152        #[primary_span]
2153        sugg: Span,
2154        start: String,
2155        literal: u128,
2156        suffix: &'a str,
2157    },
2158    #[multipart_suggestion("use an inclusive range instead", applicability = "machine-applicable")]
2159    WithParen {
2160        #[suggestion_part(code = "=")]
2161        eq_sugg: Span,
2162        #[suggestion_part(code = "{literal}{suffix}")]
2163        lit_sugg: Span,
2164        literal: u128,
2165        suffix: &'a str,
2166    },
2167}
2168
2169#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverflowingBinHex<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverflowingBinHex {
                        ty: __binding_0,
                        sign: __binding_1,
                        sub: __binding_2,
                        sign_bit_sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literal out of range for `{$ty}`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag.subdiagnostic(__binding_1);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2170#[diag("literal out of range for `{$ty}`")]
2171pub(crate) struct OverflowingBinHex<'a> {
2172    pub ty: &'a str,
2173    #[subdiagnostic]
2174    pub sign: OverflowingBinHexSign<'a>,
2175    #[subdiagnostic]
2176    pub sub: Option<OverflowingBinHexSub<'a>>,
2177    #[subdiagnostic]
2178    pub sign_bit_sub: Option<OverflowingBinHexSignBitSub<'a>>,
2179}
2180
2181#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OverflowingBinHexSign<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    OverflowingBinHexSign::Positive {
                        lit: __binding_0,
                        ty: __binding_1,
                        actually: __binding_2,
                        dec: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("lit".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("actually".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("dec".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 literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}` and will become `{$actually}{$ty}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                    OverflowingBinHexSign::Negative {
                        lit: __binding_0,
                        ty: __binding_1,
                        actually: __binding_2,
                        dec: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("lit".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("actually".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("dec".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 literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("and the value `-{$lit}` will become `{$actually}{$ty}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2182pub(crate) enum OverflowingBinHexSign<'a> {
2183    #[note(
2184        "the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}` and will become `{$actually}{$ty}`"
2185    )]
2186    Positive { lit: String, ty: &'a str, actually: String, dec: u128 },
2187    #[note("the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`")]
2188    #[note("and the value `-{$lit}` will become `{$actually}{$ty}`")]
2189    Negative { lit: String, ty: &'a str, actually: String, dec: u128 },
2190}
2191
2192#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OverflowingBinHexSub<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    OverflowingBinHexSub::Suggestion {
                        span: __binding_0,
                        suggestion_ty: __binding_1,
                        sans_suffix: __binding_2 } => {
                        let __code_61 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}{1}", __binding_2,
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("suggestion_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_61, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    OverflowingBinHexSub::Help { suggestion_ty: __binding_0 } =>
                        {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("suggestion_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2193pub(crate) enum OverflowingBinHexSub<'a> {
2194    #[suggestion(
2195        "consider using the type `{$suggestion_ty}` instead",
2196        code = "{sans_suffix}{suggestion_ty}",
2197        applicability = "machine-applicable"
2198    )]
2199    Suggestion {
2200        #[primary_span]
2201        span: Span,
2202        suggestion_ty: &'a str,
2203        sans_suffix: &'a str,
2204    },
2205    #[help("consider using the type `{$suggestion_ty}` instead")]
2206    Help { suggestion_ty: &'a str },
2207}
2208
2209#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            OverflowingBinHexSignBitSub<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    OverflowingBinHexSignBitSub::CastSigned {
                        span: __binding_0,
                        lit_no_suffix: __binding_1,
                        negative_val: __binding_2,
                        uint_ty: __binding_3,
                        int_ty: __binding_4 } => {
                        let __code_62 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}{1}.cast_signed()",
                                                        __binding_1, __binding_3))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("negative_val".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("uint_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("int_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to use as a negative number (decimal `{$negative_val}`), consider using the type `{$uint_ty}` for the literal and cast it to `{$int_ty}`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_62, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    OverflowingBinHexSignBitSub::AsCast {
                        span: __binding_0,
                        lit_no_suffix: __binding_1,
                        negative_val: __binding_2,
                        uint_ty: __binding_3,
                        int_ty: __binding_4 } => {
                        let __code_63 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}{2} as {0}",
                                                        __binding_4, __binding_1, __binding_3))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("negative_val".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("uint_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("int_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to use as a negative number (decimal `{$negative_val}`), consider using the type `{$uint_ty}` for the literal and cast it to `{$int_ty}`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_63, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
2210pub(crate) enum OverflowingBinHexSignBitSub<'a> {
2211    #[suggestion(
2212        "to use as a negative number (decimal `{$negative_val}`), consider using the type `{$uint_ty}` for the literal and cast it to `{$int_ty}`",
2213        code = "{lit_no_suffix}{uint_ty}.cast_signed()",
2214        applicability = "maybe-incorrect"
2215    )]
2216    CastSigned {
2217        #[primary_span]
2218        span: Span,
2219        lit_no_suffix: &'a str,
2220        negative_val: String,
2221        uint_ty: &'a str,
2222        int_ty: &'a str,
2223    },
2224    #[suggestion(
2225        "to use as a negative number (decimal `{$negative_val}`), consider using the type `{$uint_ty}` for the literal and cast it to `{$int_ty}`",
2226        code = "{lit_no_suffix}{uint_ty} as {int_ty}",
2227        applicability = "maybe-incorrect"
2228    )]
2229    AsCast {
2230        #[primary_span]
2231        span: Span,
2232        lit_no_suffix: &'a str,
2233        negative_val: String,
2234        uint_ty: &'a str,
2235        int_ty: &'a str,
2236    },
2237}
2238
2239#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverflowingInt<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverflowingInt {
                        ty: __binding_0,
                        lit: __binding_1,
                        min: __binding_2,
                        max: __binding_3,
                        help: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literal out of range for `{$ty}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag.arg("lit", __binding_1);
                        diag.arg("min", __binding_2);
                        diag.arg("max", __binding_3);
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2240#[diag("literal out of range for `{$ty}`")]
2241#[note("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")]
2242pub(crate) struct OverflowingInt<'a> {
2243    pub ty: &'a str,
2244    pub lit: String,
2245    pub min: i128,
2246    pub max: u128,
2247    #[subdiagnostic]
2248    pub help: Option<OverflowingIntHelp<'a>>,
2249}
2250
2251#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OverflowingIntHelp<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    OverflowingIntHelp { suggestion_ty: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("suggestion_ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2252#[help("consider using the type `{$suggestion_ty}` instead")]
2253pub(crate) struct OverflowingIntHelp<'a> {
2254    pub suggestion_ty: &'a str,
2255}
2256
2257#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for OnlyCastu8ToChar {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OnlyCastu8ToChar { span: __binding_0, literal: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `u8` can be cast into `char`")));
                        let __code_64 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\'\\u{{{0:X}}}\'",
                                                        __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a `char` literal instead")),
                            __code_64, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2258#[diag("only `u8` can be cast into `char`")]
2259pub(crate) struct OnlyCastu8ToChar {
2260    #[suggestion(
2261        "use a `char` literal instead",
2262        code = "'\\u{{{literal:X}}}'",
2263        applicability = "machine-applicable"
2264    )]
2265    pub span: Span,
2266    pub literal: u128,
2267}
2268
2269#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverflowingUInt<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverflowingUInt {
                        ty: __binding_0,
                        lit: __binding_1,
                        min: __binding_2,
                        max: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literal out of range for `{$ty}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag.arg("lit", __binding_1);
                        diag.arg("min", __binding_2);
                        diag.arg("max", __binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2270#[diag("literal out of range for `{$ty}`")]
2271#[note("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")]
2272pub(crate) struct OverflowingUInt<'a> {
2273    pub ty: &'a str,
2274    pub lit: String,
2275    pub min: u128,
2276    pub max: u128,
2277}
2278
2279#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OverflowingLiteral<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OverflowingLiteral { ty: __binding_0, lit: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literal out of range for `{$ty}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal `{$lit}` does not fit into the type `{$ty}` and will be converted to `{$ty}::INFINITY`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag.arg("lit", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2280#[diag("literal out of range for `{$ty}`")]
2281#[note(
2282    "the literal `{$lit}` does not fit into the type `{$ty}` and will be converted to `{$ty}::INFINITY`"
2283)]
2284pub(crate) struct OverflowingLiteral<'a> {
2285    pub ty: &'a str,
2286    pub lit: String,
2287}
2288
2289#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for SurrogateCharCast {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SurrogateCharCast { literal: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("surrogate values are not valid for `char`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`0xD800..=0xDFFF` are reserved for Unicode surrogates and are not valid `char` values")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2290#[diag("surrogate values are not valid for `char`")]
2291#[note("`0xD800..=0xDFFF` are reserved for Unicode surrogates and are not valid `char` values")]
2292pub(crate) struct SurrogateCharCast {
2293    pub literal: u128,
2294}
2295
2296#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TooLargeCharCast {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TooLargeCharCast { literal: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value exceeds maximum `char` value")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maximum valid `char` value is `0x10FFFF`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2297#[diag("value exceeds maximum `char` value")]
2298#[note("maximum valid `char` value is `0x10FFFF`")]
2299pub(crate) struct TooLargeCharCast {
2300    pub literal: u128,
2301}
2302
2303#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UsesPowerAlignment {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UsesPowerAlignment => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2304#[diag(
2305    "repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type"
2306)]
2307pub(crate) struct UsesPowerAlignment;
2308
2309#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedComparisons {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedComparisons => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("comparison is useless due to type limits")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2310#[diag("comparison is useless due to type limits")]
2311pub(crate) struct UnusedComparisons;
2312
2313#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidNanComparisons {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidNanComparisons::EqNe { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect NaN comparison, NaN cannot be directly compared to itself")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                    InvalidNanComparisons::LtLeGtGe => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect NaN comparison, NaN is not orderable")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2314pub(crate) enum InvalidNanComparisons {
2315    #[diag("incorrect NaN comparison, NaN cannot be directly compared to itself")]
2316    EqNe {
2317        #[subdiagnostic]
2318        suggestion: InvalidNanComparisonsSuggestion,
2319    },
2320    #[diag("incorrect NaN comparison, NaN is not orderable")]
2321    LtLeGtGe,
2322}
2323
2324#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidNanComparisonsSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidNanComparisonsSuggestion::Ufcs {
                        prefix: __binding_0,
                        prefix_span: __binding_1,
                        suffix: __binding_2,
                        close_span: __binding_3,
                        remove_nan: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_65 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_0))
                                });
                        let __code_66 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                });
                        let __code_67 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_1, __code_65));
                        suggestions.push((__binding_3, __code_66));
                        suggestions.push((__binding_4, __code_67));
                        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 `is_nan` method instead")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    InvalidNanComparisonsSuggestion::Spanless => {
                        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 `is_nan` method instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2325pub(crate) enum InvalidNanComparisonsSuggestion {
2326    #[multipart_suggestion(
2327        "use the `is_nan` method instead",
2328        style = "verbose",
2329        applicability = "machine-applicable"
2330    )]
2331    Ufcs {
2332        prefix: String,
2333        #[suggestion_part(code = "{prefix}")]
2334        prefix_span: Span,
2335        suffix: &'static str,
2336        #[suggestion_part(code = "{suffix}")]
2337        close_span: Span,
2338        #[suggestion_part(code = "")]
2339        remove_nan: Span,
2340    },
2341    #[help("use the `is_nan` method instead")]
2342    Spanless,
2343}
2344
2345#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            AmbiguousWidePointerComparisons<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AmbiguousWidePointerComparisons::SpanfulEq {
                        addr_suggestion: __binding_0,
                        addr_metadata_suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous wide pointer comparison, the comparison includes metadata which may not be expected")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                    AmbiguousWidePointerComparisons::SpanfulCmp {
                        cast_suggestion: __binding_0, expect_suggestion: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous wide pointer comparison, the comparison includes metadata which may not be expected")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                    AmbiguousWidePointerComparisons::Spanless {
                        krate: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous wide pointer comparison, the comparison includes metadata which may not be expected")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use explicit `{$krate}::ptr::eq` method to compare metadata and addresses")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses")));
                        ;
                        diag.arg("krate", __binding_0);
                        diag
                    }
                    AmbiguousWidePointerComparisons::Warn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous wide pointer comparison, the comparison includes metadata which may not be expected")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2346pub(crate) enum AmbiguousWidePointerComparisons<'a> {
2347    #[diag(
2348        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2349    )]
2350    SpanfulEq {
2351        #[subdiagnostic]
2352        addr_suggestion: AmbiguousWidePointerComparisonsAddrSuggestion<'a>,
2353        #[subdiagnostic]
2354        addr_metadata_suggestion: Option<AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a>>,
2355    },
2356    #[diag(
2357        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2358    )]
2359    SpanfulCmp {
2360        #[subdiagnostic]
2361        cast_suggestion: AmbiguousWidePointerComparisonsCastSuggestion<'a>,
2362        #[subdiagnostic]
2363        expect_suggestion: AmbiguousWidePointerComparisonsExpectSuggestion<'a>,
2364    },
2365    #[diag(
2366        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2367    )]
2368    #[help("use explicit `{$krate}::ptr::eq` method to compare metadata and addresses")]
2369    #[help("use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses")]
2370    Spanless { krate: &'static str },
2371    #[diag(
2372        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2373    )]
2374    Warn,
2375}
2376
2377#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousWidePointerComparisonsAddrMetadataSuggestion {
                        krate: __binding_0,
                        ne: __binding_1,
                        deref_left: __binding_2,
                        deref_right: __binding_3,
                        l_modifiers: __binding_4,
                        r_modifiers: __binding_5,
                        left: __binding_6,
                        middle: __binding_7,
                        right: __binding_8 } => {
                        let mut suggestions = Vec::new();
                        let __code_68 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{2}{1}::ptr::eq({0}",
                                            __binding_2, __binding_0, __binding_1))
                                });
                        let __code_69 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}, {0}", __binding_3,
                                            __binding_4))
                                });
                        let __code_70 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0})", __binding_5))
                                });
                        suggestions.push((__binding_6, __code_68));
                        suggestions.push((__binding_7, __code_69));
                        suggestions.push((__binding_8, __code_70));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use explicit `{$krate}::ptr::eq` method to compare metadata and addresses")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2378#[multipart_suggestion(
2379    "use explicit `{$krate}::ptr::eq` method to compare metadata and addresses",
2380    style = "verbose",
2381    // FIXME(#53934): make machine-applicable again
2382    applicability = "maybe-incorrect"
2383)]
2384pub(crate) struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> {
2385    pub krate: &'static str,
2386    pub ne: &'a str,
2387    pub deref_left: &'a str,
2388    pub deref_right: &'a str,
2389    pub l_modifiers: &'a str,
2390    pub r_modifiers: &'a str,
2391    #[suggestion_part(code = "{ne}{krate}::ptr::eq({deref_left}")]
2392    pub left: Span,
2393    #[suggestion_part(code = "{l_modifiers}, {deref_right}")]
2394    pub middle: Span,
2395    #[suggestion_part(code = "{r_modifiers})")]
2396    pub right: Span,
2397}
2398
2399#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AmbiguousWidePointerComparisonsAddrSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousWidePointerComparisonsAddrSuggestion {
                        krate: __binding_0,
                        ne: __binding_1,
                        deref_left: __binding_2,
                        deref_right: __binding_3,
                        l_modifiers: __binding_4,
                        r_modifiers: __binding_5,
                        left: __binding_6,
                        middle: __binding_7,
                        right: __binding_8 } => {
                        let mut suggestions = Vec::new();
                        let __code_71 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{2}{1}::ptr::addr_eq({0}",
                                            __binding_2, __binding_0, __binding_1))
                                });
                        let __code_72 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}, {0}", __binding_3,
                                            __binding_4))
                                });
                        let __code_73 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0})", __binding_5))
                                });
                        suggestions.push((__binding_6, __code_71));
                        suggestions.push((__binding_7, __code_72));
                        suggestions.push((__binding_8, __code_73));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2400#[multipart_suggestion(
2401    "use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses",
2402    style = "verbose",
2403    // FIXME(#53934): make machine-applicable again
2404    applicability = "maybe-incorrect"
2405)]
2406pub(crate) struct AmbiguousWidePointerComparisonsAddrSuggestion<'a> {
2407    pub(crate) krate: &'static str,
2408    pub(crate) ne: &'a str,
2409    pub(crate) deref_left: &'a str,
2410    pub(crate) deref_right: &'a str,
2411    pub(crate) l_modifiers: &'a str,
2412    pub(crate) r_modifiers: &'a str,
2413    #[suggestion_part(code = "{ne}{krate}::ptr::addr_eq({deref_left}")]
2414    pub(crate) left: Span,
2415    #[suggestion_part(code = "{l_modifiers}, {deref_right}")]
2416    pub(crate) middle: Span,
2417    #[suggestion_part(code = "{r_modifiers})")]
2418    pub(crate) right: Span,
2419}
2420
2421#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AmbiguousWidePointerComparisonsCastSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousWidePointerComparisonsCastSuggestion {
                        deref_left: __binding_0,
                        deref_right: __binding_1,
                        paren_left: __binding_2,
                        paren_right: __binding_3,
                        l_modifiers: __binding_4,
                        r_modifiers: __binding_5,
                        left_before: __binding_6,
                        left_after: __binding_7,
                        right_before: __binding_8,
                        right_after: __binding_9 } => {
                        let mut suggestions = Vec::new();
                        let __code_74 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("({0}", __binding_0))
                                });
                        let __code_75 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}{1}.cast::<()>()",
                                            __binding_4, __binding_2))
                                });
                        let __code_76 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("({0}", __binding_1))
                                });
                        let __code_77 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}{0}.cast::<()>()",
                                            __binding_3, __binding_5))
                                });
                        if let Some(__binding_6) = __binding_6 {
                            suggestions.push((__binding_6, __code_74));
                        }
                        suggestions.push((__binding_7, __code_75));
                        if let Some(__binding_8) = __binding_8 {
                            suggestions.push((__binding_8, __code_76));
                        }
                        suggestions.push((__binding_9, __code_77));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use untyped pointers to only compare their addresses")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2422#[multipart_suggestion(
2423    "use untyped pointers to only compare their addresses",
2424    style = "verbose",
2425    // FIXME(#53934): make machine-applicable again
2426    applicability = "maybe-incorrect"
2427)]
2428pub(crate) struct AmbiguousWidePointerComparisonsCastSuggestion<'a> {
2429    pub(crate) deref_left: &'a str,
2430    pub(crate) deref_right: &'a str,
2431    pub(crate) paren_left: &'a str,
2432    pub(crate) paren_right: &'a str,
2433    pub(crate) l_modifiers: &'a str,
2434    pub(crate) r_modifiers: &'a str,
2435    #[suggestion_part(code = "({deref_left}")]
2436    pub(crate) left_before: Option<Span>,
2437    #[suggestion_part(code = "{l_modifiers}{paren_left}.cast::<()>()")]
2438    pub(crate) left_after: Span,
2439    #[suggestion_part(code = "({deref_right}")]
2440    pub(crate) right_before: Option<Span>,
2441    #[suggestion_part(code = "{r_modifiers}{paren_right}.cast::<()>()")]
2442    pub(crate) right_after: Span,
2443}
2444
2445#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AmbiguousWidePointerComparisonsExpectSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AmbiguousWidePointerComparisonsExpectSuggestion {
                        paren_left: __binding_0,
                        paren_right: __binding_1,
                        before: __binding_2,
                        after: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_78 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{{ #[expect(ambiguous_wide_pointer_comparisons, reason = \"...\")] {0}",
                                            __binding_0))
                                });
                        let __code_79 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0} }}", __binding_1))
                                });
                        suggestions.push((__binding_2, __code_78));
                        suggestions.push((__binding_3, __code_79));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or expect the lint to compare the pointers metadata and addresses")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2446#[multipart_suggestion(
2447    "or expect the lint to compare the pointers metadata and addresses",
2448    style = "verbose",
2449    // FIXME(#53934): make machine-applicable again
2450    applicability = "maybe-incorrect"
2451)]
2452pub(crate) struct AmbiguousWidePointerComparisonsExpectSuggestion<'a> {
2453    pub(crate) paren_left: &'a str,
2454    pub(crate) paren_right: &'a str,
2455    // FIXME(#127436): Adjust once resolved
2456    #[suggestion_part(
2457        code = r#"{{ #[expect(ambiguous_wide_pointer_comparisons, reason = "...")] {paren_left}"#
2458    )]
2459    pub(crate) before: Span,
2460    #[suggestion_part(code = "{paren_right} }}")]
2461    pub(crate) after: Span,
2462}
2463
2464#[derive(const _: () =
    {
        impl<'_sess, 'a, 'tcx> rustc_errors::Diagnostic<'_sess> for
            UnpredictableFunctionPointerComparisons<'a, 'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnpredictableFunctionPointerComparisons::Suggestion {
                        sugg: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the address of the same function can vary between different codegen units")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("furthermore, different functions could have the same address after being merged together")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                    UnpredictableFunctionPointerComparisons::Warn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the address of the same function can vary between different codegen units")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("furthermore, different functions could have the same address after being merged together")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2465pub(crate) enum UnpredictableFunctionPointerComparisons<'a, 'tcx> {
2466    #[diag(
2467        "function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique"
2468    )]
2469    #[note("the address of the same function can vary between different codegen units")]
2470    #[note(
2471        "furthermore, different functions could have the same address after being merged together"
2472    )]
2473    #[note(
2474        "for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>"
2475    )]
2476    Suggestion {
2477        #[subdiagnostic]
2478        sugg: UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx>,
2479    },
2480    #[diag(
2481        "function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique"
2482    )]
2483    #[note("the address of the same function can vary between different codegen units")]
2484    #[note(
2485        "furthermore, different functions could have the same address after being merged together"
2486    )]
2487    #[note(
2488        "for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>"
2489    )]
2490    Warn,
2491}
2492
2493#[derive(const _: () =
    {
        impl<'a, 'tcx> rustc_errors::Subdiagnostic for
            UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnpredictableFunctionPointerComparisonsSuggestion::FnAddrEq {
                        krate: __binding_0,
                        ne: __binding_1,
                        deref_left: __binding_2,
                        deref_right: __binding_3,
                        left: __binding_4,
                        middle: __binding_5,
                        right: __binding_6 } => {
                        let mut suggestions = Vec::new();
                        let __code_80 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{2}{1}::ptr::fn_addr_eq({0}",
                                            __binding_2, __binding_0, __binding_1))
                                });
                        let __code_81 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(", {0}", __binding_3))
                                });
                        let __code_82 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_4, __code_80));
                        suggestions.push((__binding_5, __code_81));
                        suggestions.push((__binding_6, __code_82));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".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("refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    UnpredictableFunctionPointerComparisonsSuggestion::FnAddrEqWithCast {
                        krate: __binding_0,
                        ne: __binding_1,
                        deref_left: __binding_2,
                        deref_right: __binding_3,
                        fn_sig: __binding_4,
                        left: __binding_5,
                        middle: __binding_6,
                        right: __binding_7 } => {
                        let mut suggestions = Vec::new();
                        let __code_83 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{2}{1}::ptr::fn_addr_eq({0}",
                                            __binding_2, __binding_0, __binding_1))
                                });
                        let __code_84 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(", {0}", __binding_3))
                                });
                        let __code_85 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" as {0})", __binding_4))
                                });
                        suggestions.push((__binding_5, __code_83));
                        suggestions.push((__binding_6, __code_84));
                        suggestions.push((__binding_7, __code_85));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("krate".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("refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2494pub(crate) enum UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx> {
2495    #[multipart_suggestion(
2496        "refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint",
2497        style = "verbose",
2498        applicability = "maybe-incorrect"
2499    )]
2500    FnAddrEq {
2501        krate: &'static str,
2502        ne: &'a str,
2503        deref_left: &'a str,
2504        deref_right: &'a str,
2505        #[suggestion_part(code = "{ne}{krate}::ptr::fn_addr_eq({deref_left}")]
2506        left: Span,
2507        #[suggestion_part(code = ", {deref_right}")]
2508        middle: Span,
2509        #[suggestion_part(code = ")")]
2510        right: Span,
2511    },
2512    #[multipart_suggestion(
2513        "refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint",
2514        style = "verbose",
2515        applicability = "maybe-incorrect"
2516    )]
2517    FnAddrEqWithCast {
2518        krate: &'static str,
2519        ne: &'a str,
2520        deref_left: &'a str,
2521        deref_right: &'a str,
2522        fn_sig: rustc_middle::ty::PolyFnSig<'tcx>,
2523        #[suggestion_part(code = "{ne}{krate}::ptr::fn_addr_eq({deref_left}")]
2524        left: Span,
2525        #[suggestion_part(code = ", {deref_right}")]
2526        middle: Span,
2527        #[suggestion_part(code = " as {fn_sig})")]
2528        right: Span,
2529    },
2530}
2531
2532pub(crate) struct ImproperCTypes<'a> {
2533    pub ty: Ty<'a>,
2534    pub desc: &'a str,
2535    pub label: Span,
2536    pub help: Option<DiagMessage>,
2537    pub note: DiagMessage,
2538    pub span_note: Option<Span>,
2539}
2540
2541// Used because of the complexity of Option<DiagMessage>, DiagMessage, and Option<Span>
2542impl<'a> Diagnostic<'a> for ImproperCTypes<'_> {
2543    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2544        let mut diag = Diag::new(
2545            dcx,
2546            level,
2547            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` {$desc} uses type `{$ty}`, which is not FFI-safe"))msg!("`extern` {$desc} uses type `{$ty}`, which is not FFI-safe"),
2548        )
2549        .with_arg("ty", self.ty)
2550        .with_arg("desc", self.desc)
2551        .with_span_label(self.label, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not FFI-safe"))msg!("not FFI-safe"));
2552        if let Some(help) = self.help {
2553            diag.help(help);
2554        }
2555        diag.note(self.note);
2556        if let Some(note) = self.span_note {
2557            diag.span_note(note, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type is defined here"))msg!("the type is defined here"));
2558        }
2559        diag
2560    }
2561}
2562
2563#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ImproperGpuKernelArg<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImproperGpuKernelArg { ty: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("passing type `{$ty}` to a function with \"gpu-kernel\" ABI may have unexpected behavior")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use primitive types and raw pointers to get reliable behavior")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2564#[diag("passing type `{$ty}` to a function with \"gpu-kernel\" ABI may have unexpected behavior")]
2565#[help("use primitive types and raw pointers to get reliable behavior")]
2566pub(crate) struct ImproperGpuKernelArg<'a> {
2567    pub ty: Ty<'a>,
2568}
2569
2570#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingGpuKernelExportName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingGpuKernelExportName => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function with the \"gpu-kernel\" ABI has a mangled name")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `unsafe(no_mangle)` or `unsafe(export_name = \"<name>\")`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mangled names make it hard to find the kernel, this is usually not intended")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2571#[diag("function with the \"gpu-kernel\" ABI has a mangled name")]
2572#[help("use `unsafe(no_mangle)` or `unsafe(export_name = \"<name>\")`")]
2573#[note("mangled names make it hard to find the kernel, this is usually not intended")]
2574pub(crate) struct MissingGpuKernelExportName;
2575
2576#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            VariantSizeDifferencesDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    VariantSizeDifferencesDiag { largest: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enum variant is more than three times larger ({$largest} bytes) than the next largest")));
                        ;
                        diag.arg("largest", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2577#[diag("enum variant is more than three times larger ({$largest} bytes) than the next largest")]
2578pub(crate) struct VariantSizeDifferencesDiag {
2579    pub largest: u64,
2580}
2581
2582#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AtomicOrderingLoad {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AtomicOrderingLoad => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("atomic loads cannot have `Release` or `AcqRel` ordering")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2583#[diag("atomic loads cannot have `Release` or `AcqRel` ordering")]
2584#[help("consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`")]
2585pub(crate) struct AtomicOrderingLoad;
2586
2587#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AtomicOrderingStore
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AtomicOrderingStore => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("atomic stores cannot have `Acquire` or `AcqRel` ordering")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using ordering modes `Release`, `SeqCst` or `Relaxed`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2588#[diag("atomic stores cannot have `Acquire` or `AcqRel` ordering")]
2589#[help("consider using ordering modes `Release`, `SeqCst` or `Relaxed`")]
2590pub(crate) struct AtomicOrderingStore;
2591
2592#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AtomicOrderingFence
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AtomicOrderingFence => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("memory fences cannot have `Relaxed` ordering")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2593#[diag("memory fences cannot have `Relaxed` ordering")]
2594#[help("consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst`")]
2595pub(crate) struct AtomicOrderingFence;
2596
2597#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAtomicOrderingDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAtomicOrderingDiag {
                        method: __binding_0, fail_order_arg_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$method}`'s failure ordering may not be `Release` or `AcqRel`, since a failed `{$method}` does not result in a write")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `Acquire` or `Relaxed` failure ordering instead")));
                        ;
                        diag.arg("method", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid failure ordering")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2598#[diag(
2599    "`{$method}`'s failure ordering may not be `Release` or `AcqRel`, since a failed `{$method}` does not result in a write"
2600)]
2601#[help("consider using `Acquire` or `Relaxed` failure ordering instead")]
2602pub(crate) struct InvalidAtomicOrderingDiag {
2603    pub method: Symbol,
2604    #[label("invalid failure ordering")]
2605    pub fail_order_arg_span: Span,
2606}
2607
2608// unused.rs
2609#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for UnusedOp<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedOp {
                        op: __binding_0, label: __binding_1, suggestion: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused {$op} that must be used")));
                        ;
                        diag.arg("op", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$op} produces a value")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2610#[diag("unused {$op} that must be used")]
2611pub(crate) struct UnusedOp<'a> {
2612    pub op: &'a str,
2613    #[label("the {$op} produces a value")]
2614    pub label: Span,
2615    #[subdiagnostic]
2616    pub suggestion: UnusedOpSuggestion,
2617}
2618
2619#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedOpSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnusedOpSuggestion::NormalExpr { span: __binding_0 } => {
                        let __code_86 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let _ = "))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _ = ...` to ignore the value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_86, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    UnusedOpSuggestion::BlockTailExpr {
                        before_span: __binding_0, after_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_87 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_88 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(";"))
                                });
                        suggestions.push((__binding_0, __code_87));
                        suggestions.push((__binding_1, __code_88));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _ = ...` to ignore the value")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2620pub(crate) enum UnusedOpSuggestion {
2621    #[suggestion(
2622        "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value",
2623        style = "verbose",
2624        code = "let _ = ",
2625        applicability = "maybe-incorrect"
2626    )]
2627    NormalExpr {
2628        #[primary_span]
2629        span: Span,
2630    },
2631    #[multipart_suggestion(
2632        "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value",
2633        style = "verbose",
2634        applicability = "maybe-incorrect"
2635    )]
2636    BlockTailExpr {
2637        #[suggestion_part(code = "let _ = ")]
2638        before_span: Span,
2639        #[suggestion_part(code = ";")]
2640        after_span: Span,
2641    },
2642}
2643
2644#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for UnusedResult<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedResult { ty: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused result of type `{$ty}`")));
                        ;
                        diag.arg("ty", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2645#[diag("unused result of type `{$ty}`")]
2646pub(crate) struct UnusedResult<'a> {
2647    pub ty: Ty<'a>,
2648}
2649
2650// FIXME(davidtwco): this isn't properly translatable because of the
2651// pre/post strings
2652#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UnusedClosure<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedClosure {
                        count: __binding_0, pre: __binding_1, post: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused {$pre}{$count ->\n        [one] closure\n        *[other] closures\n    }{$post} that must be used")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closures are lazy and do nothing unless called")));
                        ;
                        diag.arg("count", __binding_0);
                        diag.arg("pre", __binding_1);
                        diag.arg("post", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2653#[diag(
2654    "unused {$pre}{$count ->
2655        [one] closure
2656        *[other] closures
2657    }{$post} that must be used"
2658)]
2659#[note("closures are lazy and do nothing unless called")]
2660pub(crate) struct UnusedClosure<'a> {
2661    pub count: usize,
2662    pub pre: &'a str,
2663    pub post: &'a str,
2664}
2665
2666// FIXME(davidtwco): this isn't properly translatable because of the
2667// pre/post strings
2668#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UnusedCoroutine<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedCoroutine {
                        count: __binding_0, pre: __binding_1, post: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused {$pre}{$count ->\n        [one] coroutine\n        *[other] coroutine\n    }{$post} that must be used")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("coroutines are lazy and do nothing unless resumed")));
                        ;
                        diag.arg("count", __binding_0);
                        diag.arg("pre", __binding_1);
                        diag.arg("post", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2669#[diag(
2670    "unused {$pre}{$count ->
2671        [one] coroutine
2672        *[other] coroutine
2673    }{$post} that must be used"
2674)]
2675#[note("coroutines are lazy and do nothing unless resumed")]
2676pub(crate) struct UnusedCoroutine<'a> {
2677    pub count: usize,
2678    pub pre: &'a str,
2679    pub post: &'a str,
2680}
2681
2682// FIXME(davidtwco): this isn't properly translatable because of the pre/post
2683// strings
2684pub(crate) struct UnusedDef<'a, 'b> {
2685    pub pre: &'a str,
2686    pub post: &'a str,
2687    pub cx: &'a LateContext<'b>,
2688    pub def_id: DefId,
2689    pub note: Option<Symbol>,
2690    pub suggestion: Option<UnusedDefSuggestion>,
2691}
2692
2693#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedDefSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnusedDefSuggestion::NormalExpr { span: __binding_0 } => {
                        let __code_89 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let _ = "))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _ = ...` to ignore the value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_89, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    UnusedDefSuggestion::BlockTailExpr {
                        before_span: __binding_0, after_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_90 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_91 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(";"))
                                });
                        suggestions.push((__binding_0, __code_90));
                        suggestions.push((__binding_1, __code_91));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _ = ...` to ignore the value")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    UnusedDefSuggestion::BindingExpr { span: __binding_0 } => {
                        let __code_92 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let _unused = "))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_92, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    UnusedDefSuggestion::BindingBlockTailExpr {
                        before_span: __binding_0, after_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_93 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _unused = "))
                                });
                        let __code_94 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(";"))
                                });
                        suggestions.push((__binding_0, __code_93));
                        suggestions.push((__binding_1, __code_94));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2694pub(crate) enum UnusedDefSuggestion {
2695    #[suggestion(
2696        "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value",
2697        style = "verbose",
2698        code = "let _ = ",
2699        applicability = "maybe-incorrect"
2700    )]
2701    NormalExpr {
2702        #[primary_span]
2703        span: Span,
2704    },
2705    #[multipart_suggestion(
2706        "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value",
2707        style = "verbose",
2708        applicability = "maybe-incorrect"
2709    )]
2710    BlockTailExpr {
2711        #[suggestion_part(code = "let _ = ")]
2712        before_span: Span,
2713        #[suggestion_part(code = ";")]
2714        after_span: Span,
2715    },
2716    #[suggestion(
2717        "if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately",
2718        style = "verbose",
2719        code = "let _unused = ",
2720        applicability = "maybe-incorrect"
2721    )]
2722    BindingExpr {
2723        #[primary_span]
2724        span: Span,
2725    },
2726    #[multipart_suggestion(
2727        "if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately",
2728        style = "verbose",
2729        applicability = "maybe-incorrect"
2730    )]
2731    BindingBlockTailExpr {
2732        #[suggestion_part(code = "let _unused = ")]
2733        before_span: Span,
2734        #[suggestion_part(code = ";")]
2735        after_span: Span,
2736    },
2737}
2738
2739// Needed because of def_path_str
2740impl<'a> Diagnostic<'a> for UnusedDef<'_, '_> {
2741    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2742        let mut diag =
2743            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused {$pre}`{$def}`{$post} that must be used"))msg!("unused {$pre}`{$def}`{$post} that must be used"))
2744                .with_arg("pre", self.pre)
2745                .with_arg("post", self.post)
2746                .with_arg("def", self.cx.tcx.def_path_str(self.def_id));
2747        // check for #[must_use = "..."]
2748        if let Some(note) = self.note {
2749            diag.note(note.to_string());
2750        }
2751        if let Some(sugg) = self.suggestion {
2752            diag.subdiagnostic(sugg);
2753        }
2754        diag
2755    }
2756}
2757
2758#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for PathStatementDrop {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PathStatementDrop { sub: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("path statement drops value")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2759#[diag("path statement drops value")]
2760pub(crate) struct PathStatementDrop {
2761    #[subdiagnostic]
2762    pub sub: PathStatementDropSub,
2763}
2764
2765#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for PathStatementDropSub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    PathStatementDropSub::Suggestion {
                        span: __binding_0, snippet: __binding_1 } => {
                        let __code_95 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("drop({0});",
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `drop` to clarify the intent")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_95, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    PathStatementDropSub::Help { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `drop` to clarify the intent")),
                                &sub_args);
                        diag.span_help(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2766pub(crate) enum PathStatementDropSub {
2767    #[suggestion(
2768        "use `drop` to clarify the intent",
2769        code = "drop({snippet});",
2770        applicability = "machine-applicable"
2771    )]
2772    Suggestion {
2773        #[primary_span]
2774        span: Span,
2775        snippet: String,
2776    },
2777    #[help("use `drop` to clarify the intent")]
2778    Help {
2779        #[primary_span]
2780        span: Span,
2781    },
2782}
2783
2784#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            PathStatementNoEffect {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PathStatementNoEffect => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("path statement with no effect")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2785#[diag("path statement with no effect")]
2786pub(crate) struct PathStatementNoEffect;
2787
2788#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for UnusedDelim<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedDelim {
                        delim: __binding_0,
                        item: __binding_1,
                        suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary {$delim} around {$item}")));
                        ;
                        diag.arg("delim", __binding_0);
                        diag.arg("item", __binding_1);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2789#[diag("unnecessary {$delim} around {$item}")]
2790pub(crate) struct UnusedDelim<'a> {
2791    pub delim: &'static str,
2792    pub item: &'a str,
2793    #[subdiagnostic]
2794    pub suggestion: Option<UnusedDelimSuggestion>,
2795}
2796
2797#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedDelimSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnusedDelimSuggestion {
                        start_span: __binding_0,
                        start_replace: __binding_1,
                        end_span: __binding_2,
                        end_replace: __binding_3,
                        delim: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_96 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        let __code_97 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                });
                        suggestions.push((__binding_0, __code_96));
                        suggestions.push((__binding_2, __code_97));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("delim".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove these {$delim}")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
2798#[multipart_suggestion("remove these {$delim}", applicability = "machine-applicable")]
2799pub(crate) struct UnusedDelimSuggestion {
2800    #[suggestion_part(code = "{start_replace}")]
2801    pub start_span: Span,
2802    pub start_replace: &'static str,
2803    #[suggestion_part(code = "{end_replace}")]
2804    pub end_span: Span,
2805    pub end_replace: &'static str,
2806    pub delim: &'static str,
2807}
2808
2809#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnusedImportBracesDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedImportBracesDiag { node: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("braces around {$node} is unnecessary")));
                        ;
                        diag.arg("node", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2810#[diag("braces around {$node} is unnecessary")]
2811pub(crate) struct UnusedImportBracesDiag {
2812    pub node: Symbol,
2813}
2814
2815#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedAllocationDiag
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedAllocationDiag => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary allocation, use `&` instead")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2816#[diag("unnecessary allocation, use `&` instead")]
2817pub(crate) struct UnusedAllocationDiag;
2818
2819#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnusedAllocationMutDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedAllocationMutDiag => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary allocation, use `&mut` instead")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2820#[diag("unnecessary allocation, use `&mut` instead")]
2821pub(crate) struct UnusedAllocationMutDiag;
2822
2823pub(crate) struct AsyncFnInTraitDiag {
2824    pub sugg: Option<Vec<(Span, String)>>,
2825}
2826
2827impl<'a> Diagnostic<'a> for AsyncFnInTraitDiag {
2828    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2829        let mut diag = Diag::new(
2830            dcx,
2831            level,
2832            "use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified",
2833        );
2834        diag.note("you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`");
2835        if let Some(sugg) = self.sugg {
2836            diag.multipart_suggestion("you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change", sugg, Applicability::MaybeIncorrect);
2837        }
2838        diag
2839    }
2840}
2841
2842#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnitBindingsDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnitBindingsDiag { label: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("binding has unit type `()`")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this pattern is inferred to be the unit type `()`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2843#[diag("binding has unit type `()`")]
2844pub(crate) struct UnitBindingsDiag {
2845    #[label("this pattern is inferred to be the unit type `()`")]
2846    pub label: Span,
2847}
2848
2849#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAsmLabel {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAsmLabel::Named { missing_precise_span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("avoid using named labels in inline assembly")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only local labels of the form `<number>:` should be used in inline asm")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information")));
                        ;
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the label may be declared in the expansion of a macro")));
                        }
                        diag
                    }
                    InvalidAsmLabel::FormatArg {
                        missing_precise_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("avoid using named labels in inline assembly")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only local labels of the form `<number>:` should be used in inline asm")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("format arguments may expand to a non-numeric value")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information")));
                        ;
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the label may be declared in the expansion of a macro")));
                        }
                        diag
                    }
                    InvalidAsmLabel::Binary {
                        missing_precise_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("avoid using labels containing only the digits `0` and `1` in inline assembly")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("start numbering with `2` instead")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an LLVM bug makes these labels ambiguous with a binary literal number on x86")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://github.com/llvm/llvm-project/issues/99547> for more information")));
                        ;
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the label may be declared in the expansion of a macro")));
                        }
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a different label that doesn't start with `0` or `1`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2850pub(crate) enum InvalidAsmLabel {
2851    #[diag("avoid using named labels in inline assembly")]
2852    #[help("only local labels of the form `<number>:` should be used in inline asm")]
2853    #[note(
2854        "see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information"
2855    )]
2856    Named {
2857        #[note("the label may be declared in the expansion of a macro")]
2858        missing_precise_span: bool,
2859    },
2860    #[diag("avoid using named labels in inline assembly")]
2861    #[help("only local labels of the form `<number>:` should be used in inline asm")]
2862    #[note("format arguments may expand to a non-numeric value")]
2863    #[note(
2864        "see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information"
2865    )]
2866    FormatArg {
2867        #[note("the label may be declared in the expansion of a macro")]
2868        missing_precise_span: bool,
2869    },
2870    #[diag("avoid using labels containing only the digits `0` and `1` in inline assembly")]
2871    #[help("start numbering with `2` instead")]
2872    #[note("an LLVM bug makes these labels ambiguous with a binary literal number on x86")]
2873    #[note("see <https://github.com/llvm/llvm-project/issues/99547> for more information")]
2874    Binary {
2875        #[note("the label may be declared in the expansion of a macro")]
2876        missing_precise_span: bool,
2877        // hack to get a label on the whole span, must match the emitted span
2878        #[label("use a different label that doesn't start with `0` or `1`")]
2879        span: Span,
2880    },
2881}
2882
2883#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            RefOfMutStatic<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RefOfMutStatic {
                        span: __binding_0,
                        sugg: __binding_1,
                        shared_label: __binding_2,
                        shared_note: __binding_3,
                        mut_note: __binding_4,
                        interior_mutability_help: __binding_5,
                        interior_mutability_sugg: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("creating a {$shared_label}reference to mutable static")));
                        ;
                        diag.arg("shared_label", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$shared_label}reference to mutable static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        if __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives")));
                        }
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives")));
                        }
                        if __binding_5 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a type that relies on \"interior mutability\" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>")));
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2884#[diag("creating a {$shared_label}reference to mutable static")]
2885pub(crate) struct RefOfMutStatic<'a> {
2886    #[label("{$shared_label}reference to mutable static")]
2887    pub span: Span,
2888    #[subdiagnostic]
2889    pub sugg: Option<MutRefSugg>,
2890    pub shared_label: &'a str,
2891    #[note(
2892        "shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives"
2893    )]
2894    pub shared_note: bool,
2895    #[note(
2896        "mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives"
2897    )]
2898    pub mut_note: bool,
2899    #[help(
2900        "use a type that relies on \"interior mutability\" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>"
2901    )]
2902    pub interior_mutability_help: bool,
2903    #[subdiagnostic]
2904    pub interior_mutability_sugg: Option<StaticMutRefsInteriorMutabilitySugg>,
2905}
2906
2907#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MutRefSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    MutRefSugg::Shared { span: __binding_0 } => {
                        let mut suggestions = Vec::new();
                        let __code_98 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&raw const "))
                                });
                        suggestions.push((__binding_0, __code_98));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `&raw const` instead to create a raw pointer")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    MutRefSugg::Mut { span: __binding_0 } => {
                        let mut suggestions = Vec::new();
                        let __code_99 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&raw mut "))
                                });
                        suggestions.push((__binding_0, __code_99));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `&raw mut` instead to create a raw pointer")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2908pub(crate) enum MutRefSugg {
2909    #[multipart_suggestion(
2910        "use `&raw const` instead to create a raw pointer",
2911        style = "verbose",
2912        applicability = "maybe-incorrect"
2913    )]
2914    Shared {
2915        #[suggestion_part(code = "&raw const ")]
2916        span: Span,
2917    },
2918    #[multipart_suggestion(
2919        "use `&raw mut` instead to create a raw pointer",
2920        style = "verbose",
2921        applicability = "maybe-incorrect"
2922    )]
2923    Mut {
2924        #[suggestion_part(code = "&raw mut ")]
2925        span: Span,
2926    },
2927}
2928
2929#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            StaticMutRefsInteriorMutabilitySugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    StaticMutRefsInteriorMutabilitySugg { span: __binding_0 } =>
                        {
                        let __code_100 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this type already provides \"interior mutability\", so its binding doesn't need to be declared as mutable when borrowed with a shared reference")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_100, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2930#[suggestion(
2931    "this type already provides \"interior mutability\", so its binding doesn't need to be declared as mutable when borrowed with a shared reference",
2932    style = "verbose",
2933    applicability = "maybe-incorrect",
2934    code = ""
2935)]
2936pub(crate) struct StaticMutRefsInteriorMutabilitySugg {
2937    #[primary_span]
2938    pub span: Span,
2939}
2940
2941#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnqualifiedLocalImportsDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnqualifiedLocalImportsDiag => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`use` of a local item without leading `self::`, `super::`, or `crate::`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2942#[diag("`use` of a local item without leading `self::`, `super::`, or `crate::`")]
2943pub(crate) struct UnqualifiedLocalImportsDiag;
2944
2945#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            FunctionCastsAsIntegerDiag<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FunctionCastsAsIntegerDiag { sugg: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("direct cast of function item into an integer")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2946#[diag("direct cast of function item into an integer")]
2947pub(crate) struct FunctionCastsAsIntegerDiag<'tcx> {
2948    #[subdiagnostic]
2949    pub(crate) sugg: FunctionCastsAsIntegerSugg<'tcx>,
2950}
2951
2952#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for
            FunctionCastsAsIntegerSugg<'tcx> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    FunctionCastsAsIntegerSugg {
                        suggestion: __binding_0, cast_to_ty: __binding_1 } => {
                        let __code_101 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" as *const ()"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first cast to a pointer `as *const ()`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_101, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
2953#[suggestion(
2954    "first cast to a pointer `as *const ()`",
2955    code = " as *const ()",
2956    applicability = "machine-applicable",
2957    style = "verbose"
2958)]
2959pub(crate) struct FunctionCastsAsIntegerSugg<'tcx> {
2960    #[primary_span]
2961    pub suggestion: Span,
2962    pub cast_to_ty: Ty<'tcx>,
2963}
2964
2965#[derive(#[automatically_derived]impl ::core::fmt::Debug for MismatchedLifetimeSyntaxes
    {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "MismatchedLifetimeSyntaxes inputs outputs suggestions",
            &self.inputs, &self.outputs, &&self.suggestions)
    }
}Debug)]
2966pub(crate) struct MismatchedLifetimeSyntaxes {
2967    pub inputs: LifetimeSyntaxCategories<Vec<Span>>,
2968    pub outputs: LifetimeSyntaxCategories<Vec<Span>>,
2969
2970    pub suggestions: Vec<MismatchedLifetimeSyntaxesSuggestion>,
2971}
2972
2973impl<'a> Diagnostic<'a> for MismatchedLifetimeSyntaxes {
2974    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
2975        let counts = self.inputs.len() + self.outputs.len();
2976        let message = match counts {
2977            LifetimeSyntaxCategories { hidden: 0, elided: 0, named: 0 } => {
2978                {
    ::core::panicking::panic_fmt(format_args!("No lifetime mismatch detected"));
}panic!("No lifetime mismatch detected")
2979            }
2980
2981            LifetimeSyntaxCategories { hidden: _, elided: _, named: 0 } => {
2982                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("hiding a lifetime that's elided elsewhere is confusing"))msg!("hiding a lifetime that's elided elsewhere is confusing")
2983            }
2984
2985            LifetimeSyntaxCategories { hidden: _, elided: 0, named: _ } => {
2986                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("hiding a lifetime that's named elsewhere is confusing"))msg!("hiding a lifetime that's named elsewhere is confusing")
2987            }
2988
2989            LifetimeSyntaxCategories { hidden: 0, elided: _, named: _ } => {
2990                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("eliding a lifetime that's named elsewhere is confusing"))msg!("eliding a lifetime that's named elsewhere is confusing")
2991            }
2992
2993            LifetimeSyntaxCategories { hidden: _, elided: _, named: _ } => {
2994                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("hiding or eliding a lifetime that's named elsewhere is confusing"))msg!("hiding or eliding a lifetime that's named elsewhere is confusing")
2995            }
2996        };
2997        let mut diag = Diag::new(dcx, level, message);
2998
2999        for s in self.inputs.hidden {
3000            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is hidden here"))msg!("the lifetime is hidden here"));
3001        }
3002        for s in self.inputs.elided {
3003            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is elided here"))msg!("the lifetime is elided here"));
3004        }
3005        for s in self.inputs.named {
3006            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is named here"))msg!("the lifetime is named here"));
3007        }
3008
3009        let mut hidden_output_counts: FxIndexMap<Span, usize> = FxIndexMap::default();
3010        for s in self.outputs.hidden {
3011            *hidden_output_counts.entry(s).or_insert(0) += 1;
3012        }
3013        for (span, count) in hidden_output_counts {
3014            let label = rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same {$count ->\n                    [one] lifetime\n                    *[other] lifetimes\n                } {$count ->\n                    [one] is\n                    *[other] are\n                } hidden here"))msg!(
3015                "the same {$count ->
3016                    [one] lifetime
3017                    *[other] lifetimes
3018                } {$count ->
3019                    [one] is
3020                    *[other] are
3021                } hidden here"
3022            )
3023            .arg("count", count)
3024            .format();
3025            diag.span_label(span, label);
3026        }
3027        for s in self.outputs.elided {
3028            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same lifetime is elided here"))msg!("the same lifetime is elided here"));
3029        }
3030        for s in self.outputs.named {
3031            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same lifetime is named here"))msg!("the same lifetime is named here"));
3032        }
3033
3034        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same lifetime is referred to in inconsistent ways, making the signature confusing"))msg!(
3035            "the same lifetime is referred to in inconsistent ways, making the signature confusing"
3036        ));
3037
3038        let mut suggestions = self.suggestions.into_iter();
3039        if let Some(s) = suggestions.next() {
3040            diag.subdiagnostic(s);
3041
3042            for mut s in suggestions {
3043                s.make_optional_alternative();
3044                diag.subdiagnostic(s);
3045            }
3046        }
3047        diag
3048    }
3049}
3050
3051#[derive(#[automatically_derived]impl ::core::fmt::Debug for
    MismatchedLifetimeSyntaxesSuggestion {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Implicit {
                suggestions: __self_0, optional_alternative: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Implicit suggestions optional_alternative", __self_0,
                    &__self_1),
            Self::Mixed {
                implicit_suggestions: __self_0,
                explicit_anonymous_suggestions: __self_1,
                optional_alternative: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "Mixed implicit_suggestions explicit_anonymous_suggestions optional_alternative",
                    __self_0, __self_1, &__self_2),
            Self::Explicit {
                lifetime_name: __self_0,
                suggestions: __self_1,
                optional_alternative: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "Explicit lifetime_name suggestions optional_alternative",
                    __self_0, __self_1, &__self_2),
        }
    }
}Debug)]
3052pub(crate) enum MismatchedLifetimeSyntaxesSuggestion {
3053    Implicit {
3054        suggestions: Vec<Span>,
3055        optional_alternative: bool,
3056    },
3057
3058    Mixed {
3059        implicit_suggestions: Vec<Span>,
3060        explicit_anonymous_suggestions: Vec<(Span, String)>,
3061        optional_alternative: bool,
3062    },
3063
3064    Explicit {
3065        lifetime_name: String,
3066        suggestions: Vec<(Span, String)>,
3067        optional_alternative: bool,
3068    },
3069}
3070
3071impl MismatchedLifetimeSyntaxesSuggestion {
3072    fn make_optional_alternative(&mut self) {
3073        use MismatchedLifetimeSyntaxesSuggestion::*;
3074
3075        let optional_alternative = match self {
3076            Implicit { optional_alternative, .. }
3077            | Mixed { optional_alternative, .. }
3078            | Explicit { optional_alternative, .. } => optional_alternative,
3079        };
3080
3081        *optional_alternative = true;
3082    }
3083}
3084
3085impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
3086    fn add_to_diag(self, diag: &mut Diag<'_>) {
3087        use MismatchedLifetimeSyntaxesSuggestion::*;
3088
3089        let style = |optional_alternative| {
3090            if optional_alternative {
3091                SuggestionStyle::CompletelyHidden
3092            } else {
3093                SuggestionStyle::ShowAlways
3094            }
3095        };
3096
3097        let applicability = |optional_alternative| {
3098            // `cargo fix` can't handle more than one fix for the same issue,
3099            // so hide alternative suggestions from it by marking them as maybe-incorrect
3100            if optional_alternative {
3101                Applicability::MaybeIncorrect
3102            } else {
3103                Applicability::MachineApplicable
3104            }
3105        };
3106
3107        match self {
3108            Implicit { suggestions, optional_alternative } => {
3109                let suggestions = suggestions.into_iter().map(|s| (s, String::new())).collect();
3110                diag.multipart_suggestion_with_style(
3111                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the lifetime name from references"))msg!("remove the lifetime name from references"),
3112                    suggestions,
3113                    applicability(optional_alternative),
3114                    style(optional_alternative),
3115                );
3116            }
3117
3118            Mixed {
3119                implicit_suggestions,
3120                explicit_anonymous_suggestions,
3121                optional_alternative,
3122            } => {
3123                let message = if implicit_suggestions.is_empty() {
3124                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `'_` for type paths"))msg!("use `'_` for type paths")
3125                } else {
3126                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the lifetime name from references and use `'_` for type paths"))msg!("remove the lifetime name from references and use `'_` for type paths")
3127                };
3128
3129                let implicit_suggestions =
3130                    implicit_suggestions.into_iter().map(|s| (s, String::new()));
3131
3132                let suggestions =
3133                    implicit_suggestions.chain(explicit_anonymous_suggestions).collect();
3134
3135                diag.multipart_suggestion_with_style(
3136                    message,
3137                    suggestions,
3138                    applicability(optional_alternative),
3139                    style(optional_alternative),
3140                );
3141            }
3142
3143            Explicit { lifetime_name, suggestions, optional_alternative } => {
3144                let msg = rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consistently use `{$lifetime_name}`"))msg!("consistently use `{$lifetime_name}`")
3145                    .arg("lifetime_name", lifetime_name)
3146                    .format();
3147                diag.multipart_suggestion_with_style(
3148                    msg,
3149                    suggestions,
3150                    applicability(optional_alternative),
3151                    style(optional_alternative),
3152                );
3153            }
3154        }
3155    }
3156}
3157
3158#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            EqInternalMethodImplemented {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EqInternalMethodImplemented => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Eq::assert_receiver_is_total_eq` should never be implemented by hand")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this method was used to add checks to the `Eq` derive macro")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3159#[diag("`Eq::assert_receiver_is_total_eq` should never be implemented by hand")]
3160#[note("this method was used to add checks to the `Eq` derive macro")]
3161pub(crate) struct EqInternalMethodImplemented;
3162
3163#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            ImplicitProvenanceCastsInt2Ptr<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImplicitProvenanceCastsInt2Ptr {
                        expr_ty: __binding_0,
                        cast_ty: __binding_1,
                        sugg: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cast from `{$expr_ty}` to `{$cast_ty}` implicitly relies on exposed provenance")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if conforming to strict provenance is not possible, use `std::ptr::with_exposed_provenance()`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html#provenance>")));
                        ;
                        diag.arg("expr_ty", __binding_0);
                        diag.arg("cast_ty", __binding_1);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3164#[diag("cast from `{$expr_ty}` to `{$cast_ty}` implicitly relies on exposed provenance")]
3165#[help(
3166    "if conforming to strict provenance is not possible, use `std::ptr::with_exposed_provenance()`"
3167)]
3168#[note("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html#provenance>")]
3169pub(crate) struct ImplicitProvenanceCastsInt2Ptr<'tcx> {
3170    pub expr_ty: Ty<'tcx>,
3171    pub cast_ty: Ty<'tcx>,
3172    #[subdiagnostic]
3173    pub sugg: Option<Int2PtrSuggestion>,
3174}
3175
3176#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for Int2PtrSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    Int2PtrSuggestion { lo: __binding_0, hi: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_102 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("(...).with_addr("))
                                });
                        let __code_103 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_102));
                        suggestions.push((__binding_1, __code_103));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.with_addr()` to adjust the address of a valid pointer in the same allocation")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
3177#[multipart_suggestion(
3178    "use `.with_addr()` to adjust the address of a valid pointer in the same allocation",
3179    applicability = "has-placeholders"
3180)]
3181pub(crate) struct Int2PtrSuggestion {
3182    #[suggestion_part(code = "(...).with_addr(")]
3183    pub lo: Span,
3184    #[suggestion_part(code = ")")]
3185    pub hi: Span,
3186}
3187
3188#[derive(const _: () =
    {
        impl<'_sess, 'tcx> rustc_errors::Diagnostic<'_sess> for
            ImplicitProvenanceCastsPtr2Int<'tcx> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImplicitProvenanceCastsPtr2Int {
                        cast_from_ty: __binding_0,
                        cast_to_ty: __binding_1,
                        sugg: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cast from `{$cast_from_ty}` to `{$cast_to_ty}` implicitly exposes pointer provenance")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if conforming to strict provenance is not possible, use `.expose_provenance()`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html#provenance>")));
                        ;
                        diag.arg("cast_from_ty", __binding_0);
                        diag.arg("cast_to_ty", __binding_1);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3189#[diag("cast from `{$cast_from_ty}` to `{$cast_to_ty}` implicitly exposes pointer provenance")]
3190#[help("if conforming to strict provenance is not possible, use `.expose_provenance()`")]
3191#[note("for more information, visit <https://doc.rust-lang.org/std/ptr/index.html#provenance>")]
3192pub(crate) struct ImplicitProvenanceCastsPtr2Int<'tcx> {
3193    pub cast_from_ty: Ty<'tcx>,
3194    pub cast_to_ty: Ty<'tcx>,
3195    #[subdiagnostic]
3196    pub sugg: Option<Ptr2IntSuggestion<'tcx>>,
3197}
3198
3199#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for Ptr2IntSuggestion<'tcx> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    Ptr2IntSuggestion::NeedsParensCast {
                        expr_span: __binding_0,
                        cast_span: __binding_1,
                        cast_to_ty: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_104 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_105 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(").addr() as {0}",
                                            __binding_2))
                                });
                        suggestions.push((__binding_0, __code_104));
                        suggestions.push((__binding_1, __code_105));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.addr()` to obtain the address of a pointer")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    Ptr2IntSuggestion::NeedsParens {
                        expr_span: __binding_0, cast_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_106 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_107 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(").addr()"))
                                });
                        suggestions.push((__binding_0, __code_106));
                        suggestions.push((__binding_1, __code_107));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.addr()` to obtain the address of a pointer")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    Ptr2IntSuggestion::NeedsCast {
                        cast_span: __binding_0, cast_to_ty: __binding_1 } => {
                        let __code_108 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".addr() as {0}",
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.addr()` to obtain the address of a pointer")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_108, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    Ptr2IntSuggestion::Other { cast_span: __binding_0 } => {
                        let __code_109 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".addr()"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `.addr()` to obtain the address of a pointer")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_109, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
3200pub(crate) enum Ptr2IntSuggestion<'tcx> {
3201    #[multipart_suggestion(
3202        "use `.addr()` to obtain the address of a pointer",
3203        applicability = "maybe-incorrect"
3204    )]
3205    NeedsParensCast {
3206        #[suggestion_part(code = "(")]
3207        expr_span: Span,
3208        #[suggestion_part(code = ").addr() as {cast_to_ty}")]
3209        cast_span: Span,
3210        cast_to_ty: Ty<'tcx>,
3211    },
3212    #[multipart_suggestion(
3213        "use `.addr()` to obtain the address of a pointer",
3214        applicability = "maybe-incorrect"
3215    )]
3216    NeedsParens {
3217        #[suggestion_part(code = "(")]
3218        expr_span: Span,
3219        #[suggestion_part(code = ").addr()")]
3220        cast_span: Span,
3221    },
3222    #[suggestion(
3223        "use `.addr()` to obtain the address of a pointer",
3224        code = ".addr() as {cast_to_ty}",
3225        applicability = "maybe-incorrect"
3226    )]
3227    NeedsCast {
3228        #[primary_span]
3229        cast_span: Span,
3230        cast_to_ty: Ty<'tcx>,
3231    },
3232    #[suggestion(
3233        "use `.addr()` to obtain the address of a pointer",
3234        code = ".addr()",
3235        applicability = "maybe-incorrect"
3236    )]
3237    Other {
3238        #[primary_span]
3239        cast_span: Span,
3240    },
3241}
3242
3243#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            RawBorrowViaReference<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RawBorrowViaReference { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3244#[diag(
3245    "creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers"
3246)]
3247pub(crate) struct RawBorrowViaReference<'a> {
3248    #[subdiagnostic]
3249    pub suggestion: RawBorrowViaReferenceSuggestion<'a>,
3250}
3251
3252#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            RawBorrowViaReferenceSuggestion<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RawBorrowViaReferenceSuggestion::Spanful {
                        left: __binding_0, right: __binding_1, mutbl: __binding_2 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_110 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&raw {0} ", __binding_2))
                                });
                        let __code_111 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_110));
                        suggestions.push((__binding_1, __code_111));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("mutbl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `&raw {$mutbl}` for a safer and more explicit raw pointer")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    RawBorrowViaReferenceSuggestion::Spanless {
                        mutbl: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("mutbl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `&raw {$mutbl}` for a safer and more explicit raw pointer")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
3253pub(crate) enum RawBorrowViaReferenceSuggestion<'a> {
3254    #[multipart_suggestion(
3255        "consider using `&raw {$mutbl}` for a safer and more explicit raw pointer",
3256        applicability = "machine-applicable"
3257    )]
3258    Spanful {
3259        #[suggestion_part(code = "&raw {mutbl} ")]
3260        left: Span,
3261        #[suggestion_part(code = "")]
3262        right: Span,
3263        mutbl: &'a str,
3264    },
3265    #[help("consider using `&raw {$mutbl}` for a safer and more explicit raw pointer")]
3266    Spanless { mutbl: &'a str },
3267}
3268
3269#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingGenericTypeVisitableDeriveDiag {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingGenericTypeVisitableDeriveDiag => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `#[derive(GenericTypeVisitable)]` on a type which implements `TypeVisitable`")));
                        diag.note_once(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`GenericTypeVisitable` is rust-analyzer's version of `TypeVisitable`; it should be implemented whenever the latter is")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mark the type with `#[derive(GenericTypeVisitable)]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or, if `GenericTypeVisitable` is derived, check whether all fields implement `GenericTypeVisitable`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3270#[diag("missing `#[derive(GenericTypeVisitable)]` on a type which implements `TypeVisitable`")]
3271#[note_once(
3272    "`GenericTypeVisitable` is rust-analyzer's version of `TypeVisitable`; it should be implemented whenever the latter is"
3273)]
3274#[help("mark the type with `#[derive(GenericTypeVisitable)]`")]
3275#[help(
3276    "or, if `GenericTypeVisitable` is derived, check whether all fields implement `GenericTypeVisitable`"
3277)]
3278pub(crate) struct MissingGenericTypeVisitableDeriveDiag;
3279
3280#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnmarkedUncheckedTypeAlias {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnmarkedUncheckedTypeAlias {
                        sugg: __binding_0, padding: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unchecked type alias lacks attribute `#[rustc_unchecked_type_alias]`")));
                        let __code_112 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}#[rustc_unchecked_type_alias]\n",
                                                        __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("annotate the type alias with `#[rustc_unchecked_type_alias]`")),
                            __code_112, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3281#[diag("unchecked type alias lacks attribute `#[rustc_unchecked_type_alias]`")]
3282pub(crate) struct UnmarkedUncheckedTypeAlias {
3283    #[suggestion(
3284        "annotate the type alias with `#[rustc_unchecked_type_alias]`",
3285        code = "{padding}#[rustc_unchecked_type_alias]\n",
3286        applicability = "machine-applicable"
3287    )]
3288    pub sugg: Span,
3289    pub padding: String,
3290}