Skip to main content

rustc_lint/
lints.rs

1// ignore-tidy-filelength
2
3use std::num::NonZero;
4
5use rustc_errors::codes::*;
6use rustc_errors::{
7    Applicability, Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic,
8    ElidedLifetimeInPathSubdiag, EmissionGuarantee, Level, MultiSpan, Subdiagnostic,
9    SuggestionStyle, msg,
10};
11use rustc_hir as hir;
12use rustc_hir::def_id::DefId;
13use rustc_hir::intravisit::VisitorExt;
14use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
15use rustc_middle::ty::inhabitedness::InhabitedPredicate;
16use rustc_middle::ty::{Clause, PolyExistentialTraitRef, Ty, TyCtxt};
17use rustc_session::Session;
18use rustc_span::edition::Edition;
19use rustc_span::{Ident, Span, Symbol, sym};
20
21use crate::LateContext;
22use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
23use crate::errors::{OverruledAttributeSub, RequestedLevel};
24use crate::lifetime_syntax::LifetimeSyntaxCategories;
25
26// array_into_iter.rs
27#[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)]
28#[diag(
29    "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}"
30)]
31pub(crate) struct ShadowedIntoIterDiag {
32    pub target: &'static str,
33    pub edition: &'static str,
34    #[suggestion(
35        "use `.iter()` instead of `.into_iter()` to avoid ambiguity",
36        code = "iter",
37        applicability = "machine-applicable"
38    )]
39    pub suggestion: Span,
40    #[subdiagnostic]
41    pub sub: Option<ShadowedIntoIterDiagSub>,
42}
43
44#[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();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or remove `.into_iter()` to iterate by value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_5, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    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));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
45pub(crate) enum ShadowedIntoIterDiagSub {
46    #[suggestion(
47        "or remove `.into_iter()` to iterate by value",
48        code = "",
49        applicability = "maybe-incorrect"
50    )]
51    RemoveIntoIter {
52        #[primary_span]
53        span: Span,
54    },
55    #[multipart_suggestion(
56        "or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value",
57        applicability = "maybe-incorrect"
58    )]
59    UseExplicitIntoIter {
60        #[suggestion_part(code = "IntoIterator::into_iter(")]
61        start_span: Span,
62        #[suggestion_part(code = ")")]
63        end_span: Span,
64    },
65}
66
67// autorefs.rs
68#[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)]
69#[diag("implicit autoref creates a reference to the dereference of a raw pointer")]
70#[note(
71    "creating a reference requires the pointer target to be valid and imposes aliasing requirements"
72)]
73pub(crate) struct ImplicitUnsafeAutorefsDiag<'a> {
74    #[label("this raw pointer has type `{$raw_ptr_ty}`")]
75    pub raw_ptr_span: Span,
76    pub raw_ptr_ty: Ty<'a>,
77    #[subdiagnostic]
78    pub origin: ImplicitUnsafeAutorefsOrigin<'a>,
79    #[subdiagnostic]
80    pub method: Option<ImplicitUnsafeAutorefsMethodNote>,
81    #[subdiagnostic]
82    pub suggestion: ImplicitUnsafeAutorefsSuggestion,
83}
84
85#[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 } => {
                        diag.store_args();
                        diag.arg("autoref_ty", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("autoref is being applied to this expression, resulting in: `{$autoref_ty}`")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                    ImplicitUnsafeAutorefsOrigin::OverloadedDeref => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
86pub(crate) enum ImplicitUnsafeAutorefsOrigin<'a> {
87    #[note("autoref is being applied to this expression, resulting in: `{$autoref_ty}`")]
88    Autoref {
89        #[primary_span]
90        autoref_span: Span,
91        autoref_ty: Ty<'a>,
92    },
93    #[note(
94        "references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations"
95    )]
96    OverloadedDeref,
97}
98
99#[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 } => {
                        diag.store_args();
                        diag.arg("method_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("method calls to `{$method_name}` require a reference")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
100#[note("method calls to `{$method_name}` require a reference")]
101pub(crate) struct ImplicitUnsafeAutorefsMethodNote {
102    #[primary_span]
103    pub def_span: Span,
104    pub method_name: Symbol,
105}
106
107#[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));
                        diag.store_args();
                        diag.arg("mutbl", __binding_0);
                        diag.arg("deref", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using a raw pointer method instead; or if this reference is intentional, make it explicit")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
108#[multipart_suggestion(
109    "try using a raw pointer method instead; or if this reference is intentional, make it explicit",
110    applicability = "maybe-incorrect"
111)]
112pub(crate) struct ImplicitUnsafeAutorefsSuggestion {
113    pub mutbl: &'static str,
114    pub deref: &'static str,
115    #[suggestion_part(code = "({mutbl}{deref}")]
116    pub start_span: Span,
117    #[suggestion_part(code = ")")]
118    pub end_span: Span,
119}
120
121// builtin.rs
122#[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.arg("replace", __binding_1);
                        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)]
123#[diag("denote infinite loops with `loop {\"{\"} ... {\"}\"}`")]
124pub(crate) struct BuiltinWhileTrue {
125    #[suggestion(
126        "use `loop`",
127        style = "short",
128        code = "{replace}",
129        applicability = "machine-applicable"
130    )]
131    pub suggestion: Span,
132    pub replace: String,
133}
134
135#[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.arg("prefix", __binding_2);
                        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)]
136#[diag("the `{$ident}:` in this pattern is redundant")]
137pub(crate) struct BuiltinNonShorthandFieldPatterns {
138    pub ident: Ident,
139    #[suggestion(
140        "use shorthand field pattern",
141        code = "{prefix}{ident}",
142        applicability = "machine-applicable"
143    )]
144    pub suggestion: Span,
145    pub prefix: &'static str,
146}
147
148#[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::NoMangleFn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a `no_mangle` function")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::ExportNameFn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a function with `export_name`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::LinkSectionFn => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a function with `link_section`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the program's behavior with overridden link sections on items is unpredictable and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::NoMangleStatic => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a `no_mangle` static")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::ExportNameStatic => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a static with `export_name`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::LinkSectionStatic => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a static with `link_section`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the program's behavior with overridden link sections on items is unpredictable and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::NoMangleMethod => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a `no_mangle` method")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        diag
                    }
                    BuiltinUnsafe::ExportNameMethod => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declaration of a method with `export_name`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them")));
                        ;
                        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)]
149pub(crate) enum BuiltinUnsafe {
150    #[diag(
151        "`allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site"
152    )]
153    AllowInternalUnsafe,
154    #[diag("usage of an `unsafe` block")]
155    UnsafeBlock,
156    #[diag("usage of an `unsafe extern` block")]
157    UnsafeExternBlock,
158    #[diag("declaration of an `unsafe` trait")]
159    UnsafeTrait,
160    #[diag("implementation of an `unsafe` trait")]
161    UnsafeImpl,
162    #[diag("declaration of a `no_mangle` function")]
163    #[note(
164        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
165    )]
166    NoMangleFn,
167    #[diag("declaration of a function with `export_name`")]
168    #[note(
169        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
170    )]
171    ExportNameFn,
172    #[diag("declaration of a function with `link_section`")]
173    #[note(
174        "the program's behavior with overridden link sections on items is unpredictable and Rust cannot provide guarantees when you manually override them"
175    )]
176    LinkSectionFn,
177    #[diag("declaration of a `no_mangle` static")]
178    #[note(
179        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
180    )]
181    NoMangleStatic,
182    #[diag("declaration of a static with `export_name`")]
183    #[note(
184        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
185    )]
186    ExportNameStatic,
187    #[diag("declaration of a static with `link_section`")]
188    #[note(
189        "the program's behavior with overridden link sections on items is unpredictable and Rust cannot provide guarantees when you manually override them"
190    )]
191    LinkSectionStatic,
192    #[diag("declaration of a `no_mangle` method")]
193    #[note(
194        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
195    )]
196    NoMangleMethod,
197    #[diag("declaration of a method with `export_name`")]
198    #[note(
199        "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them"
200    )]
201    ExportNameMethod,
202    #[diag("declaration of an `unsafe` function")]
203    DeclUnsafeFn,
204    #[diag("declaration of an `unsafe` method")]
205    DeclUnsafeMethod,
206    #[diag("implementation of an `unsafe` method")]
207    ImplUnsafeMethod,
208    #[diag("usage of `core::arch::global_asm`")]
209    #[note("using this macro is unsafe even though it does not need an `unsafe` block")]
210    GlobalAsm,
211}
212
213#[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)]
214#[diag("missing documentation for {$article} {$desc}")]
215pub(crate) struct BuiltinMissingDoc<'a> {
216    pub article: &'a str,
217    pub desc: &'a str,
218}
219
220#[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)]
221#[diag("type could implement `Copy`; consider adding `impl Copy`")]
222pub(crate) struct BuiltinMissingCopyImpl;
223
224pub(crate) struct BuiltinMissingDebugImpl<'a> {
225    pub tcx: TyCtxt<'a>,
226    pub def_id: DefId,
227}
228
229// Needed for def_path_str
230impl<'a> Diagnostic<'a, ()> for BuiltinMissingDebugImpl<'_> {
231    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
232        let Self { tcx, def_id } = self;
233        Diag::new(
234            dcx,
235            level,
236            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"),
237        ).with_arg("debug", tcx.def_path_str(def_id))
238    }
239}
240
241#[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.arg("ty_snip", __binding_1);
                        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)]
242#[diag("anonymous parameters are deprecated and will be removed in the next edition")]
243pub(crate) struct BuiltinAnonymousParams<'a> {
244    #[suggestion("try naming the parameter or explicitly ignoring it", code = "_: {ty_snip}")]
245    pub suggestion: (Span, Applicability),
246    pub ty_snip: &'a str,
247}
248
249#[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)]
250#[diag("unused doc comment")]
251pub(crate) struct BuiltinUnusedDocComment<'a> {
252    pub kind: &'a str,
253    #[label("rustdoc does not generate documentation for {$kind}")]
254    pub label: Span,
255    #[subdiagnostic]
256    pub sub: BuiltinUnusedDocCommentSub,
257}
258
259#[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 => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `//` for a plain comment")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    BuiltinUnusedDocCommentSub::BlockHelp => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `/* */` for a plain comment")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
260pub(crate) enum BuiltinUnusedDocCommentSub {
261    #[help("use `//` for a plain comment")]
262    PlainHelp,
263    #[help("use `/* */` for a plain comment")]
264    BlockHelp,
265}
266
267#[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)]
268#[diag("functions generic over types or consts must be mangled")]
269pub(crate) struct BuiltinNoMangleGeneric {
270    // Use of `#[no_mangle]` suggests FFI intent; correct
271    // fix may be to monomorphize source by hand
272    #[suggestion(
273        "remove this attribute",
274        style = "short",
275        code = "",
276        applicability = "maybe-incorrect"
277    )]
278    pub suggestion: Span,
279}
280
281#[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)]
282#[diag("const items should never be `#[no_mangle]`")]
283pub(crate) struct BuiltinConstNoMangle {
284    #[suggestion("try a static value", code = "pub static ", applicability = "machine-applicable")]
285    pub suggestion: Option<Span>,
286}
287
288#[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)]
289#[diag(
290    "transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell"
291)]
292pub(crate) struct BuiltinMutablesTransmutes;
293
294#[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)]
295#[diag("use of an unstable feature")]
296pub(crate) struct BuiltinUnstableFeatures;
297
298// lint_ungated_async_fn_track_caller
299pub(crate) struct BuiltinUngatedAsyncFnTrackCaller<'a> {
300    pub label: Span,
301    pub session: &'a Session,
302}
303
304impl<'a> Diagnostic<'a, ()> for BuiltinUngatedAsyncFnTrackCaller<'_> {
305    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
306        let mut diag = Diag::new(dcx, level, "`#[track_caller]` on async functions is a no-op")
307            .with_span_label(self.label, "this function will not propagate the caller location");
308        rustc_session::parse::add_feature_diagnostics(
309            &mut diag,
310            self.session,
311            sym::async_fn_track_caller,
312        );
313        diag
314    }
315}
316
317#[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.arg("new_vis", __binding_1);
                        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)]
318#[diag("unreachable `pub` {$what}")]
319pub(crate) struct BuiltinUnreachablePub<'a> {
320    pub what: &'a str,
321    pub new_vis: &'a str,
322    #[suggestion("consider restricting its visibility", code = "{new_vis}")]
323    pub suggestion: (Span, Applicability),
324    #[help("or consider exporting it for use by other crates")]
325    pub help: bool,
326}
327
328#[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)]
329#[diag("the `expr` fragment specifier will accept more expressions in the 2024 edition")]
330pub(crate) struct MacroExprFragment2024 {
331    #[suggestion(
332        "to keep the existing behavior, use the `expr_2021` fragment specifier",
333        code = "expr_2021",
334        applicability = "machine-applicable"
335    )]
336    pub suggestion: Span,
337}
338
339pub(crate) struct BuiltinTypeAliasBounds<'hir> {
340    pub in_where_clause: bool,
341    pub label: Span,
342    pub enable_feat_help: bool,
343    pub suggestions: Vec<(Span, String)>,
344    pub preds: &'hir [hir::WherePredicate<'hir>],
345    pub ty: Option<&'hir hir::Ty<'hir>>,
346}
347
348impl<'a> Diagnostic<'a, ()> for BuiltinTypeAliasBounds<'_> {
349    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
350        let mut diag = Diag::new(dcx, level, if self.in_where_clause {
351            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")
352        } else {
353            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")
354        })
355            .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"))
356            .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!(
357                "this is a known limitation of the type checker that may be lifted in a future edition.
358                see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information"
359            ));
360        if self.enable_feat_help {
361            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"));
362        }
363
364        // We perform the walk in here instead of in `<TypeAliasBounds as LateLintPass>` to
365        // avoid doing throwaway work in case the lint ends up getting suppressed.
366        let mut collector = ShorthandAssocTyCollector { qselves: Vec::new() };
367        if let Some(ty) = self.ty {
368            collector.visit_ty_unambig(ty);
369        }
370
371        let affect_object_lifetime_defaults = self
372            .preds
373            .iter()
374            .filter(|pred| pred.kind.in_where_clause() == self.in_where_clause)
375            .any(|pred| TypeAliasBounds::affects_object_lifetime_defaults(pred));
376
377        // If there are any shorthand assoc tys, then the bounds can't be removed automatically.
378        // The user first needs to fully qualify the assoc tys.
379        let applicability = if !collector.qselves.is_empty() || affect_object_lifetime_defaults {
380            Applicability::MaybeIncorrect
381        } else {
382            Applicability::MachineApplicable
383        };
384
385        diag.arg("count", self.suggestions.len());
386        diag.multipart_suggestion(
387            if self.in_where_clause {
388                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this where clause"))msg!("remove this where clause")
389            } else {
390                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove {$count ->\n                        [one] this bound\n                        *[other] these bounds\n                    }"))msg!(
391                    "remove {$count ->
392                        [one] this bound
393                        *[other] these bounds
394                    }"
395                )
396            },
397            self.suggestions,
398            applicability,
399        );
400
401        // Suggest fully qualifying paths of the form `T::Assoc` with `T` type param via
402        // `<T as /* Trait */>::Assoc` to remove their reliance on any type param bounds.
403        //
404        // Instead of attempting to figure out the necessary trait ref, just use a
405        // placeholder. Since we don't record type-dependent resolutions for non-body
406        // items like type aliases, we can't simply deduce the corresp. trait from
407        // the HIR path alone without rerunning parts of HIR ty lowering here
408        // (namely `probe_single_ty_param_bound_for_assoc_ty`) which is infeasible.
409        //
410        // (We could employ some simple heuristics but that's likely not worth it).
411        for qself in collector.qselves {
412            diag.multipart_suggestion(
413                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fully qualify this associated type"))msg!("fully qualify this associated type"),
414                ::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![
415                    (qself.shrink_to_lo(), "<".into()),
416                    (qself.shrink_to_hi(), " as /* Trait */>".into()),
417                ],
418                Applicability::HasPlaceholders,
419            );
420        }
421        diag
422    }
423}
424
425#[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)]
426#[diag(
427    "{$predicate_kind_name} bound {$predicate} does not depend on any type or lifetime parameters"
428)]
429pub(crate) struct BuiltinTrivialBounds<'a> {
430    pub predicate_kind_name: &'a str,
431    pub predicate: Clause<'a>,
432}
433
434#[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)]
435#[diag("use of a double negation")]
436#[note(
437    "the prefix `--` could be misinterpreted as a decrement operator which exists in other languages"
438)]
439#[note("use `-= 1` if you meant to decrement the value")]
440pub(crate) struct BuiltinDoubleNegations {
441    #[subdiagnostic]
442    pub add_parens: BuiltinDoubleNegationsAddParens,
443}
444
445#[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));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses for clarity")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
446#[multipart_suggestion("add parentheses for clarity", applicability = "maybe-incorrect")]
447pub(crate) struct BuiltinDoubleNegationsAddParens {
448    #[suggestion_part(code = "(")]
449    pub start_span: Span,
450    #[suggestion_part(code = ")")]
451    pub end_span: Span,
452}
453
454#[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.arg("replace", __binding_1);
                        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)]
455pub(crate) enum BuiltinEllipsisInclusiveRangePatternsLint {
456    #[diag("`...` range patterns are deprecated")]
457    Parenthesise {
458        #[suggestion(
459            "use `..=` for an inclusive range",
460            code = "{replace}",
461            applicability = "machine-applicable"
462        )]
463        suggestion: Span,
464        replace: String,
465    },
466    #[diag("`...` range patterns are deprecated")]
467    NonParenthesise {
468        #[suggestion(
469            "use `..=` for an inclusive range",
470            style = "short",
471            code = "..=",
472            applicability = "machine-applicable"
473        )]
474        suggestion: Span,
475    },
476}
477
478#[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.arg("prefix", __binding_3);
                        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)]
