Skip to main content

rustc_mir_build/
errors.rs

1use rustc_errors::codes::*;
2use rustc_errors::{
3    Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
4    MultiSpan, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_middle::ty::{self, Ty};
8use rustc_pattern_analysis::errors::Uncovered;
9use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::{Ident, Span, Symbol};
11
12#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToDeprecatedSafeFnRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToDeprecatedSafeFnRequiresUnsafe {
                        span: __binding_0, function: __binding_1, sub: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
13#[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")]
14pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe {
15    #[label("call to unsafe function")]
16    pub(crate) span: Span,
17    pub(crate) function: String,
18    #[subdiagnostic]
19    pub(crate) sub: CallToDeprecatedSafeFnRequiresUnsafeSub,
20}
21
22#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            CallToDeprecatedSafeFnRequiresUnsafeSub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CallToDeprecatedSafeFnRequiresUnsafeSub {
                        start_of_line_suggestion: __binding_0,
                        start_of_line: __binding_1,
                        left: __binding_2,
                        right: __binding_3,
                        guarantee: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_0 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_0))
                                });
                        let __code_1 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe {{ "))
                                });
                        let __code_2 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" }}"))
                                });
                        suggestions.push((__binding_1, __code_0));
                        suggestions.push((__binding_2, __code_1));
                        suggestions.push((__binding_3, __code_2));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("start_of_line_suggestion".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("guarantee".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
23#[multipart_suggestion(
24    "you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}",
25    applicability = "machine-applicable"
26)]
27pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafeSub {
28    pub(crate) start_of_line_suggestion: String,
29    #[suggestion_part(code = "{start_of_line_suggestion}")]
30    pub(crate) start_of_line: Span,
31    #[suggestion_part(code = "unsafe {{ ")]
32    pub(crate) left: Span,
33    #[suggestion_part(code = " }}")]
34    pub(crate) right: Span,
35    pub(crate) guarantee: String,
36}
37
38#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        unsafe_not_inherited_note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function `{$function}` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
39#[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)]
40#[note("consult the function's documentation for information on how to avoid undefined behavior")]
41pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
42    #[label("call to unsafe function")]
43    pub(crate) span: Span,
44    pub(crate) function: String,
45    #[subdiagnostic]
46    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
47}
48
49#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
50#[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)]
51#[note("consult the function's documentation for information on how to avoid undefined behavior")]
52pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
53    #[label("call to unsafe function")]
54    pub(crate) span: Span,
55    #[subdiagnostic]
56    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
57}
58
59#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inline assembly is entirely unchecked and can cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
60#[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)]
61#[note("inline assembly is entirely unchecked and can cause undefined behavior")]
62pub(crate) struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
63    #[label("use of inline assembly")]
64    pub(crate) span: Span,
65    #[subdiagnostic]
66    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
67}
68
69#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initializing type with an unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initialization of struct with unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
70#[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)]
71#[note("unsafe fields may carry library invariants")]
72pub(crate) struct UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
73    #[label("initialization of struct with unsafe field")]
74    pub(crate) span: Span,
75    #[subdiagnostic]
76    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
77}
78
79#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
80#[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)]
81#[note(
82    "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior"
83)]
84pub(crate) struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
85    #[label("use of mutable static")]
86    pub(crate) span: Span,
87    #[subdiagnostic]
88    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
89}
90
91#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
92#[diag("use of extern static is unsafe and requires unsafe block", code = E0133)]
93#[note(
94    "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior"
95)]
96pub(crate) struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
97    #[label("use of extern static")]
98    pub(crate) span: Span,
99    #[subdiagnostic]
100    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
101}
102
103#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)]
105#[note("unsafe fields may carry library invariants")]
106pub(crate) struct UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
107    #[label("use of unsafe field")]
108    pub(crate) span: Span,
109    #[subdiagnostic]
110    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
111}
112
113#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
114#[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)]
115#[note(
116    "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior"
117)]
118pub(crate) struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
119    #[label("dereference of raw pointer")]
120    pub(crate) span: Span,
121    #[subdiagnostic]
122    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
123}
124
125#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the field may not be properly initialized: using uninitialized data will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
126#[diag("access to union field is unsafe and requires unsafe block", code = E0133)]
127#[note(
128    "the field may not be properly initialized: using uninitialized data will cause undefined behavior"
129)]
130pub(crate) struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
131    #[label("access to union field")]
132    pub(crate) span: Span,
133    #[subdiagnostic]
134    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
135}
136
137#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutating layout constrained fields cannot statically be checked for valid values")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
138#[diag(
139    "mutation of layout constrained field is unsafe and requires unsafe block",
140    code = E0133
141)]
142#[note("mutating layout constrained fields cannot statically be checked for valid values")]
143pub(crate) struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
144    #[label("mutation of layout constrained field")]
145    pub(crate) span: Span,
146    #[subdiagnostic]
147    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
148}
149
150#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
151#[diag(
152    "borrow of layout constrained field with interior mutability is unsafe and requires unsafe block",
153    code = E0133,
154)]
155pub(crate) struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
156    #[label("borrow of layout constrained field with interior mutability")]
157    pub(crate) span: Span,
158    #[subdiagnostic]
159    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
160}
161
162#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type")));
                        diag.code(E0133);
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
163#[diag(
164    "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type",
165    code = E0133,
166)]
167pub(crate) struct UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
168    #[label("unsafe binder cast")]
169    pub(crate) span: Span,
170    #[subdiagnostic]
171    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
172}
173
174#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        missing_target_features: __binding_2,
                        missing_target_features_count: __binding_3,
                        note: __binding_4,
                        build_target_features: __binding_5,
                        build_target_features_count: __binding_6,
                        unsafe_not_inherited_note: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->\n    [1] feature\n    *[count] features\n    }: {$missing_target_features}")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.arg("missing_target_features", __binding_2);
                        diag.arg("missing_target_features_count", __binding_3);
                        diag.arg("build_target_features", __binding_5);
                        diag.arg("build_target_features_count", __binding_6);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function with `#[target_feature]`")));
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$build_target_features} target {$build_target_features_count ->\n        [1] feature\n        *[count] features\n    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->\n        [1] it\n        *[count] them\n    } in `#[target_feature]`")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
175#[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)]
176#[help(
177    "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
178    [1] feature
179    *[count] features
180    }: {$missing_target_features}"
181)]
182pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
183    #[label("call to function with `#[target_feature]`")]
184    pub(crate) span: Span,
185    pub(crate) function: String,
186    pub(crate) missing_target_features: DiagArgValue,
187    pub(crate) missing_target_features_count: usize,
188    #[note("the {$build_target_features} target {$build_target_features_count ->
189        [1] feature
190        *[count] features
191    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
192        [1] it
193        *[count] them
194    } in `#[target_feature]`")]
195    pub(crate) note: bool,
196    pub(crate) build_target_features: DiagArgValue,
197    pub(crate) build_target_features_count: usize,
198    #[subdiagnostic]
199    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
200}
201
202#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToUnsafeFunctionRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToUnsafeFunctionRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        unsafe_not_inherited_note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function `{$function}` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
203#[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)]
204#[note("consult the function's documentation for information on how to avoid undefined behavior")]
205pub(crate) struct CallToUnsafeFunctionRequiresUnsafe {
206    #[primary_span]
207    #[label("call to unsafe function")]
208    pub(crate) span: Span,
209    pub(crate) function: String,
210    #[subdiagnostic]
211    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
212}
213
214#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToUnsafeFunctionRequiresUnsafeNameless where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToUnsafeFunctionRequiresUnsafeNameless {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
215#[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)]
216#[note("consult the function's documentation for information on how to avoid undefined behavior")]
217pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNameless {
218    #[primary_span]
219    #[label("call to unsafe function")]
220    pub(crate) span: Span,
221    #[subdiagnostic]
222    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
223}
224
225#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0,
                        function: __binding_1,
                        unsafe_not_inherited_note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function `{$function}` is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
