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