479#[diag("`{$kw}` is a keyword in the {$next} edition")]
480pub(crate) struct BuiltinKeywordIdents {
481    pub kw: Ident,
482    pub next: Edition,
483    #[suggestion(
484        "you can use a raw identifier to stay compatible",
485        code = "{prefix}r#{kw}",
486        applicability = "machine-applicable"
487    )]
488    pub suggestion: Span,
489    pub prefix: &'static str,
490}
491
492#[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 {
                        count: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("outlives requirements can be inferred")));
                        ;
                        diag.arg("count", __binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
493#[diag("outlives requirements can be inferred")]
494pub(crate) struct BuiltinExplicitOutlives {
495    pub count: usize,
496    #[subdiagnostic]
497    pub suggestion: BuiltinExplicitOutlivesSuggestion,
498}
499
500#[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 } => {
                        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()));
                        }
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove {$count ->\n        [one] this bound\n        *[other] these bounds\n    }")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            __binding_1, rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
501#[multipart_suggestion(
502    "remove {$count ->
503        [one] this bound
504        *[other] these bounds
505    }"
506)]
507pub(crate) struct BuiltinExplicitOutlivesSuggestion {
508    #[suggestion_part(code = "")]
509    pub spans: Vec<Span>,
510    #[applicability]
511    pub applicability: Applicability,
512}
513
514#[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)]
515#[diag(
516    "the feature `{$name}` is incomplete and may not be safe to use and/or cause compiler crashes"
517)]
518pub(crate) struct BuiltinIncompleteFeatures {
519    pub name: Symbol,
520    #[subdiagnostic]
521    pub note: Option<BuiltinFeatureIssueNote>,
522    #[subdiagnostic]
523    pub help: Option<BuiltinIncompleteFeaturesHelp>,
524}
525
526#[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)]
527#[diag("the feature `{$name}` is internal to the compiler or standard library")]
528#[note("using it is strongly discouraged")]
529pub(crate) struct BuiltinInternalFeatures {
530    pub name: Symbol,
531}
532
533#[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 => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `min_{$name}` instead, which is more stable and complete")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
534#[help("consider using `min_{$name}` instead, which is more stable and complete")]
535pub(crate) struct BuiltinIncompleteFeaturesHelp;
536
537#[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 } => {
                        diag.store_args();
                        diag.arg("n", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
538#[note("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")]
539pub(crate) struct BuiltinFeatureIssueNote {
540    pub n: NonZero<u32>,
541}
542
543pub(crate) struct BuiltinUnpermittedTypeInit<'a> {
544    pub msg: DiagMessage,
545    pub ty: Ty<'a>,
546    pub label: Span,
547    pub sub: BuiltinUnpermittedTypeInitSub,
548    pub tcx: TyCtxt<'a>,
549}
550
551impl<'a> Diagnostic<'a, ()> for BuiltinUnpermittedTypeInit<'_> {
552    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
553        let mut diag = Diag::new(dcx, level, self.msg)
554            .with_arg("ty", self.ty)
555            .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"));
556        if let InhabitedPredicate::True = self.ty.inhabited_predicate(self.tcx) {
557            // Only suggest late `MaybeUninit::assume_init` initialization if the type is inhabited.
558            diag.span_label(
559                self.label,
560                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"),
561            );
562        }
563        self.sub.add_to_diag(&mut diag);
564        diag
565    }
566}
567
568// FIXME(davidtwco): make translatable
569pub(crate) struct BuiltinUnpermittedTypeInitSub {
570    pub err: InitError,
571}
572
573impl Subdiagnostic for BuiltinUnpermittedTypeInitSub {
574    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
575        let mut err = self.err;
576        loop {
577            if let Some(span) = err.span {
578                diag.span_note(span, err.message);
579            } else {
580                diag.note(err.message);
581            }
582            if let Some(e) = err.nested {
583                err = *e;
584            } else {
585                break;
586            }
587        }
588    }
589}
590
591#[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)]
592pub(crate) enum BuiltinClashingExtern<'a> {
593    #[diag("`{$this}` redeclared with a different signature")]
594    SameName {
595        this: Symbol,
596        orig: Symbol,
597        #[label("`{$orig}` previously declared here")]
598        previous_decl_label: Span,
599        #[label("this signature doesn't match the previous declaration")]
600        mismatch_label: Span,
601        #[subdiagnostic]
602        sub: BuiltinClashingExternSub<'a>,
603    },
604    #[diag("`{$this}` redeclares `{$orig}` with a different signature")]
605    DiffName {
606        this: Symbol,
607        orig: Symbol,
608        #[label("`{$orig}` previously declared here")]
609        previous_decl_label: Span,
610        #[label("this signature doesn't match the previous declaration")]
611        mismatch_label: Span,
612        #[subdiagnostic]
613        sub: BuiltinClashingExternSub<'a>,
614    },
615}
616
617// FIXME(davidtwco): translatable expected/found
618pub(crate) struct BuiltinClashingExternSub<'a> {
619    pub tcx: TyCtxt<'a>,
620    pub expected: Ty<'a>,
621    pub found: Ty<'a>,
622}
623
624impl Subdiagnostic for BuiltinClashingExternSub<'_> {
625    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
626        let mut expected_str = DiagStyledString::new();
627        expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
628        let mut found_str = DiagStyledString::new();
629        found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
630        diag.note_expected_found("", expected_str, "", found_str);
631    }
632}
633
634#[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)]
635#[diag("dereferencing a null pointer")]
636pub(crate) struct BuiltinDerefNullptr {
637    #[label("this code causes undefined behavior when executed")]
638    pub label: Span,
639}
640
641// FIXME: migrate fluent::lint::builtin_asm_labels
642
643#[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)]
644pub(crate) enum BuiltinSpecialModuleNameUsed {
645    #[diag("found module declaration for lib.rs")]
646    #[note("lib.rs is the root of this crate's library target")]
647    #[help("to refer to it from other targets, use the library's name as the path")]
648    Lib,
649    #[diag("found module declaration for main.rs")]
650    #[note("a binary crate cannot be used as library")]
651    Main,
652}
653
654// deref_into_dyn_supertrait.rs
655#[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)]
656#[diag("this `Deref` implementation is covered by an implicit supertrait coercion")]
657pub(crate) struct SupertraitAsDerefTarget<'a> {
658    pub self_ty: Ty<'a>,
659    pub supertrait_principal: PolyExistentialTraitRef<'a>,
660    pub target_principal: PolyExistentialTraitRef<'a>,
661    #[label(
662        "`{$self_ty}` implements `Deref<Target = dyn {$target_principal}>` which conflicts with supertrait `{$supertrait_principal}`"
663    )]
664    pub label: Span,
665    #[subdiagnostic]
666    pub label2: Option<SupertraitAsDerefTargetLabel>,
667}
668
669#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for SupertraitAsDerefTargetLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SupertraitAsDerefTargetLabel { label: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target type is a supertrait of `{$self_ty}`")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
670#[label("target type is a supertrait of `{$self_ty}`")]
671pub(crate) struct SupertraitAsDerefTargetLabel {
672    #[primary_span]
673    pub label: Span,
674}
675
676// enum_intrinsics_non_enums.rs
677#[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)]
678#[diag("the return value of `mem::discriminant` is unspecified when called with a non-enum type")]
679pub(crate) struct EnumIntrinsicsMemDiscriminate<'a> {
680    pub ty_param: Ty<'a>,
681    #[note(
682        "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"
683    )]
684    pub note: Span,
685}
686
687#[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)]
688#[diag("the return value of `mem::variant_count` is unspecified when called with a non-enum type")]
689#[note(
690    "the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum"
691)]
692pub(crate) struct EnumIntrinsicsMemVariant<'a> {
693    pub ty_param: Ty<'a>,
694}
695
696// expect.rs
697#[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)]
698#[diag("this lint expectation is unfulfilled")]
699pub(crate) struct Expectation {
700    #[subdiagnostic]
701    pub rationale: Option<ExpectationNote>,
702    #[note(
703        "the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message"
704    )]
705    pub note: bool,
706}
707
708#[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 } => {
                        diag.store_args();
                        diag.arg("rationale", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$rationale}")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
709#[note("{$rationale}")]
710pub(crate) struct ExpectationNote {
711    pub rationale: Symbol,
712}
713
714// ptr_nulls.rs
715#[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)]
716pub(crate) enum UselessPtrNullChecksDiag<'a> {
717    #[diag(
718        "function pointers are not nullable, so checking them for null will always return false"
719    )]
720    #[help(
721        "wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value"
722    )]
723    FnPtr {
724        orig_ty: Ty<'a>,
725        #[label("expression has type `{$orig_ty}`")]
726        label: Span,
727    },
728    #[diag("references are not nullable, so checking them for null will always return false")]
729    Ref {
730        orig_ty: Ty<'a>,
731        #[label("expression has type `{$orig_ty}`")]
732        label: Span,
733    },
734    #[diag(
735        "returned pointer of `{$fn_name}` call is never null, so checking it for null will always return false"
736    )]
737    FnRet { fn_name: Ident },
738}
739
740#[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)]
741pub(crate) enum InvalidNullArgumentsDiag {
742    #[diag(
743        "calling this function with a null pointer is undefined behavior, even if the result of the function is unused"
744    )]
745    #[help(
746        "for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>"
747    )]
748    NullPtrInline {
749        #[label("null pointer originates from here")]
750        null_span: Span,
751    },
752    #[diag(
753        "calling this function with a null pointer is undefined behavior, even if the result of the function is unused"
754    )]
755    #[help(
756        "for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>"
757    )]
758    NullPtrThroughBinding {
759        #[note("null pointer originates from here")]
760        null_span: Span,
761    },
762}
763
764// for_loops_over_fallibles.rs
765#[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)]
766#[diag(
767    "for loop over {$article} `{$ref_prefix}{$ty}`. This is more readably written as an `if let` statement"
768)]
769pub(crate) struct ForLoopsOverFalliblesDiag<'a> {
770    pub article: &'static str,
771    pub ref_prefix: &'static str,
772    pub ty: &'static str,
773    #[subdiagnostic]
774    pub sub: ForLoopsOverFalliblesLoopSub<'a>,
775    #[subdiagnostic]
776    pub question_mark: Option<ForLoopsOverFalliblesQuestionMark>,
777    #[subdiagnostic]
778    pub suggestion: ForLoopsOverFalliblesSuggestion<'a>,
779}
780
781#[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_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".by_ref()"))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("recv_snip", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to iterate over `{$recv_snip}` remove the call to `next`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_23, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    ForLoopsOverFalliblesLoopSub::UseWhileLet {
                        start_span: __binding_0,
                        end_span: __binding_1,
                        var: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_24 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("while let {0}(",
                                            __binding_2))
                                });
                        let __code_25 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(") = "))
                                });
                        suggestions.push((__binding_0, __code_24));
                        suggestions.push((__binding_1, __code_25));
                        diag.store_args();
                        diag.arg("var", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to check pattern in a loop use `while let`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
782pub(crate) enum ForLoopsOverFalliblesLoopSub<'a> {
783    #[suggestion(
784        "to iterate over `{$recv_snip}` remove the call to `next`",
785        code = ".by_ref()",
786        applicability = "maybe-incorrect"
787    )]
788    RemoveNext {
789        #[primary_span]
790        suggestion: Span,
791        recv_snip: String,
792    },
793    #[multipart_suggestion(
794        "to check pattern in a loop use `while let`",
795        applicability = "maybe-incorrect"
796    )]
797    UseWhileLet {
798        #[suggestion_part(code = "while let {var}(")]
799        start_span: Span,
800        #[suggestion_part(code = ") = ")]
801        end_span: Span,
802        var: &'a str,
803    },
804}
805
806#[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_26 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("?"))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider unwrapping the `Result` with `?` to iterate over its contents")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_26, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
807#[suggestion(
808    "consider unwrapping the `Result` with `?` to iterate over its contents",
809    code = "?",
810    applicability = "maybe-incorrect"
811)]
812pub(crate) struct ForLoopsOverFalliblesQuestionMark {
813    #[primary_span]
814    pub suggestion: Span,
815}
816
817#[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_27 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("if let {0}(",
                                            __binding_0))
                                });
                        let __code_28 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(") = "))
                                });
                        suggestions.push((__binding_1, __code_27));
                        suggestions.push((__binding_2, __code_28));
                        diag.store_args();
                        diag.arg("var", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `if let` to clear intent")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
818#[multipart_suggestion(
819    "consider using `if let` to clear intent",
820    applicability = "maybe-incorrect"
821)]
822pub(crate) struct ForLoopsOverFalliblesSuggestion<'a> {
823    pub var: &'a str,
824    #[suggestion_part(code = "if let {var}(")]
825    pub start_span: Span,
826    #[suggestion_part(code = ") = ")]
827    pub end_span: Span,
828}
829
830#[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 => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the expression or result")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    UseLetUnderscoreIgnoreSuggestion::Suggestion {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_29 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_30 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_29));
                        suggestions.push((__binding_1, __code_30));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the expression or result")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
831pub(crate) enum UseLetUnderscoreIgnoreSuggestion {
832    #[note("use `let _ = ...` to ignore the expression or result")]
833    Note,
834    #[multipart_suggestion(
835        "use `let _ = ...` to ignore the expression or result",
836        style = "verbose",
837        applicability = "maybe-incorrect"
838    )]
839    Suggestion {
840        #[suggestion_part(code = "let _ = ")]
841        start_span: Span,
842        #[suggestion_part(code = "")]
843        end_span: Span,
844    },
845}
846
847// drop_forget_useless.rs
848#[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)]
849#[diag("calls to `std::mem::drop` with a reference instead of an owned value does nothing")]
850pub(crate) struct DropRefDiag<'a> {
851    pub arg_ty: Ty<'a>,
852    #[label("argument has type `{$arg_ty}`")]
853    pub label: Span,
854    #[subdiagnostic]
855    pub sugg: UseLetUnderscoreIgnoreSuggestion,
856}
857
858#[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)]
859#[diag("calls to `std::mem::drop` with a value that implements `Copy` does nothing")]
860pub(crate) struct DropCopyDiag<'a> {
861    pub arg_ty: Ty<'a>,
862    #[label("argument has type `{$arg_ty}`")]
863    pub label: Span,
864    #[subdiagnostic]
865    pub sugg: UseLetUnderscoreIgnoreSuggestion,
866}
867
868#[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)]
869#[diag("calls to `std::mem::forget` with a reference instead of an owned value does nothing")]
870pub(crate) struct ForgetRefDiag<'a> {
871    pub arg_ty: Ty<'a>,
872    #[label("argument has type `{$arg_ty}`")]
873    pub label: Span,
874    #[subdiagnostic]
875    pub sugg: UseLetUnderscoreIgnoreSuggestion,
876}
877
878#[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)]
879#[diag("calls to `std::mem::forget` with a value that implements `Copy` does nothing")]
880pub(crate) struct ForgetCopyDiag<'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
            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)]
889#[diag(
890    "calls to `std::mem::drop` with `std::mem::ManuallyDrop` instead of the inner value does nothing"
891)]
892pub(crate) struct UndroppedManuallyDropsDiag<'a> {
893    pub arg_ty: Ty<'a>,
894    #[label("argument has type `{$arg_ty}`")]
895    pub label: Span,
896    #[subdiagnostic]
897    pub suggestion: UndroppedManuallyDropsSuggestion,
898}
899
900#[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_31 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("std::mem::ManuallyDrop::into_inner("))
                                });
                        let __code_32 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_31));
                        suggestions.push((__binding_1, __code_32));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::mem::ManuallyDrop::into_inner` to get the inner value")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
901#[multipart_suggestion(
902    "use `std::mem::ManuallyDrop::into_inner` to get the inner value",
903    applicability = "machine-applicable"
904)]
905pub(crate) struct UndroppedManuallyDropsSuggestion {
906    #[suggestion_part(code = "std::mem::ManuallyDrop::into_inner(")]
907    pub start_span: Span,
908    #[suggestion_part(code = ")")]
909    pub end_span: Span,
910}
911
912// invalid_from_utf8.rs
913#[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)]
914pub(crate) enum InvalidFromUtf8Diag {
915    #[diag("calls to `{$method}` with an invalid literal are undefined behavior")]
916    Unchecked {
917        method: String,
918        valid_up_to: usize,
919        #[label("the literal was valid UTF-8 up to the {$valid_up_to} bytes")]
920        label: Span,
921    },
922    #[diag("calls to `{$method}` with an invalid literal always return an error")]
923    Checked {
924        method: String,
925        valid_up_to: usize,
926        #[label("the literal was valid UTF-8 up to the {$valid_up_to} bytes")]
927        label: Span,
928    },
929}
930
931// interior_mutable_consts.rs
932#[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)]
933#[diag("mutation of an interior mutable `const` item with call to `{$method_name}`")]
934#[note("each usage of a `const` item creates a new temporary")]
935#[note("only the temporaries and never the original `const {$const_name}` will be modified")]
936#[help(
937    "for more details on interior mutability see <https://doc.rust-lang.org/reference/interior-mutability.html>"
938)]
939pub(crate) struct ConstItemInteriorMutationsDiag<'tcx> {
940    pub method_name: Ident,
941    pub const_name: Ident,
942    pub const_ty: Ty<'tcx>,
943    #[label("`{$const_name}` is a interior mutable `const` item of type `{$const_ty}`")]
944    pub receiver_span: Span,
945    #[subdiagnostic]
946    pub sugg_static: Option<ConstItemInteriorMutationsSuggestionStatic>,
947}
948
949#[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 } => {
                        let __code_33 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}static ",
                                                        __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("before", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for a shared instance of `{$const_name}`, consider making it a `static` item instead")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_33, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    ConstItemInteriorMutationsSuggestionStatic::Spanless => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for a shared instance of `{$const_name}`, consider making it a `static` item instead")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
950pub(crate) enum ConstItemInteriorMutationsSuggestionStatic {
951    #[suggestion(
952        "for a shared instance of `{$const_name}`, consider making it a `static` item instead",
953        code = "{before}static ",
954        style = "verbose",
955        applicability = "maybe-incorrect"
956    )]
957    Spanful {
958        #[primary_span]
959        const_: Span,
960        before: &'static str,
961    },
962    #[help("for a shared instance of `{$const_name}`, consider making it a `static` item instead")]
963    Spanless,
964}
965
966// reference_casting.rs
967#[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)]
968pub(crate) enum InvalidReferenceCastingDiag<'tcx> {
969    #[diag(
970        "casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`"
971    )]
972    #[note(
973        "for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>"
974    )]
975    BorrowAsMut {
976        #[label("casting happened here")]
977        orig_cast: Option<Span>,
978        #[note(
979            "even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`"
980        )]
981        ty_has_interior_mutability: bool,
982    },
983    #[diag("assigning to `&T` is undefined behavior, consider using an `UnsafeCell`")]
984    #[note(
985        "for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>"
986    )]
987    AssignToRef {
988        #[label("casting happened here")]
989        orig_cast: Option<Span>,
990        #[note(
991            "even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`"
992        )]
993        ty_has_interior_mutability: bool,
994    },
995    #[diag(
996        "casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused"
997    )]
998    #[note("casting from `{$from_ty}` ({$from_size} bytes) to `{$to_ty}` ({$to_size} bytes)")]
999    BiggerLayout {
1000        #[label("casting happened here")]
1001        orig_cast: Option<Span>,
1002        #[label("backing allocation comes from here")]
1003        alloc: Span,
1004        from_ty: Ty<'tcx>,
1005        from_size: u64,
1006        to_ty: Ty<'tcx>,
1007        to_size: u64,
1008    },
1009}
1010
1011// map_unit_fn.rs
1012#[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_34 =
                            [::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_34, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1013#[diag("`Iterator::map` call that discard the iterator's values")]
1014#[note(
1015    "`Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated"
1016)]
1017pub(crate) struct MappingToUnit {
1018    #[label("this function returns `()`, which is likely not what you wanted")]
1019    pub function_label: Span,
1020    #[label("called `Iterator::map` with callable that returns `()`")]
1021    pub argument_label: Span,
1022    #[label(
1023        "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"
1024    )]
1025    pub map_label: Span,
1026    #[suggestion(
1027        "you might have meant to use `Iterator::for_each`",
1028        style = "verbose",
1029        code = "for_each",
1030        applicability = "maybe-incorrect"
1031    )]
1032    pub suggestion: Span,
1033}
1034
1035// internal.rs
1036#[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)]
1037#[diag("prefer `{$preferred}` over `{$used}`, it has better performance")]
1038#[note("a `use rustc_data_structures::fx::{$preferred}` may be necessary")]
1039pub(crate) struct DefaultHashTypesDiag<'a> {
1040    pub preferred: &'a str,
1041    pub used: Symbol,
1042}
1043
1044#[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)]
1045#[diag("using `{$query}` can result in unstable query results")]
1046#[note(
1047    "if you believe this case to be fine, allow this lint and add a comment explaining your rationale"
1048)]
1049pub(crate) struct QueryInstability {
1050    pub query: Symbol,
1051}
1052
1053#[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)]
1054#[diag("`{$method}` accesses information that is not tracked by the query system")]
1055#[note(
1056    "if you believe this case to be fine, allow this lint and add a comment explaining your rationale"
1057)]
1058pub(crate) struct QueryUntracked {
1059    pub method: Symbol,
1060}
1061
1062#[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)]
1063#[diag("use `.eq_ctxt()` instead of `.ctxt() == .ctxt()`")]
1064pub(crate) struct SpanUseEqCtxtDiag;
1065
1066#[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)]
1067#[diag("using `Symbol::intern` on a string literal")]
1068#[help("consider adding the symbol to `compiler/rustc_span/src/symbol.rs`")]
1069pub(crate) struct SymbolInternStringLiteralDiag;
1070
1071#[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_35 =
                            [::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_35, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1072#[diag("usage of `ty::TyKind::<kind>`")]
1073pub(crate) struct TykindKind {
1074    #[suggestion(
1075        "try using `ty::<kind>` directly",
1076        code = "ty",
1077        applicability = "maybe-incorrect"
1078    )]
1079    pub suggestion: Span,
1080}
1081
1082#[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)]
1083#[diag("usage of `ty::TyKind`")]
1084#[help("try using `Ty` instead")]
1085pub(crate) struct TykindDiag;
1086
1087#[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_36 =
                            [::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_36, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1088#[diag("usage of qualified `ty::{$ty}`")]
1089pub(crate) struct TyQualified {
1090    pub ty: String,
1091    #[suggestion(
1092        "try importing it and using it unqualified",
1093        code = "{ty}",
1094        applicability = "maybe-incorrect"
1095    )]
1096    pub suggestion: Span,
1097}
1098
1099#[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)]
1100#[diag("do not use `rustc_type_ir::inherent` unless you're inside of the trait solver")]
1101#[note(
1102    "the method or struct you're looking for is likely defined somewhere else downstream in the compiler"
1103)]
1104pub(crate) struct TypeIrInherentUsage;
1105
1106#[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)]
1107#[diag(
1108    "do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver"
1109)]
1110#[note(
1111    "the method or struct you're looking for is likely defined somewhere else downstream in the compiler"
1112)]
1113pub(crate) struct TypeIrTraitUsage;
1114
1115#[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)]
1116#[diag("do not use `rustc_type_ir` unless you are implementing type system internals")]
1117#[note("use `rustc_middle::ty` instead")]
1118pub(crate) struct TypeIrDirectUse;
1119
1120#[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_37 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.arg("snippet", __binding_1);
                        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_37, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1121#[diag("non-glob import of `rustc_type_ir::inherent`")]