226#[diag("call to unsafe function `{$function}` is unsafe and requires unsafe function or block", code = E0133)]
227#[note("consult the function's documentation for information on how to avoid undefined behavior")]
228pub(crate) struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
229    #[primary_span]
230    #[label("call to unsafe function")]
231    pub(crate) span: Span,
232    pub(crate) function: String,
233    #[subdiagnostic]
234    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
235}
236
237#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
238#[diag(
239    "call to unsafe function is unsafe and requires unsafe function or block",
240    code = E0133
241)]
242#[note("consult the function's documentation for information on how to avoid undefined behavior")]
243pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
244    #[primary_span]
245    #[label("call to unsafe function")]
246    pub(crate) span: Span,
247    #[subdiagnostic]
248    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
249}
250
251#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfInlineAssemblyRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfInlineAssemblyRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inline assembly is entirely unchecked and can cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
252#[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)]
253#[note("inline assembly is entirely unchecked and can cause undefined behavior")]
254pub(crate) struct UseOfInlineAssemblyRequiresUnsafe {
255    #[primary_span]
256    #[label("use of inline assembly")]
257    pub(crate) span: Span,
258    #[subdiagnostic]
259    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
260}
261
262#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inline assembly is entirely unchecked and can cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
263#[diag("use of inline assembly is unsafe and requires unsafe function or block", code = E0133)]
264#[note("inline assembly is entirely unchecked and can cause undefined behavior")]
265pub(crate) struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
266    #[primary_span]
267    #[label("use of inline assembly")]
268    pub(crate) span: Span,
269    #[subdiagnostic]
270    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
271}
272
273#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InitializingTypeWithUnsafeFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InitializingTypeWithUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initializing type with an unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initialization of struct with unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
274#[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)]
275#[note("unsafe fields may carry library invariants")]
276pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafe {
277    #[primary_span]
278    #[label("initialization of struct with unsafe field")]
279    pub(crate) span: Span,
280    #[subdiagnostic]
281    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
282}
283
284#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initializing type with an unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initialization of struct with unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
285#[diag(
286    "initializing type with an unsafe field is unsafe and requires unsafe block",
287    code = E0133
288)]
289#[note("unsafe fields may carry library invariants")]
290pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
291    #[primary_span]
292    #[label("initialization of struct with unsafe field")]
293    pub(crate) span: Span,
294    #[subdiagnostic]
295    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
296}
297
298#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfMutableStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfMutableStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
299#[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)]
300#[note(
301    "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior"
302)]
303pub(crate) struct UseOfMutableStaticRequiresUnsafe {
304    #[primary_span]
305    #[label("use of mutable static")]
306    pub(crate) span: Span,
307    #[subdiagnostic]
308    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
309}
310
311#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
312#[diag("use of mutable static is unsafe and requires unsafe function or block", code = E0133)]
313#[note(
314    "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior"
315)]
316pub(crate) struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
317    #[primary_span]
318    #[label("use of mutable static")]
319    pub(crate) span: Span,
320    #[subdiagnostic]
321    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
322}
323
324#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfExternStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfExternStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
325#[diag("use of extern static is unsafe and requires unsafe block", code = E0133)]
326#[note(
327    "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior"
328)]
329pub(crate) struct UseOfExternStaticRequiresUnsafe {
330    #[primary_span]
331    #[label("use of extern static")]
332    pub(crate) span: Span,
333    #[subdiagnostic]
334    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
335}
336
337#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
338#[diag("use of extern static is unsafe and requires unsafe function or block", code = E0133)]
339#[note(
340    "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior"
341)]
342pub(crate) struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
343    #[primary_span]
344    #[label("use of extern static")]
345    pub(crate) span: Span,
346    #[subdiagnostic]
347    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
348}
349
350#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfUnsafeFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
351#[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)]
352#[note("unsafe fields may carry library invariants")]
353pub(crate) struct UseOfUnsafeFieldRequiresUnsafe {
354    #[primary_span]
355    #[label("use of unsafe field")]
356    pub(crate) span: Span,
357    #[subdiagnostic]
358    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
359}
360
361#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
362#[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)]
363#[note("unsafe fields may carry library invariants")]
364pub(crate) struct UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
365    #[primary_span]
366    #[label("use of unsafe field")]
367    pub(crate) span: Span,
368    #[subdiagnostic]
369    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
370}
371
372#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DerefOfRawPointerRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DerefOfRawPointerRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
373#[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)]
374#[note(
375    "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior"
376)]
377pub(crate) struct DerefOfRawPointerRequiresUnsafe {
378    #[primary_span]
379    #[label("dereference of raw pointer")]
380    pub(crate) span: Span,
381    #[subdiagnostic]
382    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
383}
384
385#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
386#[diag("dereference of raw pointer is unsafe and requires unsafe function or block", code = E0133)]
387#[note(
388    "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior"
389)]
390pub(crate) struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
391    #[primary_span]
392    #[label("dereference of raw pointer")]
393    pub(crate) span: Span,
394    #[subdiagnostic]
395    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
396}
397
398#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AccessToUnionFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AccessToUnionFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the field may not be properly initialized: using uninitialized data will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
399#[diag("access to union field is unsafe and requires unsafe block", code = E0133)]
400#[note(
401    "the field may not be properly initialized: using uninitialized data will cause undefined behavior"
402)]
403pub(crate) struct AccessToUnionFieldRequiresUnsafe {
404    #[primary_span]
405    #[label("access to union field")]
406    pub(crate) span: Span,
407    #[subdiagnostic]
408    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
409}
410
411#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the field may not be properly initialized: using uninitialized data will cause undefined behavior")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
412#[diag("access to union field is unsafe and requires unsafe function or block", code = E0133)]
413#[note(
414    "the field may not be properly initialized: using uninitialized data will cause undefined behavior"
415)]
416pub(crate) struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
417    #[primary_span]
418    #[label("access to union field")]
419    pub(crate) span: Span,
420    #[subdiagnostic]
421    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
422}
423
424#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MutationOfLayoutConstrainedFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MutationOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutating layout constrained fields cannot statically be checked for valid values")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
425#[diag("mutation of layout constrained field is unsafe and requires unsafe block", code = E0133)]
426#[note("mutating layout constrained fields cannot statically be checked for valid values")]
427pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafe {
428    #[primary_span]
429    #[label("mutation of layout constrained field")]
430    pub(crate) span: Span,
431    #[subdiagnostic]
432    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
433}
434
435#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutating layout constrained fields cannot statically be checked for valid values")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
436#[diag(
437    "mutation of layout constrained field is unsafe and requires unsafe function or block",
438    code = E0133
439)]
440#[note("mutating layout constrained fields cannot statically be checked for valid values")]
441pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
442    #[primary_span]
443    #[label("mutation of layout constrained field")]
444    pub(crate) span: Span,
445    #[subdiagnostic]
446    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
447}
448
449#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BorrowOfLayoutConstrainedFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BorrowOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
450#[diag("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block", code = E0133)]
451#[note(
452    "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values"
453)]
454pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafe {
455    #[primary_span]
456    #[label("borrow of layout constrained field with interior mutability")]
457    pub(crate) span: Span,
458    #[subdiagnostic]
459    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
460}
461
462#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
463#[diag(
464    "borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block",
465    code = E0133
466)]
467#[note(
468    "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values"
469)]
470pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
471    #[primary_span]
472    #[label("borrow of layout constrained field with interior mutability")]
473    pub(crate) span: Span,
474    #[subdiagnostic]
475    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
476}
477
478#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToFunctionWithRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToFunctionWithRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        missing_target_features: __binding_2,
                        missing_target_features_count: __binding_3,
                        note: __binding_4,
                        build_target_features: __binding_5,
                        build_target_features_count: __binding_6,
                        unsafe_not_inherited_note: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->\n    [1] feature\n    *[count] features\n}: {$missing_target_features}")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.arg("missing_target_features", __binding_2);
                        diag.arg("missing_target_features_count", __binding_3);
                        diag.arg("build_target_features", __binding_5);
                        diag.arg("build_target_features_count", __binding_6);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function with `#[target_feature]`")));
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$build_target_features} target {$build_target_features_count ->\n        [1] feature\n        *[count] features\n    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->\n        [1] it\n        *[count] them\n    } in `#[target_feature]`")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
479#[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)]
480#[help(
481    "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
482    [1] feature
483    *[count] features
484}: {$missing_target_features}"
485)]
486pub(crate) struct CallToFunctionWithRequiresUnsafe {
487    #[primary_span]
488    #[label("call to function with `#[target_feature]`")]
489    pub(crate) span: Span,
490    pub(crate) function: String,
491    pub(crate) missing_target_features: DiagArgValue,
492    pub(crate) missing_target_features_count: usize,
493    #[note("the {$build_target_features} target {$build_target_features_count ->
494        [1] feature
495        *[count] features
496    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
497        [1] it
498        *[count] them
499    } in `#[target_feature]`")]
500    pub(crate) note: bool,
501    pub(crate) build_target_features: DiagArgValue,
502    pub(crate) build_target_features_count: usize,
503    #[subdiagnostic]
504    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
505}
506
507#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0,
                        function: __binding_1,
                        missing_target_features: __binding_2,
                        missing_target_features_count: __binding_3,
                        note: __binding_4,
                        build_target_features: __binding_5,
                        build_target_features_count: __binding_6,
                        unsafe_not_inherited_note: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block")));
                        diag.code(E0133);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->\n    [1] feature\n    *[count] features\n}: {$missing_target_features}")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.arg("missing_target_features", __binding_2);
                        diag.arg("missing_target_features_count", __binding_3);
                        diag.arg("build_target_features", __binding_5);
                        diag.arg("build_target_features_count", __binding_6);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function with `#[target_feature]`")));
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$build_target_features} target {$build_target_features_count ->\n    [1] feature\n    *[count] features\n    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->\n    [1] it\n    *[count] them\n    } in `#[target_feature]`")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
508#[diag(
509    "call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block",
510    code = E0133,
511)]
512#[help(
513    "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
514    [1] feature
515    *[count] features
516}: {$missing_target_features}"
517)]
518pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
519    #[primary_span]
520    #[label("call to function with `#[target_feature]`")]
521    pub(crate) span: Span,
522    pub(crate) function: String,
523    pub(crate) missing_target_features: DiagArgValue,
524    pub(crate) missing_target_features_count: usize,
525    #[note("the {$build_target_features} target {$build_target_features_count ->
526    [1] feature
527    *[count] features
528    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
529    [1] it
530    *[count] them
531    } in `#[target_feature]`")]
532    pub(crate) note: bool,
533    pub(crate) build_target_features: DiagArgValue,
534    pub(crate) build_target_features_count: usize,
535    #[subdiagnostic]
536    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
537}
538
539#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeBinderCastRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeBinderCastRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type")));
                        diag.code(E0133);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
