Skip to main content

rustc_lint/
lints.rs

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