1122pub(crate) struct NonGlobImportTypeIrInherent {
1123    #[suggestion(
1124        "try using a glob import instead",
1125        code = "{snippet}",
1126        applicability = "maybe-incorrect"
1127    )]
1128    pub suggestion: Option<Span>,
1129    pub snippet: &'static str,
1130}
1131
1132#[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)]
1133#[diag("implementing `LintPass` by hand")]
1134#[help("try using `declare_lint_pass!` or `impl_lint_pass!` instead")]
1135pub(crate) struct LintPassByHand;
1136
1137#[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)]
1138#[diag("{$msg}")]
1139pub(crate) struct BadOptAccessDiag<'a> {
1140    pub msg: &'a str,
1141}
1142
1143#[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)]
1144#[diag(
1145    "dangerous use of `extern crate {$name}` which is not guaranteed to exist exactly once in the sysroot"
1146)]
1147#[help(
1148    "try using a cargo dependency or using a re-export of the dependency provided by a rustc_* crate"
1149)]
1150pub(crate) struct ImplicitSysrootCrateImportDiag<'a> {
1151    pub name: &'a str,
1152}
1153
1154#[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)]
1155#[diag("use of `AttributeKind` in `find_attr!(...)` invocation")]
1156#[note("`find_attr!(...)` already imports `AttributeKind::*`")]
1157#[help("remove `AttributeKind`")]
1158pub(crate) struct AttributeKindInFindAttr;
1159
1160// let_underscore.rs
1161#[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)]
1162pub(crate) enum NonBindingLet {
1163    #[diag("non-binding let on a synchronization lock")]
1164    SyncLock {
1165        #[label("this lock is not assigned to a binding and is immediately dropped")]
1166        pat: Span,
1167        #[subdiagnostic]
1168        sub: NonBindingLetSub,
1169    },
1170    #[diag("non-binding let on a type that has a destructor")]
1171    DropType {
1172        #[subdiagnostic]
1173        sub: NonBindingLetSub,
1174    },
1175}
1176
1177pub(crate) struct NonBindingLetSub {
1178    pub suggestion: Span,
1179    pub drop_fn_start_end: Option<(Span, Span)>,
1180    pub is_assign_desugar: bool,
1181}
1182
1183impl Subdiagnostic for NonBindingLetSub {
1184    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1185        let can_suggest_binding = self.drop_fn_start_end.is_some() || !self.is_assign_desugar;
1186
1187        if can_suggest_binding {
1188            let prefix = if self.is_assign_desugar { "let " } else { "" };
1189            diag.span_suggestion_verbose(
1190                self.suggestion,
1191                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider binding to an unused variable to avoid immediately dropping the value"))msg!(
1192                    "consider binding to an unused variable to avoid immediately dropping the value"
1193                ),
1194                ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}_unused", prefix))
    })format!("{prefix}_unused"),
1195                Applicability::MachineApplicable,
1196            );
1197        } else {
1198            diag.span_help(
1199                self.suggestion,
1200                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider binding to an unused variable to avoid immediately dropping the value"))msg!(
1201                    "consider binding to an unused variable to avoid immediately dropping the value"
1202                ),
1203            );
1204        }
1205        if let Some(drop_fn_start_end) = self.drop_fn_start_end {
1206            diag.multipart_suggestion(
1207                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider immediately dropping the value"))msg!("consider immediately dropping the value"),
1208                ::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![
1209                    (drop_fn_start_end.0, "drop(".to_string()),
1210                    (drop_fn_start_end.1, ")".to_string()),
1211                ],
1212                Applicability::MachineApplicable,
1213            );
1214        } else {
1215            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider immediately dropping the value using `drop(..)` after the `let` statement"))msg!(
1216                "consider immediately dropping the value using `drop(..)` after the `let` statement"
1217            ));
1218        }
1219    }
1220}
1221
1222// levels.rs
1223#[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)]
1224#[diag("{$lint_level}({$lint_source}) incompatible with previous forbid")]
1225pub(crate) struct OverruledAttributeLint<'a> {
1226    #[label("overruled by previous forbid")]
1227    pub overruled: Span,
1228    pub lint_level: &'a str,
1229    pub lint_source: Symbol,
1230    #[subdiagnostic]
1231    pub sub: OverruledAttributeSub,
1232}
1233
1234#[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_38 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("replace", __binding_2);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("change it to")),
                            __code_38, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1235#[diag("lint name `{$name}` is deprecated and may not have an effect in the future")]
1236pub(crate) struct DeprecatedLintName<'a> {
1237    pub name: String,
1238    #[suggestion("change it to", code = "{replace}", applicability = "machine-applicable")]
1239    pub suggestion: Span,
1240    pub replace: &'a str,
1241}
1242
1243#[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)]
1244#[diag("lint name `{$name}` is deprecated and may not have an effect in the future")]
1245#[help("change it to {$replace}")]
1246pub(crate) struct DeprecatedLintNameFromCommandLine<'a> {
1247    pub name: String,
1248    pub replace: &'a str,
1249    #[subdiagnostic]
1250    pub requested_level: RequestedLevel<'a>,
1251}
1252
1253#[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)]
1254#[diag("lint `{$name}` has been renamed to `{$replace}`")]
1255pub(crate) struct RenamedLint<'a> {
1256    pub name: &'a str,
1257    pub replace: &'a str,
1258    #[subdiagnostic]
1259    pub suggestion: RenamedLintSuggestion<'a>,
1260}
1261
1262#[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_39 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replace", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the new name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_39, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    RenamedLintSuggestion::WithoutSpan { replace: __binding_0 }
                        => {
                        diag.store_args();
                        diag.arg("replace", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the new name `{$replace}`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1263pub(crate) enum RenamedLintSuggestion<'a> {
1264    #[suggestion("use the new name", code = "{replace}", applicability = "machine-applicable")]
1265    WithSpan {
1266        #[primary_span]
1267        suggestion: Span,
1268        replace: &'a str,
1269    },
1270    #[help("use the new name `{$replace}`")]
1271    WithoutSpan { replace: &'a str },
1272}
1273
1274#[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)]
1275#[diag("lint `{$name}` has been renamed to `{$replace}`")]
1276pub(crate) struct RenamedLintFromCommandLine<'a> {
1277    pub name: &'a str,
1278    pub replace: &'a str,
1279    #[subdiagnostic]
1280    pub suggestion: RenamedLintSuggestion<'a>,
1281    #[subdiagnostic]
1282    pub requested_level: RequestedLevel<'a>,
1283}
1284
1285#[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)]
1286#[diag("lint `{$name}` has been removed: {$reason}")]
1287pub(crate) struct RemovedLint<'a> {
1288    pub name: &'a str,
1289    pub reason: &'a str,
1290}
1291
1292#[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)]
1293#[diag("lint `{$name}` has been removed: {$reason}")]
1294pub(crate) struct RemovedLintFromCommandLine<'a> {
1295    pub name: &'a str,
1296    pub reason: &'a str,
1297    #[subdiagnostic]
1298    pub requested_level: RequestedLevel<'a>,
1299}
1300
1301#[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)]
1302#[diag("unknown lint: `{$name}`")]
1303pub(crate) struct UnknownLint {
1304    pub name: String,
1305    #[subdiagnostic]
1306    pub suggestion: Option<UnknownLintSuggestion>,
1307}
1308
1309#[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_40 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replace", __binding_1);
                        diag.arg("from_rustc", __binding_2);
                        let __message =
                            diag.eagerly_translate(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        }")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_40, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    UnknownLintSuggestion::WithoutSpan {
                        replace: __binding_0, from_rustc: __binding_1 } => {
                        diag.store_args();
                        diag.arg("replace", __binding_0);
                        diag.arg("from_rustc", __binding_1);
                        let __message =
                            diag.eagerly_translate(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        }")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1310pub(crate) enum UnknownLintSuggestion {
1311    #[suggestion(
1312        "{$from_rustc ->
1313            [true] a lint with a similar name exists in `rustc` lints
1314            *[false] did you mean
1315        }",
1316        code = "{replace}",
1317        applicability = "maybe-incorrect"
1318    )]
1319    WithSpan {
1320        #[primary_span]
1321        suggestion: Span,
1322        replace: Symbol,
1323        from_rustc: bool,
1324    },
1325    #[help(
1326        "{$from_rustc ->
1327            [true] a lint with a similar name exists in `rustc` lints: `{$replace}`
1328            *[false] did you mean: `{$replace}`
1329        }"
1330    )]
1331    WithoutSpan { replace: Symbol, from_rustc: bool },
1332}
1333
1334#[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)]
1335#[diag("unknown lint: `{$name}`", code = E0602)]
1336pub(crate) struct UnknownLintFromCommandLine<'a> {
1337    pub name: String,
1338    #[subdiagnostic]
1339    pub suggestion: Option<UnknownLintSuggestion>,
1340    #[subdiagnostic]
1341    pub requested_level: RequestedLevel<'a>,
1342}
1343
1344#[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)]
1345#[diag("{$level}({$name}) is ignored unless specified at crate level")]
1346pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
1347    pub level: &'a str,
1348    pub name: Symbol,
1349}
1350
1351// dangling.rs
1352#[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)]
1353#[diag("this creates a dangling pointer because temporary `{$ty}` is dropped at end of statement")]
1354#[help("bind the `{$ty}` to a variable such that it outlives the pointer returned by `{$callee}`")]
1355#[note("a dangling pointer is safe, but dereferencing one is undefined behavior")]
1356#[note("returning a pointer to a local variable will always result in a dangling pointer")]
1357#[note("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")]
1358// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
1359pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
1360    pub callee: Ident,
1361    pub ty: Ty<'tcx>,
1362    #[label("pointer created here")]
1363    pub ptr_span: Span,
1364    #[label("this `{$ty}` is dropped at end of statement")]
1365    pub temporary_span: Span,
1366}
1367
1368#[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.arg("local_var_ty", __binding_5);
                        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)]
1369#[diag("{$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`")]
1370#[note("a dangling pointer is safe, but dereferencing one is undefined behavior")]
1371#[note("for more information, see <https://doc.rust-lang.org/reference/destructors.html>")]
1372pub(crate) struct DanglingPointersFromLocals<'tcx> {
1373    pub ret_ty: Ty<'tcx>,
1374    #[label("return type is `{$ret_ty}`")]
1375    pub ret_ty_span: Span,
1376    pub fn_kind: &'static str,
1377    #[label("local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}")]
1378    pub local_var: Span,
1379    pub local_var_name: Ident,
1380    pub local_var_ty: Ty<'tcx>,
1381    #[label("dangling pointer created here")]
1382    pub created_at: Option<Span>,
1383}
1384
1385// multiple_supertrait_upcastable.rs
1386#[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)]
1387#[diag("`{$ident}` is dyn-compatible and has multiple supertraits")]
1388pub(crate) struct MultipleSupertraitUpcastable {
1389    pub ident: Ident,
1390}
1391
1392// non_ascii_idents.rs
1393#[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)]
1394#[diag("identifier contains non-ASCII characters")]
1395pub(crate) struct IdentifierNonAsciiChar;
1396
1397#[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)]
1398#[diag(
1399    "identifier contains {$codepoints_len ->
1400        [one] { $identifier_type ->
1401            [Exclusion] a character from an archaic script
1402            [Technical] a character that is for non-linguistic, specialized usage
1403            [Limited_Use] a character from a script in limited use
1404            [Not_NFKC] a non normalized (NFKC) character
1405            *[other] an uncommon character
1406        }
1407        *[other] { $identifier_type ->
1408            [Exclusion] {$codepoints_len} characters from archaic scripts
1409            [Technical] {$codepoints_len} characters that are for non-linguistic, specialized usage
1410            [Limited_Use] {$codepoints_len} characters from scripts in limited use
1411            [Not_NFKC] {$codepoints_len} non normalized (NFKC) characters
1412            *[other] uncommon characters
1413        }
1414    }: {$codepoints}"
1415)]
1416#[note(
1417    r#"{$codepoints_len ->
1418        [one] this character is
1419        *[other] these characters are
1420    } included in the{$identifier_type ->
1421        [Restricted] {""}
1422        *[other] {" "}{$identifier_type}
1423    } Unicode general security profile"#
1424)]
1425pub(crate) struct IdentifierUncommonCodepoints {
1426    pub codepoints: Vec<char>,
1427    pub codepoints_len: usize,
1428    pub identifier_type: &'static str,
1429}
1430
1431#[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)]
1432#[diag("found both `{$existing_sym}` and `{$sym}` as identifiers, which look alike")]
1433pub(crate) struct ConfusableIdentifierPair {
1434    pub existing_sym: Symbol,
1435    pub sym: Symbol,
1436    #[label("other identifier used here")]
1437    pub label: Span,
1438    #[label("this identifier can be confused with `{$existing_sym}`")]
1439    pub main_label: Span,
1440}
1441
1442#[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)]
1443#[diag(
1444    "the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables"
1445)]
1446#[note("the usage includes {$includes}")]
1447#[note("please recheck to make sure their usages are indeed what you want")]
1448pub(crate) struct MixedScriptConfusables {
1449    pub set: String,
1450    pub includes: String,
1451}
1452
1453// non_fmt_panic.rs
1454pub(crate) struct NonFmtPanicUnused {
1455    pub count: usize,
1456    pub suggestion: Option<Span>,
1457}
1458
1459// Used because of two suggestions based on one Option<Span>
1460impl<'a> Diagnostic<'a, ()> for NonFmtPanicUnused {
1461    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
1462        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!(
1463            "panic message contains {$count ->
1464                [one] an unused
1465                *[other] unused
1466            } formatting {$count ->
1467                [one] placeholder
1468                *[other] placeholders
1469            }"
1470        ))
1471            .with_arg("count", self.count)
1472            .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"));
1473        if let Some(span) = self.suggestion {
1474            diag.span_suggestion(
1475                span.shrink_to_hi(),
1476                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the missing {$count ->\n                        [one] argument\n                        *[other] arguments\n                    }"))msg!(
1477                    "add the missing {$count ->
1478                        [one] argument
1479                        *[other] arguments
1480                    }"
1481                ),
1482                ", ...",
1483                Applicability::HasPlaceholders,
1484            );
1485            diag.span_suggestion(
1486                span.shrink_to_lo(),
1487                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"#),
1488                "\"{}\", ",
1489                Applicability::MachineApplicable,
1490            );
1491        }
1492        diag
1493    }
1494}
1495
1496#[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_41 =
                            [::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_41, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1497#[diag(
1498    "panic message contains {$count ->
1499        [one] a brace
1500        *[other] braces
1501    }"
1502)]
1503#[note("this message is not used as a format string, but will be in Rust 2021")]
1504pub(crate) struct NonFmtPanicBraces {
1505    pub count: usize,
1506    #[suggestion(
1507        "add a \"{\"{\"}{\"}\"}\" format string to use the message literally",
1508        code = "\"{{}}\", ",
1509        applicability = "machine-applicable"
1510    )]
1511    pub suggestion: Option<Span>,
1512}
1513
1514// nonstandard_style.rs
1515#[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)]
1516#[diag("{$sort} `{$name}` should have an upper camel case name")]
1517pub(crate) struct NonCamelCaseType<'a> {
1518    pub sort: &'a str,
1519    pub name: &'a str,
1520    #[subdiagnostic]
1521    pub sub: NonCamelCaseTypeSub,
1522}
1523
1524#[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 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("should have an UpperCamelCase name")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    NonCamelCaseTypeSub::Suggestion {
                        span: __binding_0, replace: __binding_1 } => {
                        let __code_42 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replace", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper camel case")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_42, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1525pub(crate) enum NonCamelCaseTypeSub {
1526    #[label("should have an UpperCamelCase name")]
1527    Label {
1528        #[primary_span]
1529        span: Span,
1530    },
1531    #[suggestion(
1532        "convert the identifier to upper camel case",
1533        code = "{replace}",
1534        applicability = "maybe-incorrect"
1535    )]
1536    Suggestion {
1537        #[primary_span]
1538        span: Span,
1539        replace: String,
1540    },
1541}
1542
1543#[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,
                        sc: __binding_2,
                        sub: __binding_3 } => {
                        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.arg("sc", __binding_2);
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1544#[diag("{$sort} `{$name}` should have a snake case name")]
1545pub(crate) struct NonSnakeCaseDiag<'a> {
1546    pub sort: &'a str,
1547    pub name: &'a str,
1548    pub sc: String,
1549    #[subdiagnostic]
1550    pub sub: NonSnakeCaseDiagSub,
1551}
1552
1553pub(crate) enum NonSnakeCaseDiagSub {
1554    Label { span: Span },
1555    Help,
1556    RenameOrConvertSuggestion { span: Span, suggestion: Ident },
1557    ConvertSuggestion { span: Span, suggestion: String },
1558    SuggestionAndNote { span: Span },
1559}
1560
1561impl Subdiagnostic for NonSnakeCaseDiagSub {
1562    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1563        match self {
1564            NonSnakeCaseDiagSub::Label { span } => {
1565                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"));
1566            }
1567            NonSnakeCaseDiagSub::Help => {
1568                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}`"));
1569            }
1570            NonSnakeCaseDiagSub::ConvertSuggestion { span, suggestion } => {
1571                diag.span_suggestion(
1572                    span,
1573                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to snake case"))msg!("convert the identifier to snake case"),
1574                    suggestion,
1575                    Applicability::MaybeIncorrect,
1576                );
1577            }
1578            NonSnakeCaseDiagSub::RenameOrConvertSuggestion { span, suggestion } => {
1579                diag.span_suggestion(
1580                    span,
1581                    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"),
1582                    suggestion,
1583                    Applicability::MaybeIncorrect,
1584                );
1585            }
1586            NonSnakeCaseDiagSub::SuggestionAndNote { span } => {
1587                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"));
1588                diag.span_suggestion(
1589                    span,
1590                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rename the identifier"))msg!("rename the identifier"),
1591                    "",
1592                    Applicability::MaybeIncorrect,
1593                );
1594            }
1595        }
1596    }
1597}
1598
1599#[derive(const _: () =
    {
        impl<'__a, 'a> rustc_errors::LintDiagnostic<'__a, ()> for
            NonUpperCaseGlobal<'a> {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    NonUpperCaseGlobal {
                        sort: __binding_0,
                        name: __binding_1,
                        sub: __binding_2,
                        usages: __binding_3 } => {
                        diag.primary_message(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
                    }
                };
            }
        }
    };LintDiagnostic)]
1600#[diag("{$sort} `{$name}` should have an upper case name")]
1601pub(crate) struct NonUpperCaseGlobal<'a> {
1602    pub sort: &'a str,
1603    pub name: &'a str,
1604    #[subdiagnostic]
1605    pub sub: NonUpperCaseGlobalSub,
1606    #[subdiagnostic]
1607    pub usages: Vec<NonUpperCaseGlobalSubTool>,
1608}
1609
1610#[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 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("should have an UPPER_CASE name")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    NonUpperCaseGlobalSub::Suggestion {
                        span: __binding_0,
                        applicability: __binding_1,
                        replace: __binding_2 } => {
                        let __code_43 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replace", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper case")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_43, __binding_1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1611pub(crate) enum NonUpperCaseGlobalSub {
1612    #[label("should have an UPPER_CASE name")]
1613    Label {
1614        #[primary_span]
1615        span: Span,
1616    },
1617    #[suggestion("convert the identifier to upper case", code = "{replace}")]
1618    Suggestion {
1619        #[primary_span]
1620        span: Span,
1621        #[applicability]
1622        applicability: Applicability,
1623        replace: String,
1624    },
1625}
1626
1627#[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_44 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replace", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert the identifier to upper case")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_44, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1628#[suggestion(
1629    "convert the identifier to upper case",
1630    code = "{replace}",
1631    applicability = "machine-applicable",
1632    style = "tool-only"
1633)]
1634pub(crate) struct NonUpperCaseGlobalSubTool {
1635    #[primary_span]
1636    pub(crate) span: Span,
1637    pub(crate) replace: String,
1638}
1639
1640// noop_method_call.rs
1641#[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_45 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let __code_46 =
                            [::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_45, 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_46, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1642#[diag("call to `.{$method}()` on a reference in this situation does nothing")]
1643#[note(
1644    "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"
1645)]
1646pub(crate) struct NoopMethodCallDiag<'a> {
1647    pub method: Ident,
1648    pub orig_ty: Ty<'a>,
1649    pub trait_: Symbol,
1650    #[suggestion("remove this redundant call", code = "", applicability = "machine-applicable")]
1651    pub label: Span,
1652    #[suggestion(
1653        "if you meant to clone `{$orig_ty}`, implement `Clone` for it",
1654        code = "#[derive(Clone)]\n",
1655        applicability = "maybe-incorrect"
1656    )]
1657    pub suggest_derive: Option<Span>,
1658}
1659
1660#[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)]
1661#[diag(
1662    "using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type"
1663)]
1664pub(crate) struct SuspiciousDoubleRefDerefDiag<'a> {
1665    pub ty: Ty<'a>,
1666}
1667
1668#[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)]
1669#[diag(
1670    "using `.clone()` on a double reference, which returns `{$ty}` instead of cloning the inner type"
1671)]
1672pub(crate) struct SuspiciousDoubleRefCloneDiag<'a> {
1673    pub ty: Ty<'a>,
1674}
1675
1676// non_local_defs.rs
1677pub(crate) enum NonLocalDefinitionsDiag {
1678    Impl {
1679        depth: u32,
1680        body_kind_descr: &'static str,
1681        body_name: String,
1682        cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
1683        const_anon: Option<Option<Span>>,
1684        doctest: bool,
1685        macro_to_change: Option<(String, &'static str)>,
1686    },
1687    MacroRules {
1688        depth: u32,
1689        body_kind_descr: &'static str,
1690        body_name: String,
1691        doctest: bool,
1692        cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
1693    },
1694}
1695
1696impl<'a> Diagnostic<'a, ()> for NonLocalDefinitionsDiag {
1697    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
1698        let mut diag = Diag::new(dcx, level, "");
1699        match self {
1700            NonLocalDefinitionsDiag::Impl {
1701                depth,
1702                body_kind_descr,
1703                body_name,
1704                cargo_update,
1705                const_anon,
1706                doctest,
1707                macro_to_change,
1708            } => {
1709                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"));
1710                diag.arg("depth", depth);
1711                diag.arg("body_kind_descr", body_kind_descr);
1712                diag.arg("body_name", body_name);
1713
1714                if let Some((macro_to_change, macro_kind)) = macro_to_change {
1715                    diag.arg("macro_to_change", macro_to_change);
1716                    diag.arg("macro_kind", macro_kind);
1717                    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"));
1718                }
1719                if let Some(cargo_update) = cargo_update {
1720                    diag.subdiagnostic(cargo_update);
1721                }
1722
1723                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`"));
1724
1725                if doctest {
1726                    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() {\"{\"} ... {\"}\"}`"));
1727                }
1728
1729                if let Some(const_anon) = const_anon {
1730                    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"));
1731                    if let Some(const_anon) = const_anon {
1732                        diag.span_suggestion(
1733                            const_anon,
1734                            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"),
1735                            "_",
1736                            Applicability::MachineApplicable,
1737                        );
1738                    }
1739                }
1740            }
1741            NonLocalDefinitionsDiag::MacroRules {
1742                depth,
1743                body_kind_descr,
1744                body_name,
1745                doctest,
1746                cargo_update,
1747            } => {
1748                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"));
1749                diag.arg("depth", depth);
1750                diag.arg("body_kind_descr", body_kind_descr);
1751                diag.arg("body_name", body_name);
1752
1753                if doctest {
1754                    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() {"{"} ... {"}"}`"#));
1755                } else {
1756                    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!(
1757                        "remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr} {$depth ->
1758                            [one] `{$body_name}`
1759                            *[other] `{$body_name}` and up {$depth} bodies
1760                        }"
1761                    ));
1762                }
1763
1764                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"));
1765
1766                if let Some(cargo_update) = cargo_update {
1767                    diag.subdiagnostic(cargo_update);
1768                }
1769            }
1770        }
1771        diag
1772    }
1773}
1774
1775#[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 } => {
                        diag.store_args();
                        diag.arg("macro_kind", __binding_0);
                        diag.arg("macro_name", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        let __message =
                            diag.eagerly_translate(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}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1776#[note(
1777    "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}`"
1778)]
1779pub(crate) struct NonLocalDefinitionsCargoUpdateNote {
1780    pub macro_kind: &'static str,
1781    pub macro_name: Symbol,
1782    pub crate_name: Symbol,
1783}
1784
1785// precedence.rs
1786#[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)]
1787#[diag("`-` has lower precedence than method calls, which might be unexpected")]
1788#[note("e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`")]
1789pub(crate) struct AmbiguousNegativeLiteralsDiag {
1790    #[subdiagnostic]
1791    pub negative_literal: AmbiguousNegativeLiteralsNegativeLiteralSuggestion,
1792    #[subdiagnostic]
1793    pub current_behavior: AmbiguousNegativeLiteralsCurrentBehaviorSuggestion,
1794}
1795
1796#[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_47 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_48 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_47));
                        suggestions.push((__binding_1, __code_48));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses around the `-` and the literal to call the method on a negative literal")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1797#[multipart_suggestion(