540#[diag(
541    "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type",
542    code = E0133,
543)]
544pub(crate) struct UnsafeBinderCastRequiresUnsafe {
545    #[primary_span]
546    #[label("unsafe binder cast")]
547    pub(crate) span: Span,
548    #[subdiagnostic]
549    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
550}
551
552#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast is unsafe and requires unsafe block or unsafe fn information that may be required to uphold safety guarantees of a type")));
                        diag.code(E0133);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
553#[diag(
554    "unsafe binder cast is unsafe and requires unsafe block or unsafe fn information that may be required to uphold safety guarantees of a type",
555    code = E0133,
556)]
557pub(crate) struct UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
558    #[primary_span]
559    #[label("unsafe binder cast")]
560    pub(crate) span: Span,
561    #[subdiagnostic]
562    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
563}
564
565#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnsafeNotInheritedNote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnsafeNotInheritedNote { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items do not inherit unsafety from separate enclosing items")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
566#[label("items do not inherit unsafety from separate enclosing items")]
567pub(crate) struct UnsafeNotInheritedNote {
568    #[primary_span]
569    pub(crate) span: Span,
570}
571
572pub(crate) struct UnsafeNotInheritedLintNote {
573    pub(crate) signature_span: Span,
574    pub(crate) body_span: Span,
575}
576
577impl Subdiagnostic for UnsafeNotInheritedLintNote {
578    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
579        diag.span_note(
580            self.signature_span,
581            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an unsafe function restricts its caller, but its body is safe by default"))msg!("an unsafe function restricts its caller, but its body is safe by default"),
582        );
583        let body_start = self.body_span.shrink_to_lo();
584        let body_end = self.body_span.shrink_to_hi();
585        diag.tool_only_multipart_suggestion(
586            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider wrapping the function body in an unsafe block"))msg!("consider wrapping the function body in an unsafe block"),
587            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [(body_start, "{ unsafe ".into()), (body_end, "}".into())]))vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())],
588            Applicability::MachineApplicable,
589        );
590    }
591}
592
593#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnusedUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedUnsafe { span: __binding_0, enclosing: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary `unsafe` block")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary `unsafe` block")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
594#[diag("unnecessary `unsafe` block")]
595pub(crate) struct UnusedUnsafe {
596    #[label("unnecessary `unsafe` block")]
597    pub(crate) span: Span,
598    #[subdiagnostic]
599    pub(crate) enclosing: Option<UnusedUnsafeEnclosing>,
600}
601
602#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedUnsafeEnclosing {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnusedUnsafeEnclosing::Block { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("because it's nested under this `unsafe` block")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
603pub(crate) enum UnusedUnsafeEnclosing {
604    #[label("because it's nested under this `unsafe` block")]
605    Block {
606        #[primary_span]
607        span: Span,
608    },
609}
610
611pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'a, 'tcx> {
612    pub(crate) cx: &'a RustcPatCtxt<'a, 'tcx>,
613    pub(crate) scrut_span: Span,
614    pub(crate) braces_span: Option<Span>,
615    pub(crate) ty: Ty<'tcx>,
616}
617
618impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_> {
619    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
620        let mut diag =
621            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-exhaustive patterns: type `{$ty}` is non-empty"))msg!("non-exhaustive patterns: type `{$ty}` is non-empty"));
622        diag.span(self.scrut_span);
623        diag.code(E0004);
624        let peeled_ty = self.ty.peel_refs();
625        diag.arg("ty", self.ty);
626        diag.arg("peeled_ty", peeled_ty);
627
628        if let ty::Adt(def, _) = peeled_ty.kind() {
629            let def_span = self
630                .cx
631                .tcx
632                .hir_get_if_local(def.did())
633                .and_then(|node| node.ident())
634                .map(|ident| ident.span)
635                .unwrap_or_else(|| self.cx.tcx.def_span(def.did()));
636
637            // workaround to make test pass
638            let mut span: MultiSpan = def_span.into();
639            span.push_span_label(def_span, "");
640
641            diag.span_note(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$peeled_ty}` defined here"))msg!("`{$peeled_ty}` defined here"));
642        }
643
644        let is_non_exhaustive = #[allow(non_exhaustive_omitted_patterns)] match self.ty.kind() {
    ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive() =>
        true,
    _ => false,
}matches!(self.ty.kind(),
645            ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive());
646        if is_non_exhaustive {
647            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the matched value is of type `{$ty}`, which is marked as non-exhaustive"))msg!(
648                "the matched value is of type `{$ty}`, which is marked as non-exhaustive"
649            ));
650        } else {
651            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the matched value is of type `{$ty}`"))msg!("the matched value is of type `{$ty}`"));
652        }
653
654        if let ty::Ref(_, sub_ty, _) = self.ty.kind() {
655            if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.typing_env) {
656                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references are always considered inhabited"))msg!("references are always considered inhabited"));
657            }
658        }
659
660        let sm = self.cx.tcx.sess.source_map();
661        if let Some(braces_span) = self.braces_span {
662            // Get the span for the empty match body `{}`.
663            let (indentation, more) = if let Some(snippet) = sm.indentation_before(self.scrut_span)
664            {
665                (::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("\n{0}", snippet))
    })format!("\n{snippet}"), "    ")
666            } else {
667                (" ".to_string(), "")
668            };
669            diag.span_suggestion_verbose(
670                braces_span,
671                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown"))msg!("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown"),
672                ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!(" {{{0}{1}_ => todo!(),{0}}}",
                indentation, more))
    })format!(" {{{indentation}{more}_ => todo!(),{indentation}}}"),
673                Applicability::HasPlaceholders,
674            );
675        } else {
676            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern"))msg!(
677                "ensure that all possible cases are being handled by adding a match arm with a wildcard pattern"
678            ));
679        }
680
681        diag
682    }
683}
684
685#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NonExhaustiveMatchAllArmsGuarded
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    NonExhaustiveMatchAllArmsGuarded => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("match arms with guards don't count towards exhaustivity")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
686#[note("match arms with guards don't count towards exhaustivity")]
687pub(crate) struct NonExhaustiveMatchAllArmsGuarded;
688
689#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticInPattern where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    StaticInPattern {
                        span: __binding_0, static_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("statics cannot be referenced in patterns")));
                        diag.code(E0158);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't be used in patterns")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`static` defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
690#[diag("statics cannot be referenced in patterns", code = E0158)]
691pub(crate) struct StaticInPattern {
692    #[primary_span]
693    #[label("can't be used in patterns")]
694    pub(crate) span: Span,
695    #[label("`static` defined here")]
696    pub(crate) static_span: Span,
697}
698
699#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstParamInPattern where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstParamInPattern {
                        span: __binding_0, const_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant parameters cannot be referenced in patterns")));
                        diag.code(E0158);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't be used in patterns")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
700#[diag("constant parameters cannot be referenced in patterns", code = E0158)]
701pub(crate) struct ConstParamInPattern {
702    #[primary_span]
703    #[label("can't be used in patterns")]
704    pub(crate) span: Span,
705    #[label("constant defined here")]
706    pub(crate) const_span: Span,
707}
708
709#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NonConstPath
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NonConstPath { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("runtime values cannot be referenced in patterns")));
                        diag.code(E0080);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("references a runtime value")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
710#[diag("runtime values cannot be referenced in patterns", code = E0080)]
711pub(crate) struct NonConstPath {
712    #[primary_span]
713    #[label("references a runtime value")]
714    pub(crate) span: Span,
715}
716
717#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachablePattern<'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 {
                    UnreachablePattern {
                        span: __binding_0,
                        matches_no_values: __binding_1,
                        matches_no_values_ty: __binding_2,
                        uninhabited_note: __binding_3,
                        covered_by_catchall: __binding_4,
                        wanted_constant: __binding_5,
                        accessible_constant: __binding_6,
                        inaccessible_constant: __binding_7,
                        pattern_let_binding: __binding_8,
                        covered_by_one: __binding_9,
                        covered_by_many: __binding_10,
                        covered_by_many_n_more_count: __binding_11,
                        suggest_remove: __binding_12 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable pattern")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("matches_no_values_ty", __binding_2);
                        diag.arg("covered_by_many_n_more_count", __binding_11);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no value can reach this")));
                        }
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches no values because `{$matches_no_values_ty}` is uninhabited")));
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types")));
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_label(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches any value")));
                        }
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_note(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a constant of the same name imported in another scope, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it needs to be imported in the pattern's scope")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.span_note(__binding_7,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a constant of the same name, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it is not accessible from this scope")));
                        }
                        if let Some(__binding_8) = __binding_8 {
                            diag.span_note(__binding_8,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a binding of the same name; if you meant to pattern match against the value of that binding, that is a feature of constants that is not available for `let` bindings")));
                        }
                        if let Some(__binding_9) = __binding_9 {
                            diag.span_label(__binding_9,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches all the relevant values")));
                        }
                        if let Some(__binding_10) = __binding_10 {
                            diag.span_note(__binding_10,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple earlier patterns match some of the same values")));
                        }
                        if let Some(__binding_12) = __binding_12 {
                            diag.span_suggestions_with_style(__binding_12,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the match arm")),
                                __code_3, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
718#[diag("unreachable pattern")]
719pub(crate) struct UnreachablePattern<'tcx> {
720    #[label("no value can reach this")]
721    pub(crate) span: Option<Span>,
722    #[label("matches no values because `{$matches_no_values_ty}` is uninhabited")]
723    pub(crate) matches_no_values: Option<Span>,
724    pub(crate) matches_no_values_ty: Ty<'tcx>,
725    #[note(
726        "to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types"
727    )]
728    pub(crate) uninhabited_note: Option<()>,
729    #[label("matches any value")]
730    pub(crate) covered_by_catchall: Option<Span>,
731    #[subdiagnostic]
732    pub(crate) wanted_constant: Option<WantedConstant>,
733    #[note(
734        "there is a constant of the same name imported in another scope, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it needs to be imported in the pattern's scope"
735    )]
736    pub(crate) accessible_constant: Option<Span>,
737    #[note(
738        "there is a constant of the same name, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it is not accessible from this scope"
739    )]
740    pub(crate) inaccessible_constant: Option<Span>,
741    #[note(
742        "there is a binding of the same name; if you meant to pattern match against the value of that binding, that is a feature of constants that is not available for `let` bindings"
743    )]
744    pub(crate) pattern_let_binding: Option<Span>,
745    #[label("matches all the relevant values")]
746    pub(crate) covered_by_one: Option<Span>,
747    #[note("multiple earlier patterns match some of the same values")]
748    pub(crate) covered_by_many: Option<MultiSpan>,
749    pub(crate) covered_by_many_n_more_count: usize,
750    #[suggestion("remove the match arm", code = "", applicability = "machine-applicable")]
751    pub(crate) suggest_remove: Option<Span>,
752}
753
754#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for WantedConstant {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    WantedConstant {
                        span: __binding_0,
                        is_typo: __binding_1,
                        const_name: __binding_2,
                        const_path: __binding_3 } => {
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_typo".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("const_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("const_path".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to pattern match against the value of {$is_typo ->\n    [true] similarly named constant\n    *[false] constant\n    } `{$const_name}` instead of introducing a new catch-all binding")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_4, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
755#[suggestion(
756    "you might have meant to pattern match against the value of {$is_typo ->
757    [true] similarly named constant
758    *[false] constant
759    } `{$const_name}` instead of introducing a new catch-all binding",
760    code = "{const_path}",
761    applicability = "machine-applicable"
762)]
763pub(crate) struct WantedConstant {
764    #[primary_span]
765    pub(crate) span: Span,
766    pub(crate) is_typo: bool,
767    pub(crate) const_name: String,
768    pub(crate) const_path: String,
769}
770
771#[derive(const _: () =
    {
        impl<'_sess, 'desc, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachableDueToUninhabited<'desc, '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 {
                    UnreachableDueToUninhabited {
                        descr: __binding_0,
                        expr: __binding_1,
                        orig: __binding_2,
                        ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable {$descr}")));
                        ;
                        diag.arg("descr", __binding_0);
                        diag.arg("ty", __binding_3);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable {$descr}")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("any code following this expression is unreachable")));
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this expression has type `{$ty}`, which is uninhabited")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
772#[diag("unreachable {$descr}")]
773pub(crate) struct UnreachableDueToUninhabited<'desc, 'tcx> {
774    pub descr: &'desc str,
775    #[label("unreachable {$descr}")]
776    pub expr: Span,
777    #[label("any code following this expression is unreachable")]
778    #[note("this expression has type `{$ty}`, which is uninhabited")]
779    pub orig: Span,
780    pub ty: Ty<'tcx>,
781}
782
783#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstPatternDependsOnGenericParameter where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstPatternDependsOnGenericParameter { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant pattern cannot depend on generic parameters")));
                        diag.code(E0158);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` depends on a generic parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
784#[diag("constant pattern cannot depend on generic parameters", code = E0158)]
785pub(crate) struct ConstPatternDependsOnGenericParameter {
786    #[primary_span]
787    #[label("`const` depends on a generic parameter")]
788    pub(crate) span: Span,
789}
790
791#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CouldNotEvalConstPattern where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CouldNotEvalConstPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not evaluate constant pattern")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not evaluate constant")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
792#[diag("could not evaluate constant pattern")]
793pub(crate) struct CouldNotEvalConstPattern {
794    #[primary_span]
795    #[label("could not evaluate constant")]
796    pub(crate) span: Span,
797}
798
799#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LowerRangeBoundMustBeLessThanOrEqualToUpper where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LowerRangeBoundMustBeLessThanOrEqualToUpper {
                        span: __binding_0, teach: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lower bound for range pattern must be less than or equal to upper bound")));
                        diag.code(E0030);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lower bound larger than upper bound")));
                        if __binding_1 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("when matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
800#[diag("lower bound for range pattern must be less than or equal to upper bound", code = E0030)]
801pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
802    #[primary_span]
803    #[label("lower bound larger than upper bound")]
804    pub(crate) span: Span,
805    #[note(
806        "when matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range"
807    )]
808    pub(crate) teach: bool,
809}
810
811#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            LiteralOutOfRange<'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 {
                    LiteralOutOfRange {
                        span: __binding_0,
                        ty: __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.arg("ty", __binding_1);
                        diag.arg("min", __binding_2);
                        diag.arg("max", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this value does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
812#[diag("literal out of range for `{$ty}`")]
813pub(crate) struct LiteralOutOfRange<'tcx> {
814    #[primary_span]
815    #[label("this value does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")]
816    pub(crate) span: Span,
817    pub(crate) ty: Ty<'tcx>,
818    pub(crate) min: i128,
819    pub(crate) max: u128,
820}
821
822#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LowerRangeBoundMustBeLessThanUpper where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LowerRangeBoundMustBeLessThanUpper { span: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lower bound for range pattern must be less than upper bound")));
                        diag.code(E0579);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
823#[diag("lower bound for range pattern must be less than upper bound", code = E0579)]
824pub(crate) struct LowerRangeBoundMustBeLessThanUpper {
825    #[primary_span]
826    pub(crate) span: Span,
827}
828
829#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UpperRangeBoundCannotBeMin where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UpperRangeBoundCannotBeMin { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("exclusive upper bound for a range bound cannot be the minimum")));
                        diag.code(E0579);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
830#[diag("exclusive upper bound for a range bound cannot be the minimum", code = E0579)]
831pub(crate) struct UpperRangeBoundCannotBeMin {
832    #[primary_span]
833    pub(crate) span: Span,
834}
835
836#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BindingsWithVariantName where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BindingsWithVariantName {
                        suggestion: __binding_0,
                        ty_path: __binding_1,
                        name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`")));
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}::{0}", __binding_2,
                                                        __binding_1))
                                            })].into_iter();
                        diag.code(E0170);
                        ;
                        diag.arg("ty_path", __binding_1);
                        diag.arg("name", __binding_2);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_suggestions_with_style(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to match on the variant, qualify the path")),
                                __code_5, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
837#[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)]
838pub(crate) struct BindingsWithVariantName {
839    #[suggestion(
840        "to match on the variant, qualify the path",
841        code = "{ty_path}::{name}",
842        applicability = "machine-applicable"
843    )]
844    pub(crate) suggestion: Option<Span>,
845    pub(crate) ty_path: String,
846    pub(crate) name: Ident,
847}
848
849#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsIfLet where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsIfLet { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `if let` {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the `if let` is useless")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider replacing the `if let` with a `let`")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
850#[diag(
851    "irrefutable `if let` {$count ->
852    [one] pattern
853    *[other] patterns
854}"
855)]
856#[note(
857    "{$count ->
858    [one] this pattern
859    *[other] these patterns
860} will always match, so the `if let` is useless"
861)]
862#[help("consider replacing the `if let` with a `let`")]
863pub(crate) struct IrrefutableLetPatternsIfLet {
864    pub(crate) count: usize,
865}
866
867#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsIfLetGuard where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsIfLetGuard { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `if let` guard {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the guard is useless")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the guard and adding a `let` inside the match arm")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
868#[diag(
869    "irrefutable `if let` guard {$count ->
870    [one] pattern
871    *[other] patterns
872}"
873)]
874#[note(
875    "{$count ->
876    [one] this pattern
877    *[other] these patterns
878} will always match, so the guard is useless"
879)]
880#[help("consider removing the guard and adding a `let` inside the match arm")]
881pub(crate) struct IrrefutableLetPatternsIfLetGuard {
882    pub(crate) count: usize,
883}
884
885#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsLetElse where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsLetElse { be_replaced: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable `else` clause")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this pattern always matches, so the else clause is unreachable")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
886#[diag("unreachable `else` clause")]
887#[note("this pattern always matches, so the else clause is unreachable")]
888pub(crate) struct IrrefutableLetPatternsLetElse {
889    #[subdiagnostic]
890    pub(crate) be_replaced: Option<LetElseReplacementSuggestion>,
891}
892
893#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for LetElseReplacementSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    LetElseReplacementSuggestion {
                        span: __binding_0, lhs: __binding_1, rhs: __binding_2 } => {
                        let __code_6 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("let {0} = {1}",
                                                        __binding_1, __binding_2))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("lhs".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("rhs".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `let {$lhs} = {$rhs}` to match on a specific variant")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_6, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic, #[automatically_derived]
impl ::core::fmt::Debug for LetElseReplacementSuggestion {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "LetElseReplacementSuggestion", "span", &self.span, "lhs",
            &self.lhs, "rhs", &&self.rhs)
    }
}Debug)]
894#[suggestion(
895    "consider using `let {$lhs} = {$rhs}` to match on a specific variant",
896    code = "let {lhs} = {rhs}",
897    applicability = "machine-applicable"
898)]
899pub(crate) struct LetElseReplacementSuggestion {
900    #[primary_span]
901    pub(crate) span: Span,
902    pub(crate) lhs: String,
903    pub(crate) rhs: String,
904}
905
906#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsWhileLet where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsWhileLet { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `while let` {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the loop will never exit")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
907#[diag(
908    "irrefutable `while let` {$count ->
909    [one] pattern
910    *[other] patterns
911}"
912)]
913#[note(
914    "{$count ->
915    [one] this pattern
916    *[other] these patterns
917} will always match, so the loop will never exit"
918)]
919#[help("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")]
920pub(crate) struct IrrefutableLetPatternsWhileLet {
921    pub(crate) count: usize,
922}
923
924#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            BorrowOfMovedValue<'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 {
                    BorrowOfMovedValue {
                        binding_span: __binding_0,
                        conflicts_ref: __binding_1,
                        name: __binding_2,
                        ty: __binding_3,
                        suggest_borrowing: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of moved value")));
                        let __code_7 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("ref "))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_2);
                        diag.arg("ty", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value moved into `{$name}` here")));
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait")));
                        for __binding_1 in __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value borrowed here after move")));
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_suggestions_with_style(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow this binding in the pattern to avoid moving the value")),
                                __code_7, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
925#[diag("borrow of moved value")]
926pub(crate) struct BorrowOfMovedValue<'tcx> {
927    #[primary_span]
928    #[label("value moved into `{$name}` here")]
929    #[label(
930        "move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait"
931    )]
932    pub(crate) binding_span: Span,
933    #[label("value borrowed here after move")]
934    pub(crate) conflicts_ref: Vec<Span>,
935    pub(crate) name: Ident,
936    pub(crate) ty: Ty<'tcx>,
937    #[suggestion(
938        "borrow this binding in the pattern to avoid moving the value",
939        code = "ref ",
940        applicability = "machine-applicable"
941    )]
942    pub(crate) suggest_borrowing: Option<Span>,
943}
944
945#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleMutBorrows where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MultipleMutBorrows {
                        span: __binding_0, occurrences: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot borrow value as mutable more than once at a time")));
                        ;
                        diag.span(__binding_0);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
946#[diag("cannot borrow value as mutable more than once at a time")]
947pub(crate) struct MultipleMutBorrows {
948    #[primary_span]
949    pub(crate) span: Span,
950    #[subdiagnostic]
951    pub(crate) occurrences: Vec<Conflict>,
952}
953
954#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AlreadyBorrowed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AlreadyBorrowed {
                        span: __binding_0, occurrences: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot borrow value as mutable because it is also borrowed as immutable")));
                        ;
                        diag.span(__binding_0);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
955#[diag("cannot borrow value as mutable because it is also borrowed as immutable")]
956pub(crate) struct AlreadyBorrowed {
957    #[primary_span]
958    pub(crate) span: Span,
959    #[subdiagnostic]
960    pub(crate) occurrences: Vec<Conflict>,
961}
962
963#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AlreadyMutBorrowed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AlreadyMutBorrowed {
                        span: __binding_0, occurrences: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot borrow value as immutable because it is also borrowed as mutable")));
                        ;
                        diag.span(__binding_0);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
964#[diag("cannot borrow value as immutable because it is also borrowed as mutable")]
965pub(crate) struct AlreadyMutBorrowed {
966    #[primary_span]
967    pub(crate) span: Span,
968    #[subdiagnostic]
969    pub(crate) occurrences: Vec<Conflict>,
970}
971
972#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MovedWhileBorrowed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MovedWhileBorrowed {
                        span: __binding_0, occurrences: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot move out of value because it is borrowed")));
                        ;
                        diag.span(__binding_0);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
973#[diag("cannot move out of value because it is borrowed")]
974pub(crate) struct MovedWhileBorrowed {
975    #[primary_span]
976    pub(crate) span: Span,
977    #[subdiagnostic]
978    pub(crate) occurrences: Vec<Conflict>,
979}
980
981#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for Conflict {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    Conflict::Mut { span: __binding_0, name: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value is mutably borrowed by `{$name}` here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    Conflict::Ref { span: __binding_0, name: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value is borrowed by `{$name}` here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    Conflict::Moved { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value is moved into `{$name}` here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
982pub(crate) enum Conflict {
983    #[label("value is mutably borrowed by `{$name}` here")]
984    Mut {
985        #[primary_span]
986        span: Span,
987        name: Symbol,
988    },
989    #[label("value is borrowed by `{$name}` here")]
990    Ref {
991        #[primary_span]
992        span: Span,
993        name: Symbol,
994    },
995    #[label("value is moved into `{$name}` here")]
996    Moved {
997        #[primary_span]
998        span: Span,
999        name: Symbol,
1000    },
1001}
1002
1003#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnionPattern
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnionPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use unions in constant patterns")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't use a `union` here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1004#[diag("cannot use unions in constant patterns")]
1005pub(crate) struct UnionPattern {
1006    #[primary_span]
1007    #[label("can't use a `union` here")]
1008    pub(crate) span: Span,
1009}
1010
1011#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TypeNotStructural<'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 {
                    TypeNotStructural {
                        span: __binding_0,
                        ty_def_span: __binding_1,
                        ty: __binding_2,
                        manual_partialeq_impl_span: __binding_3,
                        manual_partialeq_impl_note: __binding_4,
                        suggestion: __binding_5,
                        is_local: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant of non-structural type `{$ty}` in a pattern")));
                        ;
                        diag.arg("ty", __binding_2);
                        diag.arg("is_local", __binding_6);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant of non-structural type")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_local ->\n        *[true] `{$ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns\n        [false] `{$ty}` is not usable in patterns\n    }")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.span_note(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details")));
                        }
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details")));
                        }
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1012#[diag("constant of non-structural type `{$ty}` in a pattern")]
1013pub(crate) struct TypeNotStructural<'tcx> {
1014    #[primary_span]
1015    #[label("constant of non-structural type")]
1016    pub(crate) span: Span,
1017    #[label(
1018        "{$is_local ->
1019        *[true] `{$ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
1020        [false] `{$ty}` is not usable in patterns
1021    }"
1022    )]
1023    pub(crate) ty_def_span: Span,
1024    pub(crate) ty: Ty<'tcx>,
1025    #[note(
1026        "the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see \
1027         https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
1028    )]
1029    pub(crate) manual_partialeq_impl_span: Option<Span>,
1030    #[note(
1031        "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
1032    )]
1033    pub(crate) manual_partialeq_impl_note: bool,
1034    #[subdiagnostic]
1035    pub(crate) suggestion: Option<SuggestEq<'tcx>>,
1036    pub(crate) is_local: bool,
1037}
1038
1039#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for SuggestEq<'tcx> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SuggestEq::AddIf {
                        pat_span: __binding_0,
                        if_span: __binding_1,
                        name: __binding_2,
                        ty: __binding_3,
                        manual_partialeq_impl: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_8 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("binding"))
                                });
                        let __code_9 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" if binding == {0}",
                                            __binding_2))
                                });
                        suggestions.push((__binding_0, __code_8));
                        suggestions.push((__binding_1, __code_9));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("manual_partialeq_impl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$manual_partialeq_impl ->\n            [false] if `{$ty}` manually implemented `PartialEq`, you could add\n            *[true] add\n        } a condition to the match arm checking for equality")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    SuggestEq::AddToIf {
                        pat_span: __binding_0,
                        span: __binding_1,
                        name: __binding_2,
                        ty: __binding_3,
                        manual_partialeq_impl: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_10 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("binding"))
                                });
                        let __code_11 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" && binding == {0}",
                                            __binding_2))
                                });
                        suggestions.push((__binding_0, __code_10));
                        suggestions.push((__binding_1, __code_11));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("manual_partialeq_impl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$manual_partialeq_impl ->\n            [false] if `{$ty}` manually implemented `PartialEq`, you could add\n            *[true] add\n        } a check for equality to the condition of the match arm")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    SuggestEq::AddToLetChain {
                        pat_span: __binding_0,
                        span: __binding_1,
                        name: __binding_2,
                        ty: __binding_3,
                        manual_partialeq_impl: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_12 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("binding"))
                                });
                        let __code_13 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" && binding == {0}",
                                            __binding_2))
                                });
                        suggestions.push((__binding_0, __code_12));
                        suggestions.push((__binding_1, __code_13));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("manual_partialeq_impl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$manual_partialeq_impl ->\n            [false] if `{$ty}` manually implemented `PartialEq`, you could check\n            *[true] check\n        } for equality instead of pattern matching")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    SuggestEq::ReplaceWithEq {
                        removal: __binding_0,
                        eq: __binding_1,
                        ty: __binding_2,
                        manual_partialeq_impl: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_14 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_15 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" == "))
                                });
                        suggestions.push((__binding_0, __code_14));
                        suggestions.push((__binding_1, __code_15));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("manual_partialeq_impl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$manual_partialeq_impl ->\n            [false] if `{$ty}` manually implemented `PartialEq`, you could check\n            *[true] check\n        } for equality instead of pattern matching")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    SuggestEq::ReplaceLetElseWithIf {
                        if_span: __binding_0,
                        eq: __binding_1,
                        else_span: __binding_2,
                        ty: __binding_3,
                        manual_partialeq_impl: __binding_4 } => {
                        let mut suggestions = Vec::new();
                        let __code_16 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("if "))
                                });
                        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_16));
                        suggestions.push((__binding_1, __code_17));
                        suggestions.push((__binding_2, __code_18));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        sub_args.insert("manual_partialeq_impl".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_4,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$manual_partialeq_impl ->\n            [false] if `{$ty}` manually implemented `PartialEq`, you could check\n            *[true] check\n        } for equality instead of pattern matching")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
1040pub(crate) enum SuggestEq<'tcx> {
1041    #[multipart_suggestion(
1042        "{$manual_partialeq_impl ->
1043            [false] if `{$ty}` manually implemented `PartialEq`, you could add
1044            *[true] add
1045        } a condition to the match arm checking for equality",
1046        applicability = "maybe-incorrect",
1047        style = "verbose"
1048    )]
1049    AddIf {
1050        #[suggestion_part(code = "binding")]
1051        pat_span: Span,
1052        #[suggestion_part(code = " if binding == {name}")]
1053        if_span: Span,
1054        name: String,
1055        ty: Ty<'tcx>,
1056        manual_partialeq_impl: bool,
1057    },
1058    #[multipart_suggestion(
1059        "{$manual_partialeq_impl ->
1060            [false] if `{$ty}` manually implemented `PartialEq`, you could add
1061            *[true] add
1062        } a check for equality to the condition of the match arm",
1063        applicability = "maybe-incorrect",
1064        style = "verbose"
1065    )]
1066    AddToIf {
1067        #[suggestion_part(code = "binding")]
1068        pat_span: Span,
1069        #[suggestion_part(code = " && binding == {name}")]
1070        span: Span,
1071        name: String,
1072        ty: Ty<'tcx>,
1073        manual_partialeq_impl: bool,
1074    },
1075    #[multipart_suggestion(
1076        "{$manual_partialeq_impl ->
1077            [false] if `{$ty}` manually implemented `PartialEq`, you could check
1078            *[true] check
1079        } for equality instead of pattern matching",
1080        applicability = "maybe-incorrect",
1081        style = "verbose"
1082    )]
1083    AddToLetChain {
1084        #[suggestion_part(code = "binding")]
1085        pat_span: Span,
1086        #[suggestion_part(code = " && binding == {name}")]
1087        span: Span,
1088        name: String,
1089        ty: Ty<'tcx>,
1090        manual_partialeq_impl: bool,
1091    },
1092    #[multipart_suggestion(
1093        "{$manual_partialeq_impl ->
1094            [false] if `{$ty}` manually implemented `PartialEq`, you could check
1095            *[true] check
1096        } for equality instead of pattern matching",
1097        applicability = "maybe-incorrect",
1098        style = "verbose"
1099    )]
1100    ReplaceWithEq {
1101        #[suggestion_part(code = "")]
1102        removal: Span,
1103        #[suggestion_part(code = " == ")]
1104        eq: Span,
1105        ty: Ty<'tcx>,
1106        manual_partialeq_impl: bool,
1107    },
1108    #[multipart_suggestion(
1109        "{$manual_partialeq_impl ->
1110            [false] if `{$ty}` manually implemented `PartialEq`, you could check
1111            *[true] check
1112        } for equality instead of pattern matching",
1113        applicability = "maybe-incorrect",
1114        style = "verbose"
1115    )]
1116    ReplaceLetElseWithIf {
1117        #[suggestion_part(code = "if ")]
1118        if_span: Span,
1119        #[suggestion_part(code = " == ")]
1120        eq: Span,
1121        #[suggestion_part(code = " ")]
1122        else_span: Span,
1123        ty: Ty<'tcx>,
1124        manual_partialeq_impl: bool,
1125    },
1126}
1127
1128#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TypeNotPartialEq<'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 {
                    TypeNotPartialEq { span: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant of non-structural type `{$ty}` in a pattern")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant of non-structural type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1129#[diag("constant of non-structural type `{$ty}` in a pattern")]
1130#[note(
1131    "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
1132)]
1133pub(crate) struct TypeNotPartialEq<'tcx> {
1134    #[primary_span]
1135    #[label("constant of non-structural type")]
1136    pub(crate) span: Span,
1137    pub(crate) ty: Ty<'tcx>,
1138}
1139
1140#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidPattern<'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 {
                    InvalidPattern {
                        span: __binding_0,
                        non_sm_ty: __binding_1,
                        prefix: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$prefix} `{$non_sm_ty}` cannot be used in patterns")));
                        ;
                        diag.arg("non_sm_ty", __binding_1);
                        diag.arg("prefix", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$prefix} can't be used in patterns")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1141#[diag("{$prefix} `{$non_sm_ty}` cannot be used in patterns")]
1142pub(crate) struct InvalidPattern<'tcx> {
1143    #[primary_span]
1144    #[label("{$prefix} can't be used in patterns")]
1145    pub(crate) span: Span,
1146    pub(crate) non_sm_ty: Ty<'tcx>,
1147    pub(crate) prefix: String,
1148}
1149
1150#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsizedPattern<'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 {
                    UnsizedPattern { span: __binding_0, non_sm_ty: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns")));
                        ;
                        diag.arg("non_sm_ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1151#[diag("cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns")]
1152pub(crate) struct UnsizedPattern<'tcx> {
1153    #[primary_span]
1154    pub(crate) span: Span,
1155    pub(crate) non_sm_ty: Ty<'tcx>,
1156}
1157
1158#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NaNPattern
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NaNPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use NaN in patterns")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("NaNs compare inequal to everything, even themselves, so this pattern would never match")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using the `is_nan` method instead")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("evaluates to `NaN`, which is not allowed in patterns")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1159#[diag("cannot use NaN in patterns")]
1160#[note("NaNs compare inequal to everything, even themselves, so this pattern would never match")]
1161#[help("try using the `is_nan` method instead")]
1162pub(crate) struct NaNPattern {
1163    #[primary_span]
1164    #[label("evaluates to `NaN`, which is not allowed in patterns")]
1165    pub(crate) span: Span,
1166}
1167
1168#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for PointerPattern
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    PointerPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see https://github.com/rust-lang/rust/issues/70861 for details")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't be used in patterns")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1169#[diag(
1170    "function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon"
1171)]
1172#[note("see https://github.com/rust-lang/rust/issues/70861 for details")]
1173pub(crate) struct PointerPattern {
1174    #[primary_span]
1175    #[label("can't be used in patterns")]
1176    pub(crate) span: Span,
1177}
1178
1179#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            NonEmptyNeverPattern<'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 {
                    NonEmptyNeverPattern { span: __binding_0, ty: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mismatched types")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the matched value is of type `{$ty}`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a never pattern must be used on an uninhabited type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1180#[diag("mismatched types")]
1181#[note("the matched value is of type `{$ty}`")]
1182pub(crate) struct NonEmptyNeverPattern<'tcx> {
1183    #[primary_span]
1184    #[label("a never pattern must be used on an uninhabited type")]
1185    pub(crate) span: Span,
1186    pub(crate) ty: Ty<'tcx>,
1187}
1188
1189#[derive(const _: () =
    {
        impl<'_sess, 's, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            PatternNotCovered<'s, '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 {
                    PatternNotCovered {
                        span: __binding_0,
                        origin: __binding_1,
                        uncovered: __binding_2,
                        inform: __binding_3,
                        interpreted_as_const: __binding_4,
                        interpreted_as_const_sugg: __binding_5,
                        adt_defined_here: __binding_6,
                        witness_1_is_privately_uninhabited: __binding_7,
                        witness_1: __binding_8,
                        _p: __binding_9,
                        pattern_ty: __binding_10,
                        let_suggestion: __binding_11,
                        misc_suggestion: __binding_12 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("refutable pattern in {$origin}")));
                        diag.code(E0005);
                        ;
                        diag.arg("origin", __binding_1);
                        diag.arg("witness_1", __binding_8);
                        diag.arg("pattern_ty", __binding_10);
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_2);
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        if let Some(__binding_4) = __binding_4 {
                            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);
                        }
                        if __binding_7 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future")));
                        }
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the matched value is of type `{$pattern_ty}`")));
                        if let Some(__binding_11) = __binding_11 {
                            diag.subdiagnostic(__binding_11);
                        }
                        if let Some(__binding_12) = __binding_12 {
                            diag.subdiagnostic(__binding_12);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1190#[diag("refutable pattern in {$origin}", code = E0005)]
1191pub(crate) struct PatternNotCovered<'s, 'tcx> {
1192    #[primary_span]
1193    pub(crate) span: Span,
1194    pub(crate) origin: &'s str,
1195    #[subdiagnostic]
1196    pub(crate) uncovered: Uncovered,
1197    #[subdiagnostic]
1198    pub(crate) inform: Option<Inform>,
1199    #[subdiagnostic]
1200    pub(crate) interpreted_as_const: Option<InterpretedAsConst>,
1201    #[subdiagnostic]
1202    pub(crate) interpreted_as_const_sugg: Option<InterpretedAsConstSugg>,
1203    #[subdiagnostic]
1204    pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
1205    #[note(
1206        "pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future"
1207    )]
1208    pub(crate) witness_1_is_privately_uninhabited: bool,
1209    pub(crate) witness_1: String,
1210    #[note("the matched value is of type `{$pattern_ty}`")]
1211    pub(crate) _p: (),
1212    pub(crate) pattern_ty: Ty<'tcx>,
1213    #[subdiagnostic]
1214    pub(crate) let_suggestion: Option<SuggestLet>,
1215    #[subdiagnostic]
1216    pub(crate) misc_suggestion: Option<MiscPatternSuggestion>,
1217}
1218
1219#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for Inform {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    Inform => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`let` bindings require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1220#[note(
1221    "`let` bindings require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant"
1222)]
1223#[note("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")]
1224pub(crate) struct Inform;
1225
1226#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InterpretedAsConst {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InterpretedAsConst {
                        span: __binding_0, variable: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("variable".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1227#[label(
1228    "missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable"
1229)]
1230pub(crate) struct InterpretedAsConst {
1231    #[primary_span]
1232    pub(crate) span: Span,
1233    pub(crate) variable: String,
1234}
1235
1236pub(crate) struct AdtDefinedHere<'tcx> {
1237    pub(crate) adt_def_span: Span,
1238    pub(crate) ty: Ty<'tcx>,
1239    pub(crate) variants: Vec<Variant>,
1240}
1241
1242pub(crate) struct Variant {
1243    pub(crate) span: Span,
1244}
1245
1246impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> {
1247    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1248        diag.arg("ty", self.ty);
1249        let mut spans = MultiSpan::from(self.adt_def_span);
1250
1251        for Variant { span } in self.variants {
1252            spans.push_span_label(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not covered"))msg!("not covered"));
1253        }
1254
1255        diag.span_note(spans, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty}` defined here"))msg!("`{$ty}` defined here"));
1256    }
1257}
1258
1259#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InterpretedAsConstSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InterpretedAsConstSugg {
                        span: __binding_0, variable: __binding_1 } => {
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}_var", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("variable".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("introduce a variable instead")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_19, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
1260#[suggestion(
1261    "introduce a variable instead",
1262    code = "{variable}_var",
1263    applicability = "maybe-incorrect",
1264    style = "verbose"
1265)]
1266pub(crate) struct InterpretedAsConstSugg {
1267    #[primary_span]
1268    pub(crate) span: Span,
1269    pub(crate) variable: String,
1270}
1271
1272#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for SuggestLet {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SuggestLet::If {
                        start_span: __binding_0,
                        semi_span: __binding_1,
                        count: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_20 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("if "))
                                });
                        let __code_21 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" {{ todo!() }}"))
                                });
                        suggestions.push((__binding_0, __code_20));
                        suggestions.push((__binding_1, __code_21));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("count".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might want to use `if let` to ignore the {$count ->\n            [one] variant that isn't\n            *[other] variants that aren't\n        } matched")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    SuggestLet::Else { end_span: __binding_0, count: __binding_1
                        } => {
                        let __code_22 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" else {{ todo!() }}"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("count".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might want to use `let...else` to handle the {$count ->\n            [one] variant that isn't\n            *[other] variants that aren't\n        } matched")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_22, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1273pub(crate) enum SuggestLet {
1274    #[multipart_suggestion(
1275        "you might want to use `if let` to ignore the {$count ->
1276            [one] variant that isn't
1277            *[other] variants that aren't
1278        } matched",
1279        applicability = "has-placeholders"
1280    )]
1281    If {
1282        #[suggestion_part(code = "if ")]
1283        start_span: Span,
1284        #[suggestion_part(code = " {{ todo!() }}")]
1285        semi_span: Span,
1286        count: usize,
1287    },
1288    #[suggestion(
1289        "you might want to use `let...else` to handle the {$count ->
1290            [one] variant that isn't
1291            *[other] variants that aren't
1292        } matched",
1293        code = " else {{ todo!() }}",
1294        applicability = "has-placeholders"
1295    )]
1296    Else {
1297        #[primary_span]
1298        end_span: Span,
1299        count: usize,
1300    },
1301}
1302
1303#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MiscPatternSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MiscPatternSuggestion::AttemptedIntegerLiteral {
                        start_span: __binding_0 } => {
                        let __code_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("_"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_23, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1304pub(crate) enum MiscPatternSuggestion {
1305    #[suggestion(
1306        "alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits",
1307        code = "_",
1308        applicability = "maybe-incorrect"
1309    )]
1310    AttemptedIntegerLiteral {
1311        #[primary_span]
1312        start_span: Span,
1313    },
1314}
1315
1316#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchInvalidUpdate where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchInvalidUpdate {
                        lhs: __binding_0, scrutinee: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid update of the `#[loop_match]` state")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the assignment must update this variable")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1317#[diag("invalid update of the `#[loop_match]` state")]