1798    "add parentheses around the `-` and the literal to call the method on a negative literal",
1799    applicability = "maybe-incorrect"
1800)]
1801pub(crate) struct AmbiguousNegativeLiteralsNegativeLiteralSuggestion {
1802    #[suggestion_part(code = "(")]
1803    pub start_span: Span,
1804    #[suggestion_part(code = ")")]
1805    pub end_span: Span,
1806}
1807
1808#[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_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));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add parentheses around the literal and the method call to keep the current behavior")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1809#[multipart_suggestion(
1810    "add parentheses around the literal and the method call to keep the current behavior",
1811    applicability = "maybe-incorrect"
1812)]
1813pub(crate) struct AmbiguousNegativeLiteralsCurrentBehaviorSuggestion {
1814    #[suggestion_part(code = "(")]
1815    pub start_span: Span,
1816    #[suggestion_part(code = ")")]
1817    pub end_span: Span,
1818}
1819
1820// disallowed_pass_by_ref.rs
1821#[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_51 =
                            [::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_51, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1822#[diag("passing `{$ty}` by reference")]
1823pub(crate) struct DisallowedPassByRefDiag {
1824    pub ty: String,
1825    #[suggestion("try passing by value", code = "{ty}", applicability = "maybe-incorrect")]
1826    pub suggestion: Span,
1827}
1828
1829// redundant_semicolon.rs
1830#[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)]
1831#[diag(
1832    "unnecessary trailing {$multiple ->
1833        [true] semicolons
1834        *[false] semicolon
1835    }"
1836)]
1837pub(crate) struct RedundantSemicolonsDiag {
1838    pub multiple: bool,
1839    #[subdiagnostic]
1840    pub suggestion: Option<RedundantSemicolonsSuggestion>,
1841}
1842
1843#[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_52 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("multiple_semicolons", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove {$multiple_semicolons ->\n        [true] these semicolons\n        *[false] this semicolon\n    }")));
                        diag.span_suggestions_with_style(__binding_1, __message,
                            __code_52, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1844#[suggestion(
1845    "remove {$multiple_semicolons ->
1846        [true] these semicolons
1847        *[false] this semicolon
1848    }",
1849    code = "",
1850    applicability = "maybe-incorrect"
1851)]
1852pub(crate) struct RedundantSemicolonsSuggestion {
1853    pub multiple_semicolons: bool,
1854    #[primary_span]
1855    pub span: Span,
1856}
1857
1858// traits.rs
1859pub(crate) struct DropTraitConstraintsDiag<'a> {
1860    pub predicate: Clause<'a>,
1861    pub tcx: TyCtxt<'a>,
1862    pub def_id: DefId,
1863}
1864
1865// Needed for def_path_str
1866impl<'a> Diagnostic<'a, ()> for DropTraitConstraintsDiag<'_> {
1867    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
1868        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"))
1869            .with_arg("predicate", self.predicate)
1870            .with_arg("needs_drop", self.tcx.def_path_str(self.def_id))
1871    }
1872}
1873
1874pub(crate) struct DropGlue<'a> {
1875    pub tcx: TyCtxt<'a>,
1876    pub def_id: DefId,
1877}
1878
1879// Needed for def_path_str
1880impl<'a> Diagnostic<'a, ()> for DropGlue<'_> {
1881    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
1882        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"))
1883            .with_arg("needs_drop", self.tcx.def_path_str(self.def_id))
1884    }
1885}
1886
1887// transmute.rs
1888#[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)]
1889#[diag("transmuting an integer to a pointer creates a pointer without provenance")]
1890#[note("this is dangerous because dereferencing the resulting pointer is undefined behavior")]
1891#[note(
1892    "exposed provenance semantics can be used to create a pointer based on some previously exposed provenance"
1893)]
1894#[help(
1895    "if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`"
1896)]
1897#[help(
1898    "for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>"
1899)]
1900#[help(
1901    "for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>"
1902)]
1903pub(crate) struct IntegerToPtrTransmutes<'tcx> {
1904    #[subdiagnostic]
1905    pub suggestion: Option<IntegerToPtrTransmutesSuggestion<'tcx>>,
1906}
1907
1908#[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_53 =
                            ::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_53));
                        diag.store_args();
                        diag.arg("dst", __binding_0);
                        diag.arg("suffix", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    IntegerToPtrTransmutesSuggestion::ToRef {
                        dst: __binding_0,
                        suffix: __binding_1,
                        ref_mutbl: __binding_2,
                        start_call: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_54 =
                            ::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_54));
                        diag.store_args();
                        diag.arg("dst", __binding_0);
                        diag.arg("suffix", __binding_1);
                        diag.arg("ref_mutbl", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1909pub(crate) enum IntegerToPtrTransmutesSuggestion<'tcx> {
1910    #[multipart_suggestion(
1911        "use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
1912        applicability = "machine-applicable",
1913        style = "verbose"
1914    )]
1915    ToPtr {
1916        dst: Ty<'tcx>,
1917        suffix: &'static str,
1918        #[suggestion_part(code = "std::ptr::with_exposed_provenance{suffix}::<{dst}>(")]
1919        start_call: Span,
1920    },
1921    #[multipart_suggestion(
1922        "use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
1923        applicability = "machine-applicable",
1924        style = "verbose"
1925    )]
1926    ToRef {
1927        dst: Ty<'tcx>,
1928        suffix: &'static str,
1929        ref_mutbl: &'static str,
1930        #[suggestion_part(
1931            code = "&{ref_mutbl}*std::ptr::with_exposed_provenance{suffix}::<{dst}>("
1932        )]
1933        start_call: Span,
1934    },
1935}
1936
1937// types.rs
1938#[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)]
1939#[diag("range endpoint is out of range for `{$ty}`")]
1940pub(crate) struct RangeEndpointOutOfRange<'a> {
1941    pub ty: &'a str,
1942    #[subdiagnostic]
1943    pub sub: UseInclusiveRange<'a>,
1944}
1945
1946#[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_55 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}..={0}{2}",
                                                        __binding_2, __binding_1, __binding_3))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("start", __binding_1);
                        diag.arg("literal", __binding_2);
                        diag.arg("suffix", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use an inclusive range instead")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_55, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    UseInclusiveRange::WithParen {
                        eq_sugg: __binding_0,
                        lit_sugg: __binding_1,
                        literal: __binding_2,
                        suffix: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_56 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("="))
                                });
                        let __code_57 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}{1}", __binding_2,
                                            __binding_3))
                                });
                        suggestions.push((__binding_0, __code_56));
                        suggestions.push((__binding_1, __code_57));
                        diag.store_args();
                        diag.arg("literal", __binding_2);
                        diag.arg("suffix", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use an inclusive range instead")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1947pub(crate) enum UseInclusiveRange<'a> {
1948    #[suggestion(
1949        "use an inclusive range instead",
1950        code = "{start}..={literal}{suffix}",
1951        applicability = "machine-applicable"
1952    )]
1953    WithoutParen {
1954        #[primary_span]
1955        sugg: Span,
1956        start: String,
1957        literal: u128,
1958        suffix: &'a str,
1959    },
1960    #[multipart_suggestion("use an inclusive range instead", applicability = "machine-applicable")]
1961    WithParen {
1962        #[suggestion_part(code = "=")]
1963        eq_sugg: Span,
1964        #[suggestion_part(code = "{literal}{suffix}")]
1965        lit_sugg: Span,
1966        literal: u128,
1967        suffix: &'a str,
1968    },
1969}
1970
1971#[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,
                        lit: __binding_1,
                        dec: __binding_2,
                        actually: __binding_3,
                        sign: __binding_4,
                        sub: __binding_5,
                        sign_bit_sub: __binding_6 } => {
                        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.arg("lit", __binding_1);
                        diag.arg("dec", __binding_2);
                        diag.arg("actually", __binding_3);
                        diag.subdiagnostic(__binding_4);
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1972#[diag("literal out of range for `{$ty}`")]
1973pub(crate) struct OverflowingBinHex<'a> {
1974    pub ty: &'a str,
1975    pub lit: String,
1976    pub dec: u128,
1977    pub actually: String,
1978    #[subdiagnostic]
1979    pub sign: OverflowingBinHexSign,
1980    #[subdiagnostic]
1981    pub sub: Option<OverflowingBinHexSub<'a>>,
1982    #[subdiagnostic]
1983    pub sign_bit_sub: Option<OverflowingBinHexSignBitSub<'a>>,
1984}
1985
1986#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OverflowingBinHexSign {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OverflowingBinHexSign::Positive => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(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}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    OverflowingBinHexSign::Negative => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`")));
                        diag.note(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("and the value `-{$lit}` will become `{$actually}{$ty}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1987pub(crate) enum OverflowingBinHexSign {
1988    #[note(
1989        "the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}` and will become `{$actually}{$ty}`"
1990    )]
1991    Positive,
1992    #[note("the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`")]
1993    #[note("and the value `-{$lit}` will become `{$actually}{$ty}`")]
1994    Negative,
1995}
1996
1997#[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_58 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}{1}", __binding_2,
                                                        __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("suggestion_ty", __binding_1);
                        diag.arg("sans_suffix", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_58, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    OverflowingBinHexSub::Help { suggestion_ty: __binding_0 } =>
                        {
                        diag.store_args();
                        diag.arg("suggestion_ty", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1998pub(crate) enum OverflowingBinHexSub<'a> {
1999    #[suggestion(
2000        "consider using the type `{$suggestion_ty}` instead",
2001        code = "{sans_suffix}{suggestion_ty}",
2002        applicability = "machine-applicable"
2003    )]
2004    Suggestion {
2005        #[primary_span]
2006        span: Span,
2007        suggestion_ty: &'a str,
2008        sans_suffix: &'a str,
2009    },
2010    #[help("consider using the type `{$suggestion_ty}` instead")]
2011    Help { suggestion_ty: &'a str },
2012}
2013
2014#[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_59 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}{2} as {0}",
                                                        __binding_4, __binding_1, __binding_3))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("lit_no_suffix", __binding_1);
                        diag.arg("negative_val", __binding_2);
                        diag.arg("uint_ty", __binding_3);
                        diag.arg("int_ty", __binding_4);
                        let __message =
                            diag.eagerly_translate(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}`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_59, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2015#[suggestion(
2016    "to use as a negative number (decimal `{$negative_val}`), consider using the type `{$uint_ty}` for the literal and cast it to `{$int_ty}`",
2017    code = "{lit_no_suffix}{uint_ty} as {int_ty}",
2018    applicability = "maybe-incorrect"
2019)]
2020pub(crate) struct OverflowingBinHexSignBitSub<'a> {
2021    #[primary_span]
2022    pub span: Span,
2023    pub lit_no_suffix: &'a str,
2024    pub negative_val: String,
2025    pub uint_ty: &'a str,
2026    pub int_ty: &'a str,
2027}
2028
2029#[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)]
2030#[diag("literal out of range for `{$ty}`")]
2031#[note("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")]
2032pub(crate) struct OverflowingInt<'a> {
2033    pub ty: &'a str,
2034    pub lit: String,
2035    pub min: i128,
2036    pub max: u128,
2037    #[subdiagnostic]
2038    pub help: Option<OverflowingIntHelp<'a>>,
2039}
2040
2041#[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 } => {
                        diag.store_args();
                        diag.arg("suggestion_ty", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the type `{$suggestion_ty}` instead")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2042#[help("consider using the type `{$suggestion_ty}` instead")]
2043pub(crate) struct OverflowingIntHelp<'a> {
2044    pub suggestion_ty: &'a str,
2045}
2046
2047#[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_60 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\'\\u{{{0:X}}}\'",
                                                        __binding_1))
                                            })].into_iter();
                        ;
                        diag.arg("literal", __binding_1);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a `char` literal instead")),
                            __code_60, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2048#[diag("only `u8` can be cast into `char`")]
2049pub(crate) struct OnlyCastu8ToChar {
2050    #[suggestion(
2051        "use a `char` literal instead",
2052        code = "'\\u{{{literal:X}}}'",
2053        applicability = "machine-applicable"
2054    )]
2055    pub span: Span,
2056    pub literal: u128,
2057}
2058
2059#[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)]
2060#[diag("literal out of range for `{$ty}`")]
2061#[note("the literal `{$lit}` does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")]
2062pub(crate) struct OverflowingUInt<'a> {
2063    pub ty: &'a str,
2064    pub lit: String,
2065    pub min: u128,
2066    pub max: u128,
2067}
2068
2069#[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)]
2070#[diag("literal out of range for `{$ty}`")]
2071#[note(
2072    "the literal `{$lit}` does not fit into the type `{$ty}` and will be converted to `{$ty}::INFINITY`"
2073)]
2074pub(crate) struct OverflowingLiteral<'a> {
2075    pub ty: &'a str,
2076    pub lit: String,
2077}
2078
2079#[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.arg("literal", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2080#[diag("surrogate values are not valid for `char`")]
2081#[note("`0xD800..=0xDFFF` are reserved for Unicode surrogates and are not valid `char` values")]
2082pub(crate) struct SurrogateCharCast {
2083    pub literal: u128,
2084}
2085
2086#[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.arg("literal", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2087#[diag("value exceeds maximum `char` value")]
2088#[note("maximum valid `char` value is `0x10FFFF`")]
2089pub(crate) struct TooLargeCharCast {
2090    pub literal: u128,
2091}
2092
2093#[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)]
2094#[diag(
2095    "repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type"
2096)]
2097pub(crate) struct UsesPowerAlignment;
2098
2099#[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)]
2100#[diag("comparison is useless due to type limits")]
2101pub(crate) struct UnusedComparisons;
2102
2103#[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)]
2104pub(crate) enum InvalidNanComparisons {
2105    #[diag("incorrect NaN comparison, NaN cannot be directly compared to itself")]
2106    EqNe {
2107        #[subdiagnostic]
2108        suggestion: InvalidNanComparisonsSuggestion,
2109    },
2110    #[diag("incorrect NaN comparison, NaN is not orderable")]
2111    LtLeGtGe,
2112}
2113
2114#[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_61 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("!"))
                                });
                        let __code_62 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(".is_nan()"))
                                });
                        let __code_63 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        if let Some(__binding_0) = __binding_0 {
                            suggestions.push((__binding_0, __code_61));
                        }
                        suggestions.push((__binding_1, __code_62));
                        suggestions.push((__binding_2, __code_63));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `f32::is_nan()` or `f64::is_nan()` instead")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    InvalidNanComparisonsSuggestion::Spanless => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `f32::is_nan()` or `f64::is_nan()` instead")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2115pub(crate) enum InvalidNanComparisonsSuggestion {
2116    #[multipart_suggestion(
2117        "use `f32::is_nan()` or `f64::is_nan()` instead",
2118        style = "verbose",
2119        applicability = "machine-applicable"
2120    )]
2121    Spanful {
2122        #[suggestion_part(code = "!")]
2123        neg: Option<Span>,
2124        #[suggestion_part(code = ".is_nan()")]
2125        float: Span,
2126        #[suggestion_part(code = "")]
2127        nan_plus_binop: Span,
2128    },
2129    #[help("use `f32::is_nan()` or `f64::is_nan()` instead")]
2130    Spanless,
2131}
2132
2133#[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)]
2134pub(crate) enum AmbiguousWidePointerComparisons<'a> {
2135    #[diag(
2136        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2137    )]
2138    SpanfulEq {
2139        #[subdiagnostic]
2140        addr_suggestion: AmbiguousWidePointerComparisonsAddrSuggestion<'a>,
2141        #[subdiagnostic]
2142        addr_metadata_suggestion: Option<AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a>>,
2143    },
2144    #[diag(
2145        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2146    )]
2147    SpanfulCmp {
2148        #[subdiagnostic]
2149        cast_suggestion: AmbiguousWidePointerComparisonsCastSuggestion<'a>,
2150        #[subdiagnostic]
2151        expect_suggestion: AmbiguousWidePointerComparisonsExpectSuggestion<'a>,
2152    },
2153    #[diag(
2154        "ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
2155    )]
2156    #[help("use explicit `std::ptr::eq` method to compare metadata and addresses")]
2157    #[help("use `std::ptr::addr_eq` or untyped pointers to only compare their addresses")]
2158    Spanless,
2159}
2160
2161#[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_64 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}std::ptr::eq({0}",
                                            __binding_1, __binding_0))
                                });
                        let __code_65 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}, {0}", __binding_2,
                                            __binding_3))
                                });
                        let __code_66 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0})", __binding_4))
                                });
                        suggestions.push((__binding_5, __code_64));
                        suggestions.push((__binding_6, __code_65));
                        suggestions.push((__binding_7, __code_66));
                        diag.store_args();
                        diag.arg("ne", __binding_0);
                        diag.arg("deref_left", __binding_1);
                        diag.arg("deref_right", __binding_2);
                        diag.arg("l_modifiers", __binding_3);
                        diag.arg("r_modifiers", __binding_4);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use explicit `std::ptr::eq` method to compare metadata and addresses")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2162#[multipart_suggestion(
2163    "use explicit `std::ptr::eq` method to compare metadata and addresses",
2164    style = "verbose",
2165    // FIXME(#53934): make machine-applicable again
2166    applicability = "maybe-incorrect"
2167)]
2168pub(crate) struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> {
2169    pub ne: &'a str,
2170    pub deref_left: &'a str,
2171    pub deref_right: &'a str,
2172    pub l_modifiers: &'a str,
2173    pub r_modifiers: &'a str,
2174    #[suggestion_part(code = "{ne}std::ptr::eq({deref_left}")]
2175    pub left: Span,
2176    #[suggestion_part(code = "{l_modifiers}, {deref_right}")]
2177    pub middle: Span,
2178    #[suggestion_part(code = "{r_modifiers})")]
2179    pub right: Span,
2180}
2181
2182#[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_67 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}std::ptr::addr_eq({0}",
                                            __binding_1, __binding_0))
                                });
                        let __code_68 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}, {0}", __binding_2,
                                            __binding_3))
                                });
                        let __code_69 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0})", __binding_4))
                                });
                        suggestions.push((__binding_5, __code_67));
                        suggestions.push((__binding_6, __code_68));
                        suggestions.push((__binding_7, __code_69));
                        diag.store_args();
                        diag.arg("ne", __binding_0);
                        diag.arg("deref_left", __binding_1);
                        diag.arg("deref_right", __binding_2);
                        diag.arg("l_modifiers", __binding_3);
                        diag.arg("r_modifiers", __binding_4);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `std::ptr::addr_eq` or untyped pointers to only compare their addresses")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2183#[multipart_suggestion(
2184    "use `std::ptr::addr_eq` or untyped pointers to only compare their addresses",
2185    style = "verbose",
2186    // FIXME(#53934): make machine-applicable again
2187    applicability = "maybe-incorrect"
2188)]
2189pub(crate) struct AmbiguousWidePointerComparisonsAddrSuggestion<'a> {
2190    pub(crate) ne: &'a str,
2191    pub(crate) deref_left: &'a str,
2192    pub(crate) deref_right: &'a str,
2193    pub(crate) l_modifiers: &'a str,
2194    pub(crate) r_modifiers: &'a str,
2195    #[suggestion_part(code = "{ne}std::ptr::addr_eq({deref_left}")]
2196    pub(crate) left: Span,
2197    #[suggestion_part(code = "{l_modifiers}, {deref_right}")]
2198    pub(crate) middle: Span,
2199    #[suggestion_part(code = "{r_modifiers})")]
2200    pub(crate) right: Span,
2201}
2202
2203#[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_70 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("({0}", __binding_0))
                                });
                        let __code_71 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}{1}.cast::<()>()",
                                            __binding_4, __binding_2))
                                });
                        let __code_72 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("({0}", __binding_1))
                                });
                        let __code_73 =
                            ::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_70));
                        }
                        suggestions.push((__binding_7, __code_71));
                        if let Some(__binding_8) = __binding_8 {
                            suggestions.push((__binding_8, __code_72));
                        }
                        suggestions.push((__binding_9, __code_73));
                        diag.store_args();
                        diag.arg("deref_left", __binding_0);
                        diag.arg("deref_right", __binding_1);
                        diag.arg("paren_left", __binding_2);
                        diag.arg("paren_right", __binding_3);
                        diag.arg("l_modifiers", __binding_4);
                        diag.arg("r_modifiers", __binding_5);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use untyped pointers to only compare their addresses")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2204#[multipart_suggestion(
2205    "use untyped pointers to only compare their addresses",
2206    style = "verbose",
2207    // FIXME(#53934): make machine-applicable again
2208    applicability = "maybe-incorrect"
2209)]
2210pub(crate) struct AmbiguousWidePointerComparisonsCastSuggestion<'a> {
2211    pub(crate) deref_left: &'a str,
2212    pub(crate) deref_right: &'a str,
2213    pub(crate) paren_left: &'a str,
2214    pub(crate) paren_right: &'a str,
2215    pub(crate) l_modifiers: &'a str,
2216    pub(crate) r_modifiers: &'a str,
2217    #[suggestion_part(code = "({deref_left}")]
2218    pub(crate) left_before: Option<Span>,
2219    #[suggestion_part(code = "{l_modifiers}{paren_left}.cast::<()>()")]
2220    pub(crate) left_after: Span,
2221    #[suggestion_part(code = "({deref_right}")]
2222    pub(crate) right_before: Option<Span>,
2223    #[suggestion_part(code = "{r_modifiers}{paren_right}.cast::<()>()")]
2224    pub(crate) right_after: Span,
2225}
2226
2227#[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_74 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{{ #[expect(ambiguous_wide_pointer_comparisons, reason = \"...\")] {0}",
                                            __binding_0))
                                });
                        let __code_75 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0} }}", __binding_1))
                                });
                        suggestions.push((__binding_2, __code_74));
                        suggestions.push((__binding_3, __code_75));
                        diag.store_args();
                        diag.arg("paren_left", __binding_0);
                        diag.arg("paren_right", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or expect the lint to compare the pointers metadata and addresses")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2228#[multipart_suggestion(
2229    "or expect the lint to compare the pointers metadata and addresses",
2230    style = "verbose",
2231    // FIXME(#53934): make machine-applicable again
2232    applicability = "maybe-incorrect"
2233)]
2234pub(crate) struct AmbiguousWidePointerComparisonsExpectSuggestion<'a> {
2235    pub(crate) paren_left: &'a str,
2236    pub(crate) paren_right: &'a str,
2237    // FIXME(#127436): Adjust once resolved
2238    #[suggestion_part(
2239        code = r#"{{ #[expect(ambiguous_wide_pointer_comparisons, reason = "...")] {paren_left}"#
2240    )]
2241    pub(crate) before: Span,
2242    #[suggestion_part(code = "{paren_right} }}")]
2243    pub(crate) after: Span,
2244}
2245
2246#[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)]
2247pub(crate) enum UnpredictableFunctionPointerComparisons<'a, 'tcx> {
2248    #[diag(
2249        "function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique"
2250    )]
2251    #[note("the address of the same function can vary between different codegen units")]
2252    #[note(
2253        "furthermore, different functions could have the same address after being merged together"
2254    )]
2255    #[note(
2256        "for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>"
2257    )]
2258    Suggestion {
2259        #[subdiagnostic]
2260        sugg: UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx>,
2261    },
2262    #[diag(
2263        "function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique"
2264    )]
2265    #[note("the address of the same function can vary between different codegen units")]
2266    #[note(
2267        "furthermore, different functions could have the same address after being merged together"
2268    )]
2269    #[note(
2270        "for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>"
2271    )]
2272    Warn,
2273}
2274
2275#[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_76 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}std::ptr::fn_addr_eq({0}",
                                            __binding_1, __binding_0))
                                });
                        let __code_77 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(", {0}", __binding_2))
                                });
                        let __code_78 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_3, __code_76));
                        suggestions.push((__binding_4, __code_77));
                        suggestions.push((__binding_5, __code_78));
                        diag.store_args();
                        diag.arg("ne", __binding_0);
                        diag.arg("deref_left", __binding_1);
                        diag.arg("deref_right", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    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_79 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{1}std::ptr::fn_addr_eq({0}",
                                            __binding_1, __binding_0))
                                });
                        let __code_80 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(", {0}", __binding_2))
                                });
                        let __code_81 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" as {0})", __binding_3))
                                });
                        suggestions.push((__binding_4, __code_79));
                        suggestions.push((__binding_5, __code_80));
                        suggestions.push((__binding_6, __code_81));
                        diag.store_args();
                        diag.arg("ne", __binding_0);
                        diag.arg("deref_left", __binding_1);
                        diag.arg("deref_right", __binding_2);
                        diag.arg("fn_sig", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2276pub(crate) enum UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx> {
2277    #[multipart_suggestion(
2278        "refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint",
2279        style = "verbose",
2280        applicability = "maybe-incorrect"
2281    )]
2282    FnAddrEq {
2283        ne: &'a str,
2284        deref_left: &'a str,
2285        deref_right: &'a str,
2286        #[suggestion_part(code = "{ne}std::ptr::fn_addr_eq({deref_left}")]
2287        left: Span,
2288        #[suggestion_part(code = ", {deref_right}")]
2289        middle: Span,
2290        #[suggestion_part(code = ")")]
2291        right: Span,
2292    },
2293    #[multipart_suggestion(
2294        "refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint",
2295        style = "verbose",
2296        applicability = "maybe-incorrect"
2297    )]
2298    FnAddrEqWithCast {
2299        ne: &'a str,
2300        deref_left: &'a str,
2301        deref_right: &'a str,
2302        fn_sig: rustc_middle::ty::PolyFnSig<'tcx>,
2303        #[suggestion_part(code = "{ne}std::ptr::fn_addr_eq({deref_left}")]
2304        left: Span,
2305        #[suggestion_part(code = ", {deref_right}")]
2306        middle: Span,
2307        #[suggestion_part(code = " as {fn_sig})")]
2308        right: Span,
2309    },
2310}
2311
2312pub(crate) struct ImproperCTypes<'a> {
2313    pub ty: Ty<'a>,
2314    pub desc: &'a str,
2315    pub label: Span,
2316    pub help: Option<DiagMessage>,
2317    pub note: DiagMessage,
2318    pub span_note: Option<Span>,
2319}
2320
2321// Used because of the complexity of Option<DiagMessage>, DiagMessage, and Option<Span>
2322impl<'a> Diagnostic<'a, ()> for ImproperCTypes<'_> {
2323    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
2324        let mut diag = Diag::new(
2325            dcx,
2326            level,
2327            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"),
2328        )
2329        .with_arg("ty", self.ty)
2330        .with_arg("desc", self.desc)
2331        .with_span_label(self.label, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not FFI-safe"))msg!("not FFI-safe"));
2332        if let Some(help) = self.help {
2333            diag.help(help);
2334        }
2335        diag.note(self.note);
2336        if let Some(note) = self.span_note {
2337            diag.span_note(note, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type is defined here"))msg!("the type is defined here"));
2338        }
2339        diag
2340    }
2341}
2342
2343#[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)]
2344#[diag("passing type `{$ty}` to a function with \"gpu-kernel\" ABI may have unexpected behavior")]
2345#[help("use primitive types and raw pointers to get reliable behavior")]
2346pub(crate) struct ImproperGpuKernelArg<'a> {
2347    pub ty: Ty<'a>,
2348}
2349
2350#[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)]
2351#[diag("function with the \"gpu-kernel\" ABI has a mangled name")]
2352#[help("use `unsafe(no_mangle)` or `unsafe(export_name = \"<name>\")`")]
2353#[note("mangled names make it hard to find the kernel, this is usually not intended")]
2354pub(crate) struct MissingGpuKernelExportName;
2355
2356#[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)]
2357#[diag("enum variant is more than three times larger ({$largest} bytes) than the next largest")]
2358pub(crate) struct VariantSizeDifferencesDiag {
2359    pub largest: u64,
2360}
2361
2362#[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)]
2363#[diag("atomic loads cannot have `Release` or `AcqRel` ordering")]
2364#[help("consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`")]
2365pub(crate) struct AtomicOrderingLoad;
2366
2367#[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)]
2368#[diag("atomic stores cannot have `Acquire` or `AcqRel` ordering")]
2369#[help("consider using ordering modes `Release`, `SeqCst` or `Relaxed`")]
2370pub(crate) struct AtomicOrderingStore;
2371
2372#[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)]
2373#[diag("memory fences cannot have `Relaxed` ordering")]
2374#[help("consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst`")]
2375pub(crate) struct AtomicOrderingFence;
2376
2377#[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)]
2378#[diag(
2379    "`{$method}`'s failure ordering may not be `Release` or `AcqRel`, since a failed `{$method}` does not result in a write"
2380)]
2381#[help("consider using `Acquire` or `Relaxed` failure ordering instead")]
2382pub(crate) struct InvalidAtomicOrderingDiag {
2383    pub method: Symbol,
2384    #[label("invalid failure ordering")]
2385    pub fail_order_arg_span: Span,
2386}
2387
2388// unused.rs
2389#[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)]
2390#[diag("unused {$op} that must be used")]
2391pub(crate) struct UnusedOp<'a> {
2392    pub op: &'a str,
2393    #[label("the {$op} produces a value")]
2394    pub label: Span,
2395    #[subdiagnostic]
2396    pub suggestion: UnusedOpSuggestion,
2397}
2398
2399#[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_82 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let _ = "))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the resulting value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_82, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    UnusedOpSuggestion::BlockTailExpr {
                        before_span: __binding_0, after_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_83 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_84 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(";"))
                                });
                        suggestions.push((__binding_0, __code_83));
                        suggestions.push((__binding_1, __code_84));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the resulting value")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2400pub(crate) enum UnusedOpSuggestion {
2401    #[suggestion(
2402        "use `let _ = ...` to ignore the resulting value",
2403        style = "verbose",
2404        code = "let _ = ",
2405        applicability = "maybe-incorrect"
2406    )]
2407    NormalExpr {
2408        #[primary_span]
2409        span: Span,
2410    },
2411    #[multipart_suggestion(
2412        "use `let _ = ...` to ignore the resulting value",
2413        style = "verbose",
2414        applicability = "maybe-incorrect"
2415    )]
2416    BlockTailExpr {
2417        #[suggestion_part(code = "let _ = ")]
2418        before_span: Span,
2419        #[suggestion_part(code = ";")]
2420        after_span: Span,
2421    },
2422}
2423
2424#[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)]
2425#[diag("unused result of type `{$ty}`")]
2426pub(crate) struct UnusedResult<'a> {
2427    pub ty: Ty<'a>,
2428}
2429
2430// FIXME(davidtwco): this isn't properly translatable because of the
2431// pre/post strings
2432#[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)]
2433#[diag(
2434    "unused {$pre}{$count ->
2435        [one] closure
2436        *[other] closures
2437    }{$post} that must be used"
2438)]
2439#[note("closures are lazy and do nothing unless called")]
2440pub(crate) struct UnusedClosure<'a> {
2441    pub count: usize,
2442    pub pre: &'a str,
2443    pub post: &'a str,
2444}
2445
2446// FIXME(davidtwco): this isn't properly translatable because of the
2447// pre/post strings
2448#[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)]
2449#[diag(
2450    "unused {$pre}{$count ->
2451        [one] coroutine
2452        *[other] coroutine
2453    }{$post} that must be used"
2454)]
2455#[note("coroutines are lazy and do nothing unless resumed")]
2456pub(crate) struct UnusedCoroutine<'a> {
2457    pub count: usize,
2458    pub pre: &'a str,
2459    pub post: &'a str,
2460}
2461
2462// FIXME(davidtwco): this isn't properly translatable because of the pre/post
2463// strings
2464pub(crate) struct UnusedDef<'a, 'b> {
2465    pub pre: &'a str,
2466    pub post: &'a str,
2467    pub cx: &'a LateContext<'b>,
2468    pub def_id: DefId,
2469    pub note: Option<Symbol>,
2470    pub suggestion: Option<UnusedDefSuggestion>,
2471}
2472
2473#[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_85 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let _ = "))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the resulting value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_85, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    UnusedDefSuggestion::BlockTailExpr {
                        before_span: __binding_0, after_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_86 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("let _ = "))
                                });
                        let __code_87 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(";"))
                                });
                        suggestions.push((__binding_0, __code_86));
                        suggestions.push((__binding_1, __code_87));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `let _ = ...` to ignore the resulting value")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2474pub(crate) enum UnusedDefSuggestion {