1318pub(crate) struct LoopMatchInvalidUpdate {
1319    #[primary_span]
1320    pub lhs: Span,
1321    #[label("the assignment must update this variable")]
1322    pub scrutinee: Span,
1323}
1324
1325#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchInvalidMatch where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchInvalidMatch { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid match on `#[loop_match]` state")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a local variable must be the scrutinee within a `#[loop_match]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1326#[diag("invalid match on `#[loop_match]` state")]
1327#[note("a local variable must be the scrutinee within a `#[loop_match]`")]
1328pub(crate) struct LoopMatchInvalidMatch {
1329    #[primary_span]
1330    pub span: Span,
1331}
1332
1333#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchUnsupportedType<'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 {
                    LoopMatchUnsupportedType {
                        span: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `#[loop_match]` state value has type `{$ty}`, which is not supported")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only integers, floats, bool, char, and enums without fields are supported")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1334#[diag("this `#[loop_match]` state value has type `{$ty}`, which is not supported")]
1335#[note("only integers, floats, bool, char, and enums without fields are supported")]
1336pub(crate) struct LoopMatchUnsupportedType<'tcx> {
1337    #[primary_span]
1338    pub span: Span,
1339    pub ty: Ty<'tcx>,
1340}
1341
1342#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchBadStatements where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchBadStatements { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("statements are not allowed in this position within a `#[loop_match]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1343#[diag("statements are not allowed in this position within a `#[loop_match]`")]
1344pub(crate) struct LoopMatchBadStatements {
1345    #[primary_span]
1346    pub span: Span,
1347}
1348
1349#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchBadRhs where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchBadRhs { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this expression must be a single `match` wrapped in a labeled block")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1350#[diag("this expression must be a single `match` wrapped in a labeled block")]
1351pub(crate) struct LoopMatchBadRhs {
1352    #[primary_span]
1353    pub span: Span,
1354}
1355
1356#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchMissingAssignment where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchMissingAssignment { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a single assignment expression")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1357#[diag("expected a single assignment expression")]
1358pub(crate) struct LoopMatchMissingAssignment {
1359    #[primary_span]
1360    pub span: Span,
1361}
1362
1363#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LoopMatchArmWithGuard where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchArmWithGuard { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("match arms that are part of a `#[loop_match]` cannot have guards")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1364#[diag("match arms that are part of a `#[loop_match]` cannot have guards")]
1365pub(crate) struct LoopMatchArmWithGuard {
1366    #[primary_span]
1367    pub span: Span,
1368}
1369
1370#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstContinueNotMonomorphicConst where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstContinueNotMonomorphicConst {
                        span: __binding_0, reason: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not determine the target branch for this `#[const_continue]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try extracting the expression into a `const` item")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1371#[diag("could not determine the target branch for this `#[const_continue]`")]