2475    #[suggestion(
2476        "use `let _ = ...` to ignore the resulting value",
2477        style = "verbose",
2478        code = "let _ = ",
2479        applicability = "maybe-incorrect"
2480    )]
2481    NormalExpr {
2482        #[primary_span]
2483        span: Span,
2484    },
2485    #[multipart_suggestion(
2486        "use `let _ = ...` to ignore the resulting value",
2487        style = "verbose",
2488        applicability = "maybe-incorrect"
2489    )]
2490    BlockTailExpr {
2491        #[suggestion_part(code = "let _ = ")]
2492        before_span: Span,
2493        #[suggestion_part(code = ";")]
2494        after_span: Span,
2495    },
2496}
2497
2498// Needed because of def_path_str
2499impl<'a> Diagnostic<'a, ()> for UnusedDef<'_, '_> {
2500    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
2501        let mut diag =
2502            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"))
2503                .with_arg("pre", self.pre)
2504                .with_arg("post", self.post)
2505                .with_arg("def", self.cx.tcx.def_path_str(self.def_id));
2506        // check for #[must_use = "..."]
2507        if let Some(note) = self.note {
2508            diag.note(note.to_string());
2509        }
2510        if let Some(sugg) = self.suggestion {
2511            diag.subdiagnostic(sugg);
2512        }
2513        diag
2514    }
2515}
2516
2517#[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)]
2518#[diag("path statement drops value")]
2519pub(crate) struct PathStatementDrop {
2520    #[subdiagnostic]
2521    pub sub: PathStatementDropSub,
2522}
2523
2524#[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_88 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("drop({0});",
                                                        __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("snippet", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `drop` to clarify the intent")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_88, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    PathStatementDropSub::Help { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `drop` to clarify the intent")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2525pub(crate) enum PathStatementDropSub {
2526    #[suggestion(
2527        "use `drop` to clarify the intent",
2528        code = "drop({snippet});",
2529        applicability = "machine-applicable"
2530    )]
2531    Suggestion {
2532        #[primary_span]
2533        span: Span,
2534        snippet: String,
2535    },
2536    #[help("use `drop` to clarify the intent")]
2537    Help {
2538        #[primary_span]
2539        span: Span,
2540    },
2541}
2542
2543#[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)]
2544#[diag("path statement with no effect")]
2545pub(crate) struct PathStatementNoEffect;
2546
2547#[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)]
2548#[diag("unnecessary {$delim} around {$item}")]
2549pub(crate) struct UnusedDelim<'a> {
2550    pub delim: &'static str,
2551    pub item: &'a str,
2552    #[subdiagnostic]
2553    pub suggestion: Option<UnusedDelimSuggestion>,
2554}
2555
2556#[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 } => {
                        let mut suggestions = Vec::new();
                        let __code_89 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        let __code_90 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                });
                        suggestions.push((__binding_0, __code_89));
                        suggestions.push((__binding_2, __code_90));
                        diag.store_args();
                        diag.arg("start_replace", __binding_1);
                        diag.arg("end_replace", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove these {$delim}")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2557#[multipart_suggestion("remove these {$delim}", applicability = "machine-applicable")]
2558pub(crate) struct UnusedDelimSuggestion {
2559    #[suggestion_part(code = "{start_replace}")]
2560    pub start_span: Span,
2561    pub start_replace: &'static str,
2562    #[suggestion_part(code = "{end_replace}")]
2563    pub end_span: Span,
2564    pub end_replace: &'static str,
2565}
2566
2567#[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)]
2568#[diag("braces around {$node} is unnecessary")]
2569pub(crate) struct UnusedImportBracesDiag {
2570    pub node: Symbol,
2571}
2572
2573#[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)]
2574#[diag("unnecessary allocation, use `&` instead")]
2575pub(crate) struct UnusedAllocationDiag;
2576
2577#[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)]
2578#[diag("unnecessary allocation, use `&mut` instead")]
2579pub(crate) struct UnusedAllocationMutDiag;
2580
2581pub(crate) struct AsyncFnInTraitDiag {
2582    pub sugg: Option<Vec<(Span, String)>>,
2583}
2584
2585impl<'a> Diagnostic<'a, ()> for AsyncFnInTraitDiag {
2586    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
2587        let mut diag = Diag::new(
2588            dcx,
2589            level,
2590            "use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified",
2591        );
2592        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`");
2593        if let Some(sugg) = self.sugg {
2594            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);
2595        }
2596        diag
2597    }
2598}
2599
2600#[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)]
2601#[diag("binding has unit type `()`")]
2602pub(crate) struct UnitBindingsDiag {
2603    #[label("this pattern is inferred to be the unit type `()`")]
2604    pub label: Span,
2605}
2606
2607#[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)]
2608pub(crate) enum InvalidAsmLabel {
2609    #[diag("avoid using named labels in inline assembly")]
2610    #[help("only local labels of the form `<number>:` should be used in inline asm")]
2611    #[note(
2612        "see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information"
2613    )]
2614    Named {
2615        #[note("the label may be declared in the expansion of a macro")]
2616        missing_precise_span: bool,
2617    },
2618    #[diag("avoid using named labels in inline assembly")]
2619    #[help("only local labels of the form `<number>:` should be used in inline asm")]
2620    #[note("format arguments may expand to a non-numeric value")]
2621    #[note(
2622        "see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information"
2623    )]
2624    FormatArg {
2625        #[note("the label may be declared in the expansion of a macro")]
2626        missing_precise_span: bool,
2627    },
2628    #[diag("avoid using labels containing only the digits `0` and `1` in inline assembly")]
2629    #[help("start numbering with `2` instead")]
2630    #[note("an LLVM bug makes these labels ambiguous with a binary literal number on x86")]
2631    #[note("see <https://github.com/llvm/llvm-project/issues/99547> for more information")]
2632    Binary {
2633        #[note("the label may be declared in the expansion of a macro")]
2634        missing_precise_span: bool,
2635        // hack to get a label on the whole span, must match the emitted span
2636        #[label("use a different label that doesn't start with `0` or `1`")]
2637        span: Span,
2638    },
2639}
2640
2641#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedCfgCargoHelp::LintCfg {
                        cargo_toml_lint_cfg: __binding_0 } => {
                        diag.store_args();
                        diag.arg("cargo_toml_lint_cfg", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using a Cargo feature instead")));
                        diag.help(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
                        cargo_toml_lint_cfg: __binding_0,
                        build_rs_println: __binding_1 } => {
                        diag.store_args();
                        diag.arg("cargo_toml_lint_cfg", __binding_0);
                        diag.arg("build_rs_println", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using a Cargo feature instead")));
                        diag.help(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")));
                        diag.help(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding `{$build_rs_println}` to the top of the `build.rs`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2642pub(crate) enum UnexpectedCfgCargoHelp {
2643    #[help("consider using a Cargo feature instead")]
2644    #[help(
2645        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
2646    )]
2647    LintCfg { cargo_toml_lint_cfg: String },
2648    #[help("consider using a Cargo feature instead")]
2649    #[help(
2650        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
2651    )]
2652    #[help("or consider adding `{$build_rs_println}` to the top of the `build.rs`")]
2653    LintCfgAndBuildRs { cargo_toml_lint_cfg: String, build_rs_println: String },
2654}
2655
2656impl UnexpectedCfgCargoHelp {
2657    fn cargo_toml_lint_cfg(unescaped: &str) -> String {
2658        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\'{0}\'] }}",
                unescaped))
    })format!(
2659            "\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{unescaped}'] }}"
2660        )
2661    }
2662
2663    pub(crate) fn lint_cfg(unescaped: &str) -> Self {
2664        UnexpectedCfgCargoHelp::LintCfg {
2665            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
2666        }
2667    }
2668
2669    pub(crate) fn lint_cfg_and_build_rs(unescaped: &str, escaped: &str) -> Self {
2670        UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
2671            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
2672            build_rs_println: ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("println!(\"cargo::rustc-check-cfg={0}\");",
                escaped))
    })format!("println!(\"cargo::rustc-check-cfg={escaped}\");"),
2673        }
2674    }
2675}
2676
2677#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedCfgRustcHelp { cmdline_arg: __binding_0 } => {
                        diag.store_args();
                        diag.arg("cmdline_arg", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to expect this configuration use `{$cmdline_arg}`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2678#[help("to expect this configuration use `{$cmdline_arg}`")]
2679pub(crate) struct UnexpectedCfgRustcHelp {
2680    pub cmdline_arg: String,
2681}
2682
2683impl UnexpectedCfgRustcHelp {
2684    pub(crate) fn new(unescaped: &str) -> Self {
2685        Self { cmdline_arg: ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("--check-cfg={0}", unescaped))
    })format!("--check-cfg={unescaped}") }
2686    }
2687}
2688
2689#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcMacroHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedCfgRustcMacroHelp {
                        macro_kind: __binding_0, macro_name: __binding_1 } => {
                        diag.store_args();
                        diag.arg("macro_kind", __binding_0);
                        diag.arg("macro_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")));
                        diag.note(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2690#[note(
2691    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
2692)]
2693#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
2694pub(crate) struct UnexpectedCfgRustcMacroHelp {
2695    pub macro_kind: &'static str,
2696    pub macro_name: Symbol,
2697}
2698
2699#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoMacroHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedCfgCargoMacroHelp {
                        macro_kind: __binding_0,
                        macro_name: __binding_1,
                        crate_name: __binding_2 } => {
                        diag.store_args();
                        diag.arg("macro_kind", __binding_0);
                        diag.arg("macro_name", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")));
                        diag.note(__message);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")));
                        diag.help(__message);
                        let __message =
                            diag.eagerly_translate(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}`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2700#[note(
2701    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
2702)]
2703#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
2704#[help(
2705    "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}`"
2706)]
2707pub(crate) struct UnexpectedCfgCargoMacroHelp {
2708    pub macro_kind: &'static str,
2709    pub macro_name: Symbol,
2710    pub crate_name: Symbol,
2711}
2712
2713#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnexpectedCfgName {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnexpectedCfgName {
                        code_sugg: __binding_0,
                        invocation_help: __binding_1,
                        name: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition name: `{$name}`")));
                        ;
                        diag.arg("name", __binding_2);
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
2714#[diag("unexpected `cfg` condition name: `{$name}`")]
2715pub(crate) struct UnexpectedCfgName {
2716    #[subdiagnostic]
2717    pub code_sugg: unexpected_cfg_name::CodeSuggestion,
2718    #[subdiagnostic]
2719    pub invocation_help: unexpected_cfg_name::InvocationHelp,
2720
2721    pub name: Symbol,
2722}
2723
2724pub(crate) mod unexpected_cfg_name {
2725    use rustc_errors::DiagSymbolList;
2726    use rustc_macros::Subdiagnostic;
2727    use rustc_span::{Ident, Span, Symbol};
2728
2729    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CodeSuggestion::DefineFeatures => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    CodeSuggestion::VersionSyntax {
                        between_name_and_value: __binding_0,
                        after_value: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_91 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_92 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_91));
                        suggestions.push((__binding_1, __code_92));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a similar config predicate: `version(\"..\")`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    CodeSuggestion::SimilarNameAndValue {
                        span: __binding_0, code: __binding_1 } => {
                        let __code_93 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_93, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    CodeSuggestion::SimilarNameNoValue {
                        span: __binding_0, code: __binding_1 } => {
                        let __code_94 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and no value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_94, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    CodeSuggestion::SimilarNameDifferentValues {
                        span: __binding_0, code: __binding_1, expected: __binding_2
                        } => {
                        let __code_95 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        if let Some(__binding_2) = __binding_2 {
                            __binding_2.add_to_diag(diag);
                        }
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and different values")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_95, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    CodeSuggestion::SimilarName {
                        span: __binding_0, code: __binding_1, expected: __binding_2
                        } => {
                        let __code_96 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        if let Some(__binding_2) = __binding_2 {
                            __binding_2.add_to_diag(diag);
                        }
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_96, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    CodeSuggestion::SimilarValues {
                        with_similar_values: __binding_0,
                        expected_names: __binding_1 } => {
                        for __binding_0 in __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        diag.store_args();
                        diag.restore_args();
                    }
                    CodeSuggestion::BooleanLiteral {
                        span: __binding_0, literal: __binding_1 } => {
                        let __code_97 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("literal", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_97, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2730    pub(crate) enum CodeSuggestion {
2731        #[help("consider defining some features in `Cargo.toml`")]
2732        DefineFeatures,
2733        #[multipart_suggestion(
2734            "there is a similar config predicate: `version(\"..\")`",
2735            applicability = "machine-applicable"
2736        )]
2737        VersionSyntax {
2738            #[suggestion_part(code = "(")]
2739            between_name_and_value: Span,
2740            #[suggestion_part(code = ")")]
2741            after_value: Span,
2742        },
2743        #[suggestion(
2744            "there is a config with a similar name and value",
2745            applicability = "maybe-incorrect",
2746            code = "{code}"
2747        )]
2748        SimilarNameAndValue {
2749            #[primary_span]
2750            span: Span,
2751            code: String,
2752        },
2753        #[suggestion(
2754            "there is a config with a similar name and no value",
2755            applicability = "maybe-incorrect",
2756            code = "{code}"
2757        )]
2758        SimilarNameNoValue {
2759            #[primary_span]
2760            span: Span,
2761            code: String,
2762        },
2763        #[suggestion(
2764            "there is a config with a similar name and different values",
2765            applicability = "maybe-incorrect",
2766            code = "{code}"
2767        )]
2768        SimilarNameDifferentValues {
2769            #[primary_span]
2770            span: Span,
2771            code: String,
2772            #[subdiagnostic]
2773            expected: Option<ExpectedValues>,
2774        },
2775        #[suggestion(
2776            "there is a config with a similar name",
2777            applicability = "maybe-incorrect",
2778            code = "{code}"
2779        )]
2780        SimilarName {
2781            #[primary_span]
2782            span: Span,
2783            code: String,
2784            #[subdiagnostic]
2785            expected: Option<ExpectedValues>,
2786        },
2787        SimilarValues {
2788            #[subdiagnostic]
2789            with_similar_values: Vec<FoundWithSimilarValue>,
2790            #[subdiagnostic]
2791            expected_names: Option<ExpectedNames>,
2792        },
2793        #[suggestion(
2794            "you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally",
2795            applicability = "machine-applicable",
2796            style = "verbose",
2797            code = "{literal}"
2798        )]
2799        BooleanLiteral {
2800            #[primary_span]
2801            span: Span,
2802            literal: bool,
2803        },
2804    }
2805
2806    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ExpectedValues {
                        best_match: __binding_0, possibilities: __binding_1 } => {
                        diag.store_args();
                        diag.arg("best_match", __binding_0);
                        diag.arg("possibilities", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected values for `{$best_match}` are: {$possibilities}")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2807    #[help("expected values for `{$best_match}` are: {$possibilities}")]
2808    pub(crate) struct ExpectedValues {
2809        pub best_match: Symbol,
2810        pub possibilities: DiagSymbolList,
2811    }
2812
2813    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FoundWithSimilarValue {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FoundWithSimilarValue { span: __binding_0, code: __binding_1
                        } => {
                        let __code_98 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found config with similar value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_98, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2814    #[suggestion(
2815        "found config with similar value",
2816        applicability = "maybe-incorrect",
2817        code = "{code}"
2818    )]
2819    pub(crate) struct FoundWithSimilarValue {
2820        #[primary_span]
2821        pub span: Span,
2822        pub code: String,
2823    }
2824
2825    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedNames {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ExpectedNames {
                        possibilities: __binding_0, and_more: __binding_1 } => {
                        diag.store_args();
                        diag.arg("possibilities", __binding_0);
                        diag.arg("and_more", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected names are: {$possibilities}{$and_more ->\n            [0] {\"\"}\n            *[other] {\" \"}and {$and_more} more\n        }")));
                        diag.help_once(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2826    #[help_once(
2827        "expected names are: {$possibilities}{$and_more ->
2828            [0] {\"\"}
2829            *[other] {\" \"}and {$and_more} more
2830        }"
2831    )]
2832    pub(crate) struct ExpectedNames {
2833        pub possibilities: DiagSymbolList<Ident>,
2834        pub and_more: usize,
2835    }
2836
2837    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvocationHelp::Cargo {
                        macro_help: __binding_0, help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    InvocationHelp::Rustc {
                        macro_help: __binding_0, help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        __binding_1.add_to_diag(diag);
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2838    pub(crate) enum InvocationHelp {
2839        #[note(
2840            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
2841        )]
2842        Cargo {
2843            #[subdiagnostic]
2844            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
2845            #[subdiagnostic]
2846            help: Option<super::UnexpectedCfgCargoHelp>,
2847        },
2848        #[note(
2849            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
2850        )]
2851        Rustc {
2852            #[subdiagnostic]
2853            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
2854            #[subdiagnostic]
2855            help: super::UnexpectedCfgRustcHelp,
2856        },
2857    }
2858}
2859
2860#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnexpectedCfgValue {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnexpectedCfgValue {
                        code_sugg: __binding_0,
                        invocation_help: __binding_1,
                        has_value: __binding_2,
                        value: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition value: {$has_value ->\n        [true] `{$value}`\n        *[false] (none)\n    }")));
                        ;
                        diag.arg("has_value", __binding_2);
                        diag.arg("value", __binding_3);
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
2861#[diag(
2862    "unexpected `cfg` condition value: {$has_value ->
2863        [true] `{$value}`
2864        *[false] (none)
2865    }"
2866)]
2867pub(crate) struct UnexpectedCfgValue {
2868    #[subdiagnostic]
2869    pub code_sugg: unexpected_cfg_value::CodeSuggestion,
2870    #[subdiagnostic]
2871    pub invocation_help: unexpected_cfg_value::InvocationHelp,
2872
2873    pub has_value: bool,
2874    pub value: String,
2875}
2876
2877pub(crate) mod unexpected_cfg_value {
2878    use rustc_errors::DiagSymbolList;
2879    use rustc_macros::Subdiagnostic;
2880    use rustc_span::{Span, Symbol};
2881
2882    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CodeSuggestion::ChangeValue {
                        expected_values: __binding_0, suggestion: __binding_1 } => {
                        __binding_0.add_to_diag(diag);
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        diag.store_args();
                        diag.restore_args();
                    }
                    CodeSuggestion::RemoveValue {
                        suggestion: __binding_0, name: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        diag.store_args();
                        diag.arg("name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no expected value for `{$name}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    CodeSuggestion::RemoveCondition {
                        suggestion: __binding_0, name: __binding_1 } => {
                        __binding_0.add_to_diag(diag);
                        diag.store_args();
                        diag.arg("name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no expected values for `{$name}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2883    pub(crate) enum CodeSuggestion {
2884        ChangeValue {
2885            #[subdiagnostic]
2886            expected_values: ExpectedValues,
2887            #[subdiagnostic]
2888            suggestion: Option<ChangeValueSuggestion>,
2889        },
2890        #[note("no expected value for `{$name}`")]
2891        RemoveValue {
2892            #[subdiagnostic]
2893            suggestion: Option<RemoveValueSuggestion>,
2894
2895            name: Symbol,
2896        },
2897        #[note("no expected values for `{$name}`")]
2898        RemoveCondition {
2899            #[subdiagnostic]
2900            suggestion: RemoveConditionSuggestion,
2901
2902            name: Symbol,
2903        },
2904    }
2905
2906    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeValueSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ChangeValueSuggestion::SimilarName {
                        span: __binding_0, best_match: __binding_1 } => {
                        let __code_99 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("best_match", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a expected value with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_99, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    ChangeValueSuggestion::SpecifyValue {
                        span: __binding_0, first_possibility: __binding_1 } => {
                        let __code_100 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = \"{0}\"",
                                                        __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("first_possibility", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specify a config value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_100, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2907    pub(crate) enum ChangeValueSuggestion {
2908        #[suggestion(
2909            "there is a expected value with a similar name",
2910            code = r#""{best_match}""#,
2911            applicability = "maybe-incorrect"
2912        )]
2913        SimilarName {
2914            #[primary_span]
2915            span: Span,
2916            best_match: Symbol,
2917        },
2918        #[suggestion(
2919            "specify a config value",
2920            code = r#" = "{first_possibility}""#,
2921            applicability = "maybe-incorrect"
2922        )]
2923        SpecifyValue {
2924            #[primary_span]
2925            span: Span,
2926            first_possibility: Symbol,
2927        },
2928    }
2929
2930    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveValueSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RemoveValueSuggestion { span: __binding_0 } => {
                        let __code_101 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the value")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_101, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2931    #[suggestion("remove the value", code = "", applicability = "maybe-incorrect")]
2932    pub(crate) struct RemoveValueSuggestion {
2933        #[primary_span]
2934        pub span: Span,
2935    }
2936
2937    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveConditionSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RemoveConditionSuggestion { span: __binding_0 } => {
                        let __code_102 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the condition")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_102, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2938    #[suggestion("remove the condition", code = "", applicability = "maybe-incorrect")]
2939    pub(crate) struct RemoveConditionSuggestion {
2940        #[primary_span]
2941        pub span: Span,
2942    }
2943
2944    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ExpectedValues {
                        name: __binding_0,
                        have_none_possibility: __binding_1,
                        possibilities: __binding_2,
                        and_more: __binding_3 } => {
                        diag.store_args();
                        diag.arg("name", __binding_0);
                        diag.arg("have_none_possibility", __binding_1);
                        diag.arg("possibilities", __binding_2);
                        diag.arg("and_more", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected values for `{$name}` are: {$have_none_possibility ->\n            [true] {\"(none), \"}\n            *[false] {\"\"}\n        }{$possibilities}{$and_more ->\n            [0] {\"\"}\n            *[other] {\" \"}and {$and_more} more\n        }")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2945    #[note(
2946        "expected values for `{$name}` are: {$have_none_possibility ->
2947            [true] {\"(none), \"}
2948            *[false] {\"\"}
2949        }{$possibilities}{$and_more ->
2950            [0] {\"\"}
2951            *[other] {\" \"}and {$and_more} more
2952        }"
2953    )]
2954    pub(crate) struct ExpectedValues {
2955        pub name: Symbol,
2956        pub have_none_possibility: bool,
2957        pub possibilities: DiagSymbolList,
2958        pub and_more: usize,
2959    }
2960
2961    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvocationHelp::Cargo {
                        help: __binding_0, macro_help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    InvocationHelp::Rustc {
                        help: __binding_0, macro_help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2962    pub(crate) enum InvocationHelp {
2963        #[note(
2964            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
2965        )]
2966        Cargo {
2967            #[subdiagnostic]
2968            help: Option<CargoHelp>,
2969            #[subdiagnostic]
2970            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
2971        },
2972        #[note(
2973            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
2974        )]
2975        Rustc {
2976            #[subdiagnostic]
2977            help: Option<super::UnexpectedCfgRustcHelp>,
2978            #[subdiagnostic]
2979            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
2980        },
2981    }
2982
2983    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CargoHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CargoHelp::AddFeature { value: __binding_0 } => {
                        diag.store_args();
                        diag.arg("value", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding `{$value}` as a feature in `Cargo.toml`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    CargoHelp::DefineFeatures => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    CargoHelp::Other(__binding_0) => {
                        __binding_0.add_to_diag(diag);
                        diag.store_args();
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
2984    pub(crate) enum CargoHelp {
2985        #[help("consider adding `{$value}` as a feature in `Cargo.toml`")]
2986        AddFeature {
2987            value: Symbol,
2988        },
2989        #[help("consider defining some features in `Cargo.toml`")]
2990        DefineFeatures,
2991        Other(#[subdiagnostic] super::UnexpectedCfgCargoHelp),
2992    }
2993}
2994
2995#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnusedCrateDependency {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedCrateDependency {
                        extern_crate: __binding_0, local_crate: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the dependency or add `use {$extern_crate} as _;` to the crate root")));
                        ;
                        diag.arg("extern_crate", __binding_0);
                        diag.arg("local_crate", __binding_1);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
2996#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
2997#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
2998pub(crate) struct UnusedCrateDependency {
2999    pub extern_crate: Symbol,
3000    pub local_crate: Symbol,
3001}
3002
3003// FIXME(jdonszelmann): duplicated in rustc_attr_parsing, should be moved there completely.
3004#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            IllFormedAttributeInput {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    IllFormedAttributeInput {
                        num_suggestions: __binding_0,
                        suggestions: __binding_1,
                        has_docs: __binding_2,
                        docs: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_suggestions ->\n        [1] attribute must be of the form {$suggestions}\n        *[other] valid forms for the attribute are {$suggestions}\n    }")));
                        ;
                        diag.arg("num_suggestions", __binding_0);
                        diag.arg("suggestions", __binding_1);
                        diag.arg("docs", __binding_3);
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <{$docs}>")));
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3005#[diag(
3006    "{$num_suggestions ->
3007        [1] attribute must be of the form {$suggestions}
3008        *[other] valid forms for the attribute are {$suggestions}
3009    }"
3010)]
3011pub(crate) struct IllFormedAttributeInput {
3012    pub num_suggestions: usize,
3013    pub suggestions: DiagArgValue,
3014    #[note("for more information, visit <{$docs}>")]
3015    pub has_docs: bool,
3016    pub docs: &'static str,
3017}
3018
3019#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnicodeTextFlow
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnicodeTextFlow {
                        comment_span: __binding_0,
                        characters: __binding_1,
                        suggestions: __binding_2,
                        num_codepoints: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unicode codepoint changing visible direction of text present in comment")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen")));
                        ;
                        diag.arg("num_codepoints", __binding_3);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_codepoints ->\n            [1] this comment contains an invisible unicode text flow control codepoint\n            *[other] this comment contains invisible unicode text flow control codepoints\n        }")));
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3020#[diag("unicode codepoint changing visible direction of text present in comment")]
3021#[note(
3022    "these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen"
3023)]
3024pub(crate) struct UnicodeTextFlow {
3025    #[label(
3026        "{$num_codepoints ->
3027            [1] this comment contains an invisible unicode text flow control codepoint
3028            *[other] this comment contains invisible unicode text flow control codepoints
3029        }"
3030    )]
3031    pub comment_span: Span,
3032    #[subdiagnostic]
3033    pub characters: Vec<UnicodeCharNoteSub>,
3034    #[subdiagnostic]
3035    pub suggestions: Option<UnicodeTextFlowSuggestion>,
3036
3037    pub num_codepoints: usize,
3038}
3039
3040#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnicodeCharNoteSub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnicodeCharNoteSub { span: __binding_0, c_debug: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("c_debug", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$c_debug}")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3041#[label("{$c_debug}")]
3042pub(crate) struct UnicodeCharNoteSub {
3043    #[primary_span]
3044    pub span: Span,
3045    pub c_debug: String,
3046}
3047
3048#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnicodeTextFlowSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnicodeTextFlowSuggestion { spans: __binding_0 } => {
                        let mut suggestions = Vec::new();
                        let __code_103 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        for __binding_0 in __binding_0 {
                            suggestions.push((__binding_0, __code_103.clone()));
                        }
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if their presence wasn't intentional, you can remove them")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3049#[multipart_suggestion(
3050    "if their presence wasn't intentional, you can remove them",
3051    applicability = "machine-applicable",
3052    style = "hidden"
3053)]
3054pub(crate) struct UnicodeTextFlowSuggestion {
3055    #[suggestion_part(code = "")]
3056    pub spans: Vec<Span>,
3057}
3058
3059#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            AbsPathWithModule {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    AbsPathWithModule { sugg: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3060#[diag(
3061    "absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition"
3062)]
3063pub(crate) struct AbsPathWithModule {
3064    #[subdiagnostic]
3065    pub sugg: AbsPathWithModuleSugg,
3066}
3067
3068#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AbsPathWithModuleSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AbsPathWithModuleSugg {
                        span: __binding_0,
                        applicability: __binding_1,
                        replacement: __binding_2 } => {
                        let __code_104 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("replacement", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `crate`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_104, __binding_1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3069#[suggestion("use `crate`", code = "{replacement}")]
3070pub(crate) struct AbsPathWithModuleSugg {
3071    #[primary_span]
3072    pub span: Span,
3073    #[applicability]
3074    pub applicability: Applicability,
3075    pub replacement: String,
3076}
3077
3078#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ElidedLifetimesInPaths {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ElidedLifetimesInPaths { subdiag: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("hidden lifetime parameters in types are deprecated")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3079#[diag("hidden lifetime parameters in types are deprecated")]
3080pub(crate) struct ElidedLifetimesInPaths {
3081    #[subdiagnostic]
3082    pub subdiag: ElidedLifetimeInPathSubdiag,
3083}
3084
3085#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedImports {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedImports {
                        sugg: __binding_0,
                        test_module_span: __binding_1,
                        span_snippets: __binding_2,
                        num_snippets: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_snippets ->\n        [one] unused import: {$span_snippets}\n        *[other] unused imports: {$span_snippets}\n    }")));
                        ;
                        diag.arg("span_snippets", __binding_2);
                        diag.arg("num_snippets", __binding_3);
                        diag.subdiagnostic(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_help(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if this is a test module, consider adding a `#[cfg(test)]` to the containing module")));
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3086#[diag(
3087    "{$num_snippets ->
3088        [one] unused import: {$span_snippets}
3089        *[other] unused imports: {$span_snippets}
3090    }"
3091)]
3092pub(crate) struct UnusedImports {
3093    #[subdiagnostic]
3094    pub sugg: UnusedImportsSugg,
3095    #[help("if this is a test module, consider adding a `#[cfg(test)]` to the containing module")]
3096    pub test_module_span: Option<Span>,
3097
3098    pub span_snippets: DiagArgValue,
3099    pub num_snippets: usize,
3100}
3101
3102#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedImportsSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnusedImportsSugg::RemoveWholeUse { span: __binding_0 } => {
                        let __code_105 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the whole `use` item")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_105, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.restore_args();
                    }
                    UnusedImportsSugg::RemoveImports {
                        remove_spans: __binding_0, num_to_remove: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_106 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        for __binding_0 in __binding_0 {
                            suggestions.push((__binding_0, __code_106.clone()));
                        }
                        diag.store_args();
                        diag.arg("num_to_remove", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_to_remove ->\n            [one] remove the unused import\n            *[other] remove the unused imports\n        }")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3103pub(crate) enum UnusedImportsSugg {
3104    #[suggestion(
3105        "remove the whole `use` item",
3106        applicability = "machine-applicable",
3107        code = "",
3108        style = "tool-only"
3109    )]
3110    RemoveWholeUse {
3111        #[primary_span]
3112        span: Span,
3113    },
3114    #[multipart_suggestion(
3115        "{$num_to_remove ->
3116            [one] remove the unused import
3117            *[other] remove the unused imports
3118        }",
3119        applicability = "machine-applicable",
3120        style = "tool-only"
3121    )]
3122    RemoveImports {
3123        #[suggestion_part(code = "")]
3124        remove_spans: Vec<Span>,
3125        num_to_remove: usize,
3126    },
3127}
3128
3129#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for RedundantImport
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    RedundantImport { subs: __binding_0, ident: __binding_1 } =>
                        {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item `{$ident}` is imported redundantly")));
                        ;
                        diag.arg("ident", __binding_1);
                        for __binding_0 in __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3130#[diag("the item `{$ident}` is imported redundantly")]
3131pub(crate) struct RedundantImport {
3132    #[subdiagnostic]
3133    pub subs: Vec<RedundantImportSub>,
3134
3135    pub ident: Ident,
3136}
3137
3138#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RedundantImportSub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RedundantImportSub::ImportedHere(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item `{$ident}` is already imported here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    RedundantImportSub::DefinedHere(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item `{$ident}` is already defined here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    RedundantImportSub::ImportedPrelude(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item `{$ident}` is already imported by the extern prelude")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    RedundantImportSub::DefinedPrelude(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item `{$ident}` is already defined by the extern prelude")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3139pub(crate) enum RedundantImportSub {
3140    #[label("the item `{$ident}` is already imported here")]
3141    ImportedHere(#[primary_span] Span),
3142    #[label("the item `{$ident}` is already defined here")]
3143    DefinedHere(#[primary_span] Span),
3144    #[label("the item `{$ident}` is already imported by the extern prelude")]
3145    ImportedPrelude(#[primary_span] Span),
3146    #[label("the item `{$ident}` is already defined by the extern prelude")]
3147    DefinedPrelude(#[primary_span] Span),
3148}
3149
3150#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            PatternsInFnsWithoutBody {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    PatternsInFnsWithoutBody::Foreign { sub: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in foreign function declarations")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                    PatternsInFnsWithoutBody::Bodiless { sub: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in functions without bodies")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3151pub(crate) enum PatternsInFnsWithoutBody {
3152    #[diag("patterns aren't allowed in foreign function declarations")]
3153    Foreign {
3154        #[subdiagnostic]
3155        sub: PatternsInFnsWithoutBodySub,
3156    },
3157    #[diag("patterns aren't allowed in functions without bodies")]
3158    Bodiless {
3159        #[subdiagnostic]
3160        sub: PatternsInFnsWithoutBodySub,
3161    },
3162}
3163
3164#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for PatternsInFnsWithoutBodySub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    PatternsInFnsWithoutBodySub {
                        span: __binding_0, ident: __binding_1 } => {
                        let __code_107 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `mut` from the parameter")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_107, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3165#[suggestion(
3166    "remove `mut` from the parameter",
3167    code = "{ident}",
3168    applicability = "machine-applicable"
3169)]
3170pub(crate) struct PatternsInFnsWithoutBodySub {
3171    #[primary_span]
3172    pub span: Span,
3173
3174    pub ident: Ident,
3175}
3176
3177#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for ReservedPrefix {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ReservedPrefix {
                        label: __binding_0,
                        suggestion: __binding_1,
                        prefix: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("prefix `{$prefix}` is unknown")));
                        ;
                        let __code_108 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" "))
                                            })].into_iter();
                        diag.arg("prefix", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown prefix")));
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("insert whitespace here to avoid this being parsed as a prefix in Rust 2021")),
                            __code_108, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3178#[diag("prefix `{$prefix}` is unknown")]
3179pub(crate) struct ReservedPrefix {
3180    #[label("unknown prefix")]
3181    pub label: Span,
3182    #[suggestion(
3183        "insert whitespace here to avoid this being parsed as a prefix in Rust 2021",
3184        code = " ",
3185        applicability = "machine-applicable"
3186    )]
3187    pub suggestion: Span,
3188
3189    pub prefix: String,
3190}
3191
3192#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for RawPrefix {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    RawPrefix { label: __binding_0, suggestion: __binding_1 } =>
                        {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("prefix `'r` is reserved")));
                        ;
                        let __code_109 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" "))
                                            })].into_iter();
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reserved prefix")));
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("insert whitespace here to avoid this being parsed as a prefix in Rust 2021")),
                            __code_109, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3193#[diag("prefix `'r` is reserved")]
3194pub(crate) struct RawPrefix {
3195    #[label("reserved prefix")]
3196    pub label: Span,
3197    #[suggestion(
3198        "insert whitespace here to avoid this being parsed as a prefix in Rust 2021",
3199        code = " ",
3200        applicability = "machine-applicable"
3201    )]
3202    pub suggestion: Span,
3203}
3204
3205#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            BreakWithLabelAndLoop {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    BreakWithLabelAndLoop { sub: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3206#[diag(
3207    "this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression"
3208)]
3209pub(crate) struct BreakWithLabelAndLoop {
3210    #[subdiagnostic]
3211    pub sub: BreakWithLabelAndLoopSub,
3212}
3213
3214#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for BreakWithLabelAndLoopSub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    BreakWithLabelAndLoopSub {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_110 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_111 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_110));
                        suggestions.push((__binding_1, __code_111));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap this expression in parentheses")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3215#[multipart_suggestion("wrap this expression in parentheses", applicability = "machine-applicable")]
3216pub(crate) struct BreakWithLabelAndLoopSub {
3217    #[suggestion_part(code = "(")]
3218    pub left: Span,
3219    #[suggestion_part(code = ")")]
3220    pub right: Span,
3221}
3222
3223#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DeprecatedWhereClauseLocation {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DeprecatedWhereClauseLocation { suggestion: __binding_0 } =>
                        {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clause not allowed here")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3224#[diag("where clause not allowed here")]
3225#[note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")]
3226pub(crate) struct DeprecatedWhereClauseLocation {
3227    #[subdiagnostic]
3228    pub suggestion: DeprecatedWhereClauseLocationSugg,
3229}
3230
3231#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for DeprecatedWhereClauseLocationSugg
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    DeprecatedWhereClauseLocationSugg::MoveToEnd {
                        left: __binding_0, right: __binding_1, sugg: __binding_2 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_112 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_113 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                });
                        suggestions.push((__binding_0, __code_112));
                        suggestions.push((__binding_1, __code_113));
                        diag.store_args();
                        diag.arg("sugg", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move it to the end of the type declaration")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    DeprecatedWhereClauseLocationSugg::RemoveWhere {
                        span: __binding_0 } => {
                        let __code_114 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this `where`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_114, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3232pub(crate) enum DeprecatedWhereClauseLocationSugg {
3233    #[multipart_suggestion(
3234        "move it to the end of the type declaration",
3235        applicability = "machine-applicable"
3236    )]
3237    MoveToEnd {
3238        #[suggestion_part(code = "")]
3239        left: Span,
3240        #[suggestion_part(code = "{sugg}")]
3241        right: Span,
3242
3243        sugg: String,
3244    },
3245    #[suggestion("remove this `where`", code = "", applicability = "machine-applicable")]
3246    RemoveWhere {
3247        #[primary_span]
3248        span: Span,
3249    },
3250}
3251
3252#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            SingleUseLifetime {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    SingleUseLifetime {
                        param_span: __binding_0,
                        use_span: __binding_1,
                        suggestion: __binding_2,
                        ident: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameter `{$ident}` only used once")));
                        ;
                        diag.arg("ident", __binding_3);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this lifetime...")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("...is used only here")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3253#[diag("lifetime parameter `{$ident}` only used once")]
3254pub(crate) struct SingleUseLifetime {
3255    #[label("this lifetime...")]
3256    pub param_span: Span,
3257    #[label("...is used only here")]
3258    pub use_span: Span,
3259    #[subdiagnostic]
3260    pub suggestion: Option<SingleUseLifetimeSugg>,
3261
3262    pub ident: Ident,
3263}
3264
3265#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for SingleUseLifetimeSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SingleUseLifetimeSugg {
                        deletion_span: __binding_0,
                        use_span: __binding_1,
                        replace_lt: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_115 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_116 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                });
                        if let Some(__binding_0) = __binding_0 {
                            suggestions.push((__binding_0, __code_115));
                        }
                        suggestions.push((__binding_1, __code_116));
                        diag.store_args();
                        diag.arg("replace_lt", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("elide the single-use lifetime")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3266#[multipart_suggestion("elide the single-use lifetime", applicability = "machine-applicable")]
3267pub(crate) struct SingleUseLifetimeSugg {
3268    #[suggestion_part(code = "")]
3269    pub deletion_span: Option<Span>,
3270    #[suggestion_part(code = "{replace_lt}")]
3271    pub use_span: Span,
3272
3273    pub replace_lt: String,
3274}
3275
3276#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedLifetime {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedLifetime {
                        deletion_span: __binding_0, ident: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameter `{$ident}` never used")));
                        ;
                        let __code_117 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.arg("ident", __binding_1);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_suggestions_with_style(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("elide the unused lifetime")),
                                __code_117, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3277#[diag("lifetime parameter `{$ident}` never used")]
3278pub(crate) struct UnusedLifetime {
3279    #[suggestion("elide the unused lifetime", code = "", applicability = "machine-applicable")]
3280    pub deletion_span: Option<Span>,
3281
3282    pub ident: Ident,
3283}
3284
3285#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            NamedArgumentUsedPositionally {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    NamedArgumentUsedPositionally {
                        named_arg_sp: __binding_0,
                        position_label_sp: __binding_1,
                        suggestion: __binding_2,
                        name: __binding_3,
                        named_arg_name: __binding_4 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("named argument `{$named_arg_name}` is not used by name")));
                        ;
                        let __code_118 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                            })].into_iter();
                        diag.arg("name", __binding_3);
                        diag.arg("named_arg_name", __binding_4);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this named argument is referred to by position in formatting string")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this formatting argument uses named argument `{$named_arg_name}` by position")));
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_suggestions_with_style(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the named argument by name to avoid ambiguity")),
                                __code_118, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3286#[diag("named argument `{$named_arg_name}` is not used by name")]
3287pub(crate) struct NamedArgumentUsedPositionally {
3288    #[label("this named argument is referred to by position in formatting string")]
3289    pub named_arg_sp: Span,
3290    #[label("this formatting argument uses named argument `{$named_arg_name}` by position")]
3291    pub position_label_sp: Option<Span>,
3292    #[suggestion(
3293        "use the named argument by name to avoid ambiguity",
3294        style = "verbose",
3295        code = "{name}",
3296        applicability = "maybe-incorrect"
3297    )]
3298    pub suggestion: Option<Span>,
3299
3300    pub name: String,
3301    pub named_arg_name: String,
3302}
3303
3304#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            AmbiguousGlobReexports {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    AmbiguousGlobReexports {
                        first_reexport: __binding_0,
                        duplicate_reexport: __binding_1,
                        name: __binding_2,
                        namespace: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous glob re-exports")));
                        ;
                        diag.arg("name", __binding_2);
                        diag.arg("namespace", __binding_3);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the name `{$name}` in the {$namespace} namespace is first re-exported here")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("but the name `{$name}` in the {$namespace} namespace is also re-exported here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3305#[diag("ambiguous glob re-exports")]
3306pub(crate) struct AmbiguousGlobReexports {
3307    #[label("the name `{$name}` in the {$namespace} namespace is first re-exported here")]
3308    pub first_reexport: Span,
3309    #[label("but the name `{$name}` in the {$namespace} namespace is also re-exported here")]
3310    pub duplicate_reexport: Span,
3311
3312    pub name: String,
3313    pub namespace: String,
3314}
3315
3316#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            HiddenGlobReexports {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    HiddenGlobReexports {
                        glob_reexport: __binding_0,
                        private_item: __binding_1,
                        name: __binding_2,
                        namespace: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("private item shadows public glob re-export")));
                        ;
                        diag.arg("name", __binding_2);
                        diag.arg("namespace", __binding_3);
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the name `{$name}` in the {$namespace} namespace is supposed to be publicly re-exported here")));
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("but the private item here shadows it")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3317#[diag("private item shadows public glob re-export")]
3318pub(crate) struct HiddenGlobReexports {
3319    #[note(
3320        "the name `{$name}` in the {$namespace} namespace is supposed to be publicly re-exported here"
3321    )]
3322    pub glob_reexport: Span,
3323    #[note("but the private item here shadows it")]
3324    pub private_item: Span,
3325
3326    pub name: String,
3327    pub namespace: String,
3328}
3329
3330#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnusedQualifications {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedQualifications { removal_span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary qualification")));
                        ;
                        let __code_119 =
                            [::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 the unnecessary path segments")),
                            __code_119, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3331#[diag("unnecessary qualification")]
3332pub(crate) struct UnusedQualifications {
3333    #[suggestion(
3334        "remove the unnecessary path segments",
3335        style = "verbose",
3336        code = "",
3337        applicability = "machine-applicable"
3338    )]
3339    pub removal_span: Span,
3340}
3341
3342#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            AssociatedConstElidedLifetime {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    AssociatedConstElidedLifetime {
                        span: __binding_0,
                        code: __binding_1,
                        elided: __binding_2,
                        lifetimes_in_scope: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$elided ->\n        [true] `&` without an explicit lifetime name cannot be used here\n        *[false] `'_` cannot be used here\n    }")));
                        ;
                        let __code_120 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.arg("code", __binding_1);
                        diag.arg("elided", __binding_2);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `'static` lifetime")),
                            __code_120, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.span_note(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot automatically infer `'static` because of other lifetimes in scope")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3343#[diag(
3344    "{$elided ->
3345        [true] `&` without an explicit lifetime name cannot be used here
3346        *[false] `'_` cannot be used here
3347    }"
3348)]
3349pub(crate) struct AssociatedConstElidedLifetime {
3350    #[suggestion(
3351        "use the `'static` lifetime",
3352        style = "verbose",
3353        code = "{code}",
3354        applicability = "machine-applicable"
3355    )]
3356    pub span: Span,
3357
3358    pub code: &'static str,
3359    pub elided: bool,
3360    #[note("cannot automatically infer `'static` because of other lifetimes in scope")]
3361    pub lifetimes_in_scope: MultiSpan,
3362}
3363
3364#[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 } => {
                        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")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
3365#[diag("creating a {$shared_label}reference to mutable static")]
3366pub(crate) struct RefOfMutStatic<'a> {
3367    #[label("{$shared_label}reference to mutable static")]
3368    pub span: Span,
3369    #[subdiagnostic]
3370    pub sugg: Option<MutRefSugg>,
3371    pub shared_label: &'a str,
3372    #[note(
3373        "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"
3374    )]
3375    pub shared_note: bool,
3376    #[note(
3377        "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"
3378    )]
3379    pub mut_note: bool,
3380}
3381
3382#[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_121 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&raw const "))
                                });
                        suggestions.push((__binding_0, __code_121));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `&raw const` instead to create a raw pointer")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    MutRefSugg::Mut { span: __binding_0 } => {
                        let mut suggestions = Vec::new();
                        let __code_122 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("&raw mut "))
                                });
                        suggestions.push((__binding_0, __code_122));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `&raw mut` instead to create a raw pointer")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3383pub(crate) enum MutRefSugg {
3384    #[multipart_suggestion(
3385        "use `&raw const` instead to create a raw pointer",
3386        style = "verbose",
3387        applicability = "maybe-incorrect"
3388    )]
3389    Shared {
3390        #[suggestion_part(code = "&raw const ")]
3391        span: Span,
3392    },
3393    #[multipart_suggestion(
3394        "use `&raw mut` instead to create a raw pointer",
3395        style = "verbose",
3396        applicability = "maybe-incorrect"
3397    )]
3398    Mut {
3399        #[suggestion_part(code = "&raw mut ")]
3400        span: Span,
3401    },
3402}
3403
3404#[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)]
3405#[diag("`use` of a local item without leading `self::`, `super::`, or `crate::`")]
3406pub(crate) struct UnqualifiedLocalImportsDiag;
3407
3408#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for ReservedString {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ReservedString { suggestion: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("will be parsed as a guarded string in Rust 2024")));
                        ;
                        let __code_123 =
                            [::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("insert whitespace here to avoid this being parsed as a guarded string in Rust 2024")),
                            __code_123, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3409#[diag("will be parsed as a guarded string in Rust 2024")]
3410pub(crate) struct ReservedString {
3411    #[suggestion(
3412        "insert whitespace here to avoid this being parsed as a guarded string in Rust 2024",
3413        code = " ",
3414        applicability = "machine-applicable"
3415    )]
3416    pub suggestion: Span,
3417}
3418
3419#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ReservedMultihash {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ReservedMultihash { suggestion: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reserved token in Rust 2024")));
                        ;
                        let __code_124 =
                            [::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("insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024")),
                            __code_124, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3420#[diag("reserved token in Rust 2024")]