1372#[help("try extracting the expression into a `const` item")]
1373pub(crate) struct ConstContinueNotMonomorphicConst {
1374    #[primary_span]
1375    pub span: Span,
1376
1377    #[subdiagnostic]
1378    pub reason: ConstContinueNotMonomorphicConstReason,
1379}
1380
1381#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            ConstContinueNotMonomorphicConstReason {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConstContinueNotMonomorphicConstReason::ConstantParameter {
                        span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant parameters may use generics, and are not evaluated early enough")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    ConstContinueNotMonomorphicConstReason::ConstBlock {
                        span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` blocks may use generics, and are not evaluated early enough")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    ConstContinueNotMonomorphicConstReason::Other {
                        span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this value must be a literal or a monomorphic const")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1382pub(crate) enum ConstContinueNotMonomorphicConstReason {
1383    #[label("constant parameters may use generics, and are not evaluated early enough")]
1384    ConstantParameter {
1385        #[primary_span]
1386        span: Span,
1387    },
1388
1389    #[label("`const` blocks may use generics, and are not evaluated early enough")]
1390    ConstBlock {
1391        #[primary_span]
1392        span: Span,
1393    },
1394
1395    #[label("this value must be a literal or a monomorphic const")]
1396    Other {
1397        #[primary_span]
1398        span: Span,
1399    },
1400}
1401
1402#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstContinueBadConst where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstContinueBadConst { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not determine the target branch for this `#[const_continue]`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this value is too generic")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1403#[diag("could not determine the target branch for this `#[const_continue]`")]
1404pub(crate) struct ConstContinueBadConst {
1405    #[primary_span]
1406    #[label("this value is too generic")]
1407    pub span: Span,
1408}
1409
1410#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstContinueMissingLabelOrValue where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstContinueMissingLabelOrValue { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a `#[const_continue]` must break to a label with a value")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1411#[diag("a `#[const_continue]` must break to a label with a value")]
1412pub(crate) struct ConstContinueMissingLabelOrValue {
1413    #[primary_span]
1414    pub span: Span,
1415}
1416
1417#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstContinueUnknownJumpTarget where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstContinueUnknownJumpTarget { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the target of this `#[const_continue]` is not statically known")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1418#[diag("the target of this `#[const_continue]` is not statically known")]
1419pub(crate) struct ConstContinueUnknownJumpTarget {
1420    #[primary_span]
1421    pub span: Span,
1422}