3421pub(crate) struct ReservedMultihash {
3422    #[suggestion(
3423        "insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024",
3424        code = " ",
3425        applicability = "machine-applicable"
3426    )]
3427    pub suggestion: Span,
3428}
3429
3430#[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)]
3431#[diag("direct cast of function item into an integer")]
3432pub(crate) struct FunctionCastsAsIntegerDiag<'tcx> {
3433    #[subdiagnostic]
3434    pub(crate) sugg: FunctionCastsAsIntegerSugg<'tcx>,
3435}
3436
3437#[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_125 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" as *const ()"))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("cast_to_ty", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first cast to a pointer `as *const ()`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_125, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3438#[suggestion(
3439    "first cast to a pointer `as *const ()`",
3440    code = " as *const ()",
3441    applicability = "machine-applicable",
3442    style = "verbose"
3443)]
3444pub(crate) struct FunctionCastsAsIntegerSugg<'tcx> {
3445    #[primary_span]
3446    pub suggestion: Span,
3447    pub cast_to_ty: Ty<'tcx>,
3448}
3449
3450#[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)]
3451pub(crate) struct MismatchedLifetimeSyntaxes {
3452    pub inputs: LifetimeSyntaxCategories<Vec<Span>>,
3453    pub outputs: LifetimeSyntaxCategories<Vec<Span>>,
3454
3455    pub suggestions: Vec<MismatchedLifetimeSyntaxesSuggestion>,
3456}
3457
3458impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MismatchedLifetimeSyntaxes {
3459    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
3460        let counts = self.inputs.len() + self.outputs.len();
3461        let message = match counts {
3462            LifetimeSyntaxCategories { hidden: 0, elided: 0, named: 0 } => {
3463                {
    ::core::panicking::panic_fmt(format_args!("No lifetime mismatch detected"));
}panic!("No lifetime mismatch detected")
3464            }
3465
3466            LifetimeSyntaxCategories { hidden: _, elided: _, named: 0 } => {
3467                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")
3468            }
3469
3470            LifetimeSyntaxCategories { hidden: _, elided: 0, named: _ } => {
3471                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")
3472            }
3473
3474            LifetimeSyntaxCategories { hidden: 0, elided: _, named: _ } => {
3475                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")
3476            }
3477
3478            LifetimeSyntaxCategories { hidden: _, elided: _, named: _ } => {
3479                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")
3480            }
3481        };
3482        let mut diag = Diag::new(dcx, level, message);
3483
3484        for s in self.inputs.hidden {
3485            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is hidden here"))msg!("the lifetime is hidden here"));
3486        }
3487        for s in self.inputs.elided {
3488            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is elided here"))msg!("the lifetime is elided here"));
3489        }
3490        for s in self.inputs.named {
3491            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lifetime is named here"))msg!("the lifetime is named here"));
3492        }
3493
3494        for s in self.outputs.hidden {
3495            diag.span_label(s, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same lifetime is hidden here"))msg!("the same lifetime is hidden here"));
3496        }
3497        for s in self.outputs.elided {
3498            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"));
3499        }
3500        for s in self.outputs.named {
3501            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"));
3502        }
3503
3504        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the same lifetime is referred to in inconsistent ways, making the signature confusing"))msg!(
3505            "the same lifetime is referred to in inconsistent ways, making the signature confusing"
3506        ));
3507
3508        let mut suggestions = self.suggestions.into_iter();
3509        if let Some(s) = suggestions.next() {
3510            diag.subdiagnostic(s);
3511
3512            for mut s in suggestions {
3513                s.make_optional_alternative();
3514                diag.subdiagnostic(s);
3515            }
3516        }
3517        diag
3518    }
3519}
3520
3521#[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)]
3522pub(crate) enum MismatchedLifetimeSyntaxesSuggestion {
3523    Implicit {
3524        suggestions: Vec<Span>,
3525        optional_alternative: bool,
3526    },
3527
3528    Mixed {
3529        implicit_suggestions: Vec<Span>,
3530        explicit_anonymous_suggestions: Vec<(Span, String)>,
3531        optional_alternative: bool,
3532    },
3533
3534    Explicit {
3535        lifetime_name: String,
3536        suggestions: Vec<(Span, String)>,
3537        optional_alternative: bool,
3538    },
3539}
3540
3541impl MismatchedLifetimeSyntaxesSuggestion {
3542    fn make_optional_alternative(&mut self) {
3543        use MismatchedLifetimeSyntaxesSuggestion::*;
3544
3545        let optional_alternative = match self {
3546            Implicit { optional_alternative, .. }
3547            | Mixed { optional_alternative, .. }
3548            | Explicit { optional_alternative, .. } => optional_alternative,
3549        };
3550
3551        *optional_alternative = true;
3552    }
3553}
3554
3555impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
3556    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
3557        use MismatchedLifetimeSyntaxesSuggestion::*;
3558
3559        let style = |optional_alternative| {
3560            if optional_alternative {
3561                SuggestionStyle::CompletelyHidden
3562            } else {
3563                SuggestionStyle::ShowAlways
3564            }
3565        };
3566
3567        let applicability = |optional_alternative| {
3568            // `cargo fix` can't handle more than one fix for the same issue,
3569            // so hide alternative suggestions from it by marking them as maybe-incorrect
3570            if optional_alternative {
3571                Applicability::MaybeIncorrect
3572            } else {
3573                Applicability::MachineApplicable
3574            }
3575        };
3576
3577        match self {
3578            Implicit { suggestions, optional_alternative } => {
3579                let suggestions = suggestions.into_iter().map(|s| (s, String::new())).collect();
3580                diag.multipart_suggestion_with_style(
3581                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the lifetime name from references"))msg!("remove the lifetime name from references"),
3582                    suggestions,
3583                    applicability(optional_alternative),
3584                    style(optional_alternative),
3585                );
3586            }
3587
3588            Mixed {
3589                implicit_suggestions,
3590                explicit_anonymous_suggestions,
3591                optional_alternative,
3592            } => {
3593                let message = if implicit_suggestions.is_empty() {
3594                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `'_` for type paths"))msg!("use `'_` for type paths")
3595                } else {
3596                    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")
3597                };
3598
3599                let implicit_suggestions =
3600                    implicit_suggestions.into_iter().map(|s| (s, String::new()));
3601
3602                let suggestions =
3603                    implicit_suggestions.chain(explicit_anonymous_suggestions).collect();
3604
3605                diag.multipart_suggestion_with_style(
3606                    message,
3607                    suggestions,
3608                    applicability(optional_alternative),
3609                    style(optional_alternative),
3610                );
3611            }
3612
3613            Explicit { lifetime_name, suggestions, optional_alternative } => {
3614                diag.arg("lifetime_name", lifetime_name);
3615                let msg = diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consistently use `{$lifetime_name}`"))msg!("consistently use `{$lifetime_name}`"));
3616                diag.remove_arg("lifetime_name");
3617                diag.multipart_suggestion_with_style(
3618                    msg,
3619                    suggestions,
3620                    applicability(optional_alternative),
3621                    style(optional_alternative),
3622                );
3623            }
3624        }
3625    }
3626}
3627
3628#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            EmptyAttributeList {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    EmptyAttributeList {
                        attr_span: __binding_0,
                        attr_path: __binding_1,
                        valid_without_list: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all\n        *[other] using `{$attr_path}` with an empty list has no effect\n    }")));
                        ;
                        let __code_126 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.arg("attr_path", __binding_1);
                        diag.arg("valid_without_list", __binding_2);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n            [true] remove these parentheses\n            *[other] remove this attribute\n        }")),
                            __code_126, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3629#[diag("unused attribute")]
3630#[note(
3631    "{$valid_without_list ->
3632        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
3633        *[other] using `{$attr_path}` with an empty list has no effect
3634    }"
3635)]
3636pub(crate) struct EmptyAttributeList {
3637    #[suggestion(
3638        "{$valid_without_list ->
3639            [true] remove these parentheses
3640            *[other] remove this attribute
3641        }",
3642        code = "",
3643        applicability = "machine-applicable"
3644    )]
3645    pub attr_span: Span,
3646    pub attr_path: String,
3647    pub valid_without_list: bool,
3648}
3649
3650#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            InvalidTargetLint {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    InvalidTargetLint {
                        name: __binding_0,
                        target: __binding_1,
                        applied: __binding_2,
                        only: __binding_3,
                        attr_span: __binding_4 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` attribute cannot be used on {$target}")));
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` can {$only}be applied to {$applied}")));
                        ;
                        let __code_127 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.arg("name", __binding_0);
                        diag.arg("target", __binding_1);
                        diag.arg("applied", __binding_2);
                        diag.arg("only", __binding_3);
                        diag.span_suggestions_with_style(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                            __code_127, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3651#[diag("`#[{$name}]` attribute cannot be used on {$target}")]
3652#[warning(
3653    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
3654)]
3655#[help("`#[{$name}]` can {$only}be applied to {$applied}")]
3656pub(crate) struct InvalidTargetLint {
3657    pub name: String,
3658    pub target: &'static str,
3659    pub applied: DiagArgValue,
3660    pub only: &'static str,
3661    #[suggestion(
3662        "remove the attribute",
3663        code = "",
3664        applicability = "machine-applicable",
3665        style = "tool-only"
3666    )]
3667    pub attr_span: Span,
3668}
3669
3670#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for InvalidAttrStyle
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    InvalidAttrStyle {
                        name: __binding_0,
                        is_used_as_inner: __binding_1,
                        target_span: __binding_2,
                        target: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_used_as_inner ->\n        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`\n        *[other] the `#![{$name}]` attribute can only be used at the crate root\n    }")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("is_used_as_inner", __binding_1);
                        diag.arg("target", __binding_3);
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_note(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute does not have an `!`, which means it is applied to this {$target}")));
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3671#[diag(
3672    "{$is_used_as_inner ->
3673        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
3674        *[other] the `#![{$name}]` attribute can only be used at the crate root
3675    }"
3676)]
3677pub(crate) struct InvalidAttrStyle {
3678    pub name: String,
3679    pub is_used_as_inner: bool,
3680    #[note("this attribute does not have an `!`, which means it is applied to this {$target}")]
3681    pub target_span: Option<Span>,
3682    pub target: &'static str,
3683}
3684
3685#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedDuplicate
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedDuplicate {
                        this: __binding_0, other: __binding_1, warning: __binding_2
                        } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        ;
                        let __code_128 =
                            [::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_128, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        if __binding_2 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3686#[diag("unused attribute")]
3687pub(crate) struct UnusedDuplicate {
3688    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
3689    pub this: Span,
3690    #[note("attribute also specified here")]
3691    pub other: Span,
3692    #[warning(
3693        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
3694    )]
3695    pub warning: bool,
3696}
3697
3698#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for MalformedDoc {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MalformedDoc => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `doc` attribute input")));
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3699#[diag("malformed `doc` attribute input")]
3700#[warning(
3701    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
3702)]
3703pub(crate) struct MalformedDoc;
3704
3705#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for ExpectedNoArgs {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ExpectedNoArgs => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("didn't expect any arguments here")));
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3706#[diag("didn't expect any arguments here")]
3707#[warning(
3708    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
3709)]
3710pub(crate) struct ExpectedNoArgs;
3711
3712#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ExpectedNameValue {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ExpectedNameValue => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected this to be of the form `... = \"...\"`")));
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3713#[diag("expected this to be of the form `... = \"...\"`")]
3714#[warning(
3715    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
3716)]
3717pub(crate) struct ExpectedNameValue;
3718
3719#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnsafeAttrOutsideUnsafeLint {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnsafeAttrOutsideUnsafeLint {
                        span: __binding_0, suggestion: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3720#[diag("unsafe attribute used without unsafe")]
3721pub(crate) struct UnsafeAttrOutsideUnsafeLint {
3722    #[label("usage of unsafe attribute")]
3723    pub span: Span,
3724    #[subdiagnostic]
3725    pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
3726}
3727
3728#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnsafeAttrOutsideUnsafeSuggestion
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnsafeAttrOutsideUnsafeSuggestion {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_129 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe("))
                                });
                        let __code_130 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_129));
                        suggestions.push((__binding_1, __code_130));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the attribute in `unsafe(...)`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3729#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
3730pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
3731    #[suggestion_part(code = "unsafe(")]
3732    pub left: Span,
3733    #[suggestion_part(code = ")")]
3734    pub right: Span,
3735}
3736
3737#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedVisibility
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedVisibility { span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility qualifiers have no effect on `const _` declarations")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const _` does not declare a name, so there is nothing for the qualifier to apply to")));
                        ;
                        let __code_131 =
                            [::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 the qualifier")),
                            __code_131, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3738#[diag("visibility qualifiers have no effect on `const _` declarations")]
3739#[note("`const _` does not declare a name, so there is nothing for the qualifier to apply to")]
3740pub(crate) struct UnusedVisibility {
3741    #[suggestion(
3742        "remove the qualifier",
3743        style = "short",
3744        code = "",
3745        applicability = "machine-applicable"
3746    )]
3747    pub span: Span,
3748}
3749
3750#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocAliasDuplicated {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocAliasDuplicated { first_defn: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias is duplicated")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first defined here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3751#[diag("doc alias is duplicated")]
3752pub(crate) struct DocAliasDuplicated {
3753    #[label("first defined here")]
3754    pub first_defn: Span,
3755}
3756
3757#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocAutoCfgExpectsHideOrShow {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocAutoCfgExpectsHideOrShow => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3758#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
3759pub(crate) struct DocAutoCfgExpectsHideOrShow;
3760
3761#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            AmbiguousDeriveHelpers {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    AmbiguousDeriveHelpers => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there exists a built-in attribute with the same name")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3762#[diag("there exists a built-in attribute with the same name")]
3763pub(crate) struct AmbiguousDeriveHelpers;
3764
3765#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocAutoCfgHideShowUnexpectedItem {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocAutoCfgHideShowUnexpectedItem { attr_name: __binding_0 }
                        => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")));
                        ;
                        diag.arg("attr_name", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3766#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")]
3767pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
3768    pub attr_name: Symbol,
3769}
3770
3771#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocAutoCfgHideShowExpectsList {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocAutoCfgHideShowExpectsList { attr_name: __binding_0 } =>
                        {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")));
                        ;
                        diag.arg("attr_name", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3772#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
3773pub(crate) struct DocAutoCfgHideShowExpectsList {
3774    pub attr_name: Symbol,
3775}
3776
3777#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocInvalid {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocInvalid => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `doc` attribute")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3778#[diag("invalid `doc` attribute")]
3779pub(crate) struct DocInvalid;
3780
3781#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocUnknownInclude {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocUnknownInclude {
                        inner: __binding_0, value: __binding_1, sugg: __binding_2 }
                        => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `include`")));
                        ;
                        let __code_132 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#{0}[doc = include_str!(\"{1}\")]",
                                                        __binding_0, __binding_1))
                                            })].into_iter();
                        diag.arg("inner", __binding_0);
                        diag.arg("value", __binding_1);
                        diag.span_suggestions_with_style(__binding_2.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `doc = include_str!` instead")),
                            __code_132, __binding_2.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3782#[diag("unknown `doc` attribute `include`")]
3783pub(crate) struct DocUnknownInclude {
3784    pub inner: &'static str,
3785    pub value: Symbol,
3786    #[suggestion(
3787        "use `doc = include_str!` instead",
3788        code = "#{inner}[doc = include_str!(\"{value}\")]"
3789    )]
3790    pub sugg: (Span, Applicability),
3791}
3792
3793#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocUnknownSpotlight {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocUnknownSpotlight { sugg_span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `spotlight`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` was renamed to `doc(notable_trait)`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` is now a no-op")));
                        ;
                        let __code_133 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("notable_trait"))
                                            })].into_iter();
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `notable_trait` instead")),
                            __code_133, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3794#[diag("unknown `doc` attribute `spotlight`")]
3795#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
3796#[note("`doc(spotlight)` is now a no-op")]
3797pub(crate) struct DocUnknownSpotlight {
3798    #[suggestion(
3799        "use `notable_trait` instead",
3800        style = "short",
3801        applicability = "machine-applicable",
3802        code = "notable_trait"
3803    )]
3804    pub sugg_span: Span,
3805}
3806
3807#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocUnknownPasses
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocUnknownPasses { name: __binding_0, note_span: __binding_1
                        } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc({$name})` is now a no-op")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3808#[diag("unknown `doc` attribute `{$name}`")]
3809#[note(
3810    "`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>"
3811)]
3812#[note("`doc({$name})` is now a no-op")]
3813pub(crate) struct DocUnknownPasses {
3814    pub name: Symbol,
3815    #[label("no longer functions")]
3816    pub note_span: Span,
3817}
3818
3819#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocUnknownPlugins {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocUnknownPlugins { label_span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `plugins`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(plugins)` is now a no-op")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3820#[diag("unknown `doc` attribute `plugins`")]
3821#[note(
3822    "`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>"
3823)]
3824#[note("`doc(plugins)` is now a no-op")]
3825pub(crate) struct DocUnknownPlugins {
3826    #[label("no longer functions")]
3827    pub label_span: Span,
3828}
3829
3830#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocUnknownAny {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocUnknownAny { name: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3831#[diag("unknown `doc` attribute `{$name}`")]
3832pub(crate) struct DocUnknownAny {
3833    pub name: Symbol,
3834}
3835
3836#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DocAutoCfgWrongLiteral {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocAutoCfgWrongLiteral => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected boolean for `#[doc(auto_cfg = ...)]`")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3837#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
3838pub(crate) struct DocAutoCfgWrongLiteral;
3839
3840#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocTestTakesList
            {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocTestTakesList => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(test(...)]` takes a list of attributes")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3841#[diag("`#[doc(test(...)]` takes a list of attributes")]
3842pub(crate) struct DocTestTakesList;
3843
3844#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocTestUnknown {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocTestUnknown { name: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc(test)` attribute `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3845#[diag("unknown `doc(test)` attribute `{$name}`")]
3846pub(crate) struct DocTestUnknown {
3847    pub name: Symbol,
3848}
3849
3850#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for DocTestLiteral {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DocTestLiteral => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(test(...)]` does not take a literal")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3851#[diag("`#![doc(test(...)]` does not take a literal")]
3852pub(crate) struct DocTestLiteral;
3853
3854#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            AttrCrateLevelOnly {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    AttrCrateLevelOnly => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied at the crate level")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3855#[diag("this attribute can only be applied at the crate level")]
3856#[note(
3857    "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information"
3858)]
3859pub(crate) struct AttrCrateLevelOnly;
3860
3861#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DoNotRecommendDoesNotExpectArgs {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DoNotRecommendDoesNotExpectArgs => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::do_not_recommend]` does not expect any arguments")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3862#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")]
3863pub(crate) struct DoNotRecommendDoesNotExpectArgs;
3864
3865#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnknownCrateTypes {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnknownCrateTypes { sugg: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `crate_type` value")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3866#[diag("invalid `crate_type` value")]
3867pub(crate) struct UnknownCrateTypes {
3868    #[subdiagnostic]
3869    pub sugg: Option<UnknownCrateTypesSuggestion>,
3870}
3871
3872#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownCrateTypesSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnknownCrateTypesSuggestion {
                        span: __binding_0, snippet: __binding_1 } => {
                        let __code_134 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("snippet", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_134, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
3873#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")]
3874pub(crate) struct UnknownCrateTypesSuggestion {
3875    #[primary_span]
3876    pub span: Span,
3877    pub snippet: Symbol,
3878}
3879
3880#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnreachableCfgSelectPredicate {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnreachableCfgSelectPredicate { span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3881#[diag("unreachable configuration predicate")]
3882pub(crate) struct UnreachableCfgSelectPredicate {
3883    #[label("this configuration predicate is never reached")]
3884    pub span: Span,
3885}
3886
3887#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnreachableCfgSelectPredicateWildcard {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnreachableCfgSelectPredicateWildcard {
                        span: __binding_0, wildcard_span: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("always matches")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3888#[diag("unreachable configuration predicate")]
3889pub(crate) struct UnreachableCfgSelectPredicateWildcard {
3890    #[label("this configuration predicate is never reached")]
3891    pub span: Span,
3892
3893    #[label("always matches")]
3894    pub wildcard_span: Span,
3895}
3896
3897#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            DisallowedPositionalArgument {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    DisallowedPositionalArgument => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional format arguments are not allowed here")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only named format arguments with the name of one of the generic types are allowed in this context")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3898#[diag("positional format arguments are not allowed here")]
3899#[help(
3900    "only named format arguments with the name of one of the generic types are allowed in this context"
3901)]
3902pub(crate) struct DisallowedPositionalArgument;
3903
3904#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            InvalidFormatSpecifier {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    InvalidFormatSpecifier => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid format specifier")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no format specifier are supported in this position")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3905#[diag("invalid format specifier")]
3906#[help("no format specifier are supported in this position")]
3907pub(crate) struct InvalidFormatSpecifier;
3908
3909#[derive(const _: () =
    {
        impl<'__a, 'a> rustc_errors::LintDiagnostic<'__a, ()> for
            WrappedParserError<'a> {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    WrappedParserError {
                        description: __binding_0,
                        span: __binding_1,
                        label: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$description}")));
                        ;
                        diag.arg("description", __binding_0);
                        diag.arg("label", __binding_2);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$label}")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3910#[diag("{$description}")]
3911pub(crate) struct WrappedParserError<'a> {
3912    pub description: &'a str,
3913    #[label("{$label}")]
3914    pub span: Span,
3915    pub label: &'a str,
3916}
3917
3918#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            IgnoredDiagnosticOption {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    IgnoredDiagnosticOption {
                        option_name: __binding_0,
                        first_span: __binding_1,
                        later_span: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is ignored due to previous definition of `{$option_name}`")));
                        ;
                        diag.arg("option_name", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is first declared here")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is later redundantly declared here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3919#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
3920pub(crate) struct IgnoredDiagnosticOption {
3921    pub option_name: Symbol,
3922    #[label("`{$option_name}` is first declared here")]
3923    pub first_span: Span,
3924    #[label("`{$option_name}` is later redundantly declared here")]
3925    pub later_span: Span,
3926}
3927
3928#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MissingOptionsForOnUnimplementedAttr {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MissingOptionsForOnUnimplementedAttr => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing options for `on_unimplemented` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("at least one of the `message`, `note` and `label` options are expected")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3929#[diag("missing options for `on_unimplemented` attribute")]
3930#[help("at least one of the `message`, `note` and `label` options are expected")]
3931pub(crate) struct MissingOptionsForOnUnimplementedAttr;
3932
3933#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MissingOptionsForOnConstAttr {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MissingOptionsForOnConstAttr => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing options for `on_const` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("at least one of the `message`, `note` and `label` options are expected")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3934#[diag("missing options for `on_const` attribute")]
3935#[help("at least one of the `message`, `note` and `label` options are expected")]
3936pub(crate) struct MissingOptionsForOnConstAttr;
3937
3938#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MalformedOnUnimplementedAttrLint {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MalformedOnUnimplementedAttrLint { span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `on_unimplemented` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `message`, `note` and `label` are allowed as options")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid option found here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3939#[diag("malformed `on_unimplemented` attribute")]
3940#[help("only `message`, `note` and `label` are allowed as options")]
3941pub(crate) struct MalformedOnUnimplementedAttrLint {
3942    #[label("invalid option found here")]
3943    pub span: Span,
3944}
3945
3946#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MalformedOnConstAttrLint {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MalformedOnConstAttrLint { span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `on_const` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `message`, `note` and `label` are allowed as options")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid option found here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
3947#[diag("malformed `on_const` attribute")]
3948#[help("only `message`, `note` and `label` are allowed as options")]
3949pub(crate) struct MalformedOnConstAttrLint {
3950    #[label("invalid option found here")]
3951    pub span: Span,
3952}
3953
3954#[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)]
3955#[diag("`Eq::assert_receiver_is_total_eq` should never be implemented by hand")]
3956#[note("this method was used to add checks to the `Eq` derive macro")]
3957pub(crate) struct EqInternalMethodImplemented;