Skip to main content

rustc_mir_build/
errors.rs

1use rustc_errors::codes::*;
2use rustc_errors::{
3    Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
4    MultiSpan, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_middle::ty::{self, Ty};
8use rustc_pattern_analysis::errors::Uncovered;
9use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::{Ident, Span, Symbol};
11
12#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CallToDeprecatedSafeFnRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CallToDeprecatedSafeFnRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        guarantee: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.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
                    }
                }
            }
        }
    };Diagnostic)]
13#[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")]
14pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe {
15    #[label("call to unsafe function")]
16    pub(crate) span: Span,
17    pub(crate) function: String,
18    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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        unsafe_not_inherited_note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function `{$function}` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
39#[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)]
40#[note("consult the function's documentation for information on how to avoid undefined behavior")]
41pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
42    #[label("call to unsafe function")]
43    pub(crate) span: Span,
44    pub(crate) function: String,
45    #[subdiagnostic]
46    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
47}
48
49#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consult the function's documentation for information on how to avoid undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to unsafe function")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
50#[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)]
51#[note("consult the function's documentation for information on how to avoid undefined behavior")]
52pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
53    #[label("call to unsafe function")]
54    pub(crate) span: Span,
55    #[subdiagnostic]
56    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
57}
58
59#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inline assembly is entirely unchecked and can cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of inline assembly")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
60#[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)]
61#[note("inline assembly is entirely unchecked and can cause undefined behavior")]
62pub(crate) struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
63    #[label("use of inline assembly")]
64    pub(crate) span: Span,
65    #[subdiagnostic]
66    pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
67}
68
69#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
                        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_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)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initializing type with an unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("initialization of struct with unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of mutable static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of extern static")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe fields may carry library invariants")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unsafe field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dereference of raw pointer")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the field may not be properly initialized: using uninitialized data will cause undefined behavior")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("access to union field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutating layout constrained fields cannot statically be checked for valid values")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutation of layout constrained field")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of layout constrained field with interior mutability")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
                        span: __binding_0, unsafe_not_inherited_note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type")));
                        diag.code(E0133);
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe binder cast")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
                        span: __binding_0,
                        function: __binding_1,
                        missing_target_features: __binding_2,
                        missing_target_features_count: __binding_3,
                        note: __binding_4,
                        build_target_features: __binding_5,
                        build_target_features_count: __binding_6,
                        unsafe_not_inherited_note: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block")));
                        diag.code(E0133);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->\n    [1] feature\n    *[count] features\n    }: {$missing_target_features}")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.arg("missing_target_features", __binding_2);
                        diag.arg("missing_target_features_count", __binding_3);
                        diag.arg("build_target_features", __binding_5);
                        diag.arg("build_target_features_count", __binding_6);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to function with `#[target_feature]`")));
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$build_target_features} target {$build_target_features_count ->\n        [1] feature\n        *[count] features\n    } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->\n        [1] it\n        *[count] them\n    } in `#[target_feature]`")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [(body_start, "{ unsafe ".into()), (body_end, "}".into())]))vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())],
629            Applicability::MachineApplicable,
630        );
631    }
632}
633
634#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnusedUnsafe
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedUnsafe { span: __binding_0, enclosing: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary `unsafe` block")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary `unsafe` block")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachablePattern<'tcx> where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnreachablePattern {
                        span: __binding_0,
                        matches_no_values: __binding_1,
                        matches_no_values_ty: __binding_2,
                        uninhabited_note: __binding_3,
                        covered_by_catchall: __binding_4,
                        wanted_constant: __binding_5,
                        accessible_constant: __binding_6,
                        inaccessible_constant: __binding_7,
                        pattern_let_binding: __binding_8,
                        covered_by_one: __binding_9,
                        covered_by_many: __binding_10,
                        covered_by_many_n_more_count: __binding_11,
                        suggest_remove: __binding_12 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable pattern")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("matches_no_values_ty", __binding_2);
                        diag.arg("covered_by_many_n_more_count", __binding_11);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no value can reach this")));
                        }
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches no values because `{$matches_no_values_ty}` is uninhabited")));
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types")));
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_label(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches any value")));
                        }
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_note(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a constant of the same name imported in another scope, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it needs to be imported in the pattern's scope")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.span_note(__binding_7,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a constant of the same name, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it is not accessible from this scope")));
                        }
                        if let Some(__binding_8) = __binding_8 {
                            diag.span_note(__binding_8,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a binding of the same name; if you meant to pattern match against the value of that binding, that is a feature of constants that is not available for `let` bindings")));
                        }
                        if let Some(__binding_9) = __binding_9 {
                            diag.span_label(__binding_9,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("matches all the relevant values")));
                        }
                        if let Some(__binding_10) = __binding_10 {
                            diag.span_note(__binding_10,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple earlier patterns match some of the same values")));
                        }
                        if let Some(__binding_12) = __binding_12 {
                            diag.span_suggestions_with_style(__binding_12,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the match arm")),
                                __code_3, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, 'desc, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachableDueToUninhabited<'desc, 'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnreachableDueToUninhabited {
                        descr: __binding_0,
                        expr: __binding_1,
                        orig: __binding_2,
                        ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable {$descr}")));
                        ;
                        diag.arg("descr", __binding_0);
                        diag.arg("ty", __binding_3);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable {$descr}")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("any code following this expression is unreachable")));
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this expression has type `{$ty}`, which is uninhabited")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
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<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BindingsWithVariantName where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BindingsWithVariantName {
                        suggestion: __binding_0,
                        ty_path: __binding_1,
                        name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`")));
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}::{0}", __binding_2,
                                                        __binding_1))
                                            })].into_iter();
                        diag.code(E0170);
                        ;
                        diag.arg("ty_path", __binding_1);
                        diag.arg("name", __binding_2);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_suggestions_with_style(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to match on the variant, qualify the path")),
                                __code_5, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
878#[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)]
879pub(crate) struct BindingsWithVariantName {
880    #[suggestion(
881        "to match on the variant, qualify the path",
882        code = "{ty_path}::{name}",
883        applicability = "machine-applicable"
884    )]
885    pub(crate) suggestion: Option<Span>,
886    pub(crate) ty_path: String,
887    pub(crate) name: Ident,
888}
889
890#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsIfLet where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsIfLet { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `if let` {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the `if let` is useless")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider replacing the `if let` with a `let`")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
891#[diag(
892    "irrefutable `if let` {$count ->
893    [one] pattern
894    *[other] patterns
895}"
896)]
897#[note(
898    "{$count ->
899    [one] this pattern
900    *[other] these patterns
901} will always match, so the `if let` is useless"
902)]
903#[help("consider replacing the `if let` with a `let`")]
904pub(crate) struct IrrefutableLetPatternsIfLet {
905    pub(crate) count: usize,
906}
907
908#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsIfLetGuard where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsIfLetGuard { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `if let` guard {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the guard is useless")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the guard and adding a `let` inside the match arm")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
909#[diag(
910    "irrefutable `if let` guard {$count ->
911    [one] pattern
912    *[other] patterns
913}"
914)]
915#[note(
916    "{$count ->
917    [one] this pattern
918    *[other] these patterns
919} will always match, so the guard is useless"
920)]
921#[help("consider removing the guard and adding a `let` inside the match arm")]
922pub(crate) struct IrrefutableLetPatternsIfLetGuard {
923    pub(crate) count: usize,
924}
925
926#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsLetElse where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsLetElse { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                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
                    }
                }
            }
        }
    };Diagnostic)]
927#[diag(
928    "irrefutable `let...else` {$count ->
929    [one] pattern
930    *[other] patterns
931}"
932)]
933#[note(
934    "{$count ->
935    [one] this pattern
936    *[other] these patterns
937} will always match, so the `else` clause is useless"
938)]
939#[help("consider removing the `else` clause")]
940pub(crate) struct IrrefutableLetPatternsLetElse {
941    pub(crate) count: usize,
942}
943
944#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IrrefutableLetPatternsWhileLet where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IrrefutableLetPatternsWhileLet { count: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("irrefutable `while let` {$count ->\n    [one] pattern\n    *[other] patterns\n}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$count ->\n    [one] this pattern\n    *[other] these patterns\n} will always match, so the loop will never exit")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")));
                        ;
                        diag.arg("count", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
945#[diag(
946    "irrefutable `while let` {$count ->
947    [one] pattern
948    *[other] patterns
949}"
950)]
951#[note(
952    "{$count ->
953    [one] this pattern
954    *[other] these patterns
955} will always match, so the loop will never exit"
956)]
957#[help("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")]
958pub(crate) struct IrrefutableLetPatternsWhileLet {
959    pub(crate) count: usize,
960}
961
962#[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)]
963#[diag("borrow of moved value")]
964pub(crate) struct BorrowOfMovedValue<'tcx> {
965    #[primary_span]
966    #[label("value moved into `{$name}` here")]
967    #[label(
968        "move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait"
969    )]
970    pub(crate) binding_span: Span,
971    #[label("value borrowed here after move")]
972    pub(crate) conflicts_ref: Vec<Span>,
973    pub(crate) name: Ident,
974    pub(crate) ty: Ty<'tcx>,
975    #[suggestion(
976        "borrow this binding in the pattern to avoid moving the value",
977        code = "ref ",
978        applicability = "machine-applicable"
979    )]
980    pub(crate) suggest_borrowing: Option<Span>,
981}
982
983#[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)]
984#[diag("cannot borrow value as mutable more than once at a time")]
985pub(crate) struct MultipleMutBorrows {
986    #[primary_span]
987    pub(crate) span: Span,
988    #[subdiagnostic]
989    pub(crate) occurrences: Vec<Conflict>,
990}
991
992#[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)]
993#[diag("cannot borrow value as mutable because it is also borrowed as immutable")]
994pub(crate) struct AlreadyBorrowed {
995    #[primary_span]
996    pub(crate) span: Span,
997    #[subdiagnostic]
998    pub(crate) occurrences: Vec<Conflict>,
999}
1000
1001#[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)]
1002#[diag("cannot borrow value as immutable because it is also borrowed as mutable")]
1003pub(crate) struct AlreadyMutBorrowed {
1004    #[primary_span]
1005    pub(crate) span: Span,
1006    #[subdiagnostic]
1007    pub(crate) occurrences: Vec<Conflict>,
1008}
1009
1010#[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)]
1011#[diag("cannot move out of value because it is borrowed")]
1012pub(crate) struct MovedWhileBorrowed {
1013    #[primary_span]
1014    pub(crate) span: Span,
1015    #[subdiagnostic]
1016    pub(crate) occurrences: Vec<Conflict>,
1017}
1018
1019#[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)]
1020pub(crate) enum Conflict {
1021    #[label("value is mutably borrowed by `{$name}` here")]
1022    Mut {
1023        #[primary_span]
1024        span: Span,
1025        name: Symbol,
1026    },
1027    #[label("value is borrowed by `{$name}` here")]
1028    Ref {
1029        #[primary_span]
1030        span: Span,
1031        name: Symbol,
1032    },
1033    #[label("value is moved into `{$name}` here")]
1034    Moved {
1035        #[primary_span]
1036        span: Span,
1037        name: Symbol,
1038    },
1039}
1040
1041#[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)]
1042#[diag("cannot use unions in constant patterns")]
1043pub(crate) struct UnionPattern {
1044    #[primary_span]
1045    #[label("can't use a `union` here")]
1046    pub(crate) span: Span,
1047}
1048
1049#[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)]
1050#[diag("constant of non-structural type `{$ty}` in a pattern")]
1051pub(crate) struct TypeNotStructural<'tcx> {
1052    #[primary_span]
1053    #[label("constant of non-structural type")]
1054    pub(crate) span: Span,
1055    #[label("`{$ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns")]
1056    pub(crate) ty_def_span: Span,
1057    pub(crate) ty: Ty<'tcx>,
1058    #[note(
1059        "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"
1060    )]
1061    pub(crate) manual_partialeq_impl_span: Option<Span>,
1062    #[note(
1063        "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
1064    )]
1065    pub(crate) manual_partialeq_impl_note: bool,
1066}
1067
1068#[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)]
1069#[diag("constant of non-structural type `{$ty}` in a pattern")]
1070#[note(
1071    "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
1072)]
1073pub(crate) struct TypeNotPartialEq<'tcx> {
1074    #[primary_span]
1075    #[label("constant of non-structural type")]
1076    pub(crate) span: Span,
1077    pub(crate) ty: Ty<'tcx>,
1078}
1079
1080#[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)]
1081#[diag("{$prefix} `{$non_sm_ty}` cannot be used in patterns")]
1082pub(crate) struct InvalidPattern<'tcx> {
1083    #[primary_span]
1084    #[label("{$prefix} can't be used in patterns")]
1085    pub(crate) span: Span,
1086    pub(crate) non_sm_ty: Ty<'tcx>,
1087    pub(crate) prefix: String,
1088}
1089
1090#[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)]
1091#[diag("cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns")]
1092pub(crate) struct UnsizedPattern<'tcx> {
1093    #[primary_span]
1094    pub(crate) span: Span,
1095    pub(crate) non_sm_ty: Ty<'tcx>,
1096}
1097
1098#[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)]
1099#[diag("cannot use NaN in patterns")]
1100#[note("NaNs compare inequal to everything, even themselves, so this pattern would never match")]
1101#[help("try using the `is_nan` method instead")]
1102pub(crate) struct NaNPattern {
1103    #[primary_span]
1104    #[label("evaluates to `NaN`, which is not allowed in patterns")]
1105    pub(crate) span: Span,
1106}
1107
1108#[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)]
1109#[diag(
1110    "function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon"
1111)]
1112#[note("see https://github.com/rust-lang/rust/issues/70861 for details")]
1113pub(crate) struct PointerPattern {
1114    #[primary_span]
1115    #[label("can't be used in patterns")]
1116    pub(crate) span: Span,
1117}
1118
1119#[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)]
1120#[diag("mismatched types")]
1121#[note("the matched value is of type `{$ty}`")]
1122pub(crate) struct NonEmptyNeverPattern<'tcx> {
1123    #[primary_span]
1124    #[label("a never pattern must be used on an uninhabited type")]
1125    pub(crate) span: Span,
1126    pub(crate) ty: Ty<'tcx>,
1127}
1128
1129#[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)]
1130#[diag("refutable pattern in {$origin}", code = E0005)]
1131pub(crate) struct PatternNotCovered<'s, 'tcx> {
1132    #[primary_span]
1133    pub(crate) span: Span,
1134    pub(crate) origin: &'s str,
1135    #[subdiagnostic]
1136    pub(crate) uncovered: Uncovered,
1137    #[subdiagnostic]
1138    pub(crate) inform: Option<Inform>,
1139    #[subdiagnostic]
1140    pub(crate) interpreted_as_const: Option<InterpretedAsConst>,
1141    #[subdiagnostic]
1142    pub(crate) interpreted_as_const_sugg: Option<InterpretedAsConstSugg>,
1143    #[subdiagnostic]
1144    pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
1145    #[note(
1146        "pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future"
1147    )]
1148    pub(crate) witness_1_is_privately_uninhabited: bool,
1149    pub(crate) witness_1: String,
1150    #[note("the matched value is of type `{$pattern_ty}`")]
1151    pub(crate) _p: (),
1152    pub(crate) pattern_ty: Ty<'tcx>,
1153    #[subdiagnostic]
1154    pub(crate) let_suggestion: Option<SuggestLet>,
1155    #[subdiagnostic]
1156    pub(crate) misc_suggestion: Option<MiscPatternSuggestion>,
1157}
1158
1159#[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)]
1160#[note(
1161    "`let` bindings require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant"
1162)]
1163#[note("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")]
1164pub(crate) struct Inform;
1165
1166#[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)]
1167#[label(
1168    "missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable"
1169)]
1170pub(crate) struct InterpretedAsConst {
1171    #[primary_span]
1172    pub(crate) span: Span,
1173    pub(crate) variable: String,
1174}
1175
1176pub(crate) struct AdtDefinedHere<'tcx> {
1177    pub(crate) adt_def_span: Span,
1178    pub(crate) ty: Ty<'tcx>,
1179    pub(crate) variants: Vec<Variant>,
1180}
1181
1182pub(crate) struct Variant {
1183    pub(crate) span: Span,
1184}
1185
1186impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> {
1187    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1188        diag.arg("ty", self.ty);
1189        let mut spans = MultiSpan::from(self.adt_def_span);
1190
1191        for Variant { span } in self.variants {
1192            spans.push_span_label(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not covered"))msg!("not covered"));
1193        }
1194
1195        diag.span_note(spans, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty}` defined here"))msg!("`{$ty}` defined here"));
1196    }
1197}
1198
1199#[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)]
1200#[suggestion(
1201    "introduce a variable instead",
1202    code = "{variable}_var",
1203    applicability = "maybe-incorrect",
1204    style = "verbose"
1205)]
1206pub(crate) struct InterpretedAsConstSugg {
1207    #[primary_span]
1208    pub(crate) span: Span,
1209    pub(crate) variable: String,
1210}
1211
1212#[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)]
1213pub(crate) enum SuggestLet {
1214    #[multipart_suggestion(
1215        "you might want to use `if let` to ignore the {$count ->
1216            [one] variant that isn't
1217            *[other] variants that aren't
1218        } matched",
1219        applicability = "has-placeholders"
1220    )]
1221    If {
1222        #[suggestion_part(code = "if ")]
1223        start_span: Span,
1224        #[suggestion_part(code = " {{ todo!() }}")]
1225        semi_span: Span,
1226        count: usize,
1227    },
1228    #[suggestion(
1229        "you might want to use `let...else` to handle the {$count ->
1230            [one] variant that isn't
1231            *[other] variants that aren't
1232        } matched",
1233        code = " else {{ todo!() }}",
1234        applicability = "has-placeholders"
1235    )]
1236    Else {
1237        #[primary_span]
1238        end_span: Span,
1239        count: usize,
1240    },
1241}
1242
1243#[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)]
1244pub(crate) enum MiscPatternSuggestion {
1245    #[suggestion(
1246        "alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits",
1247        code = "_",
1248        applicability = "maybe-incorrect"
1249    )]
1250    AttemptedIntegerLiteral {
1251        #[primary_span]
1252        start_span: Span,
1253    },
1254}
1255
1256#[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)]
1257#[diag("invalid update of the `#[loop_match]` state")]
1258pub(crate) struct LoopMatchInvalidUpdate {
1259    #[primary_span]
1260    pub lhs: Span,
1261    #[label("the assignment must update this variable")]
1262    pub scrutinee: Span,
1263}
1264
1265#[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)]
1266#[diag("invalid match on `#[loop_match]` state")]
1267#[note("a local variable must be the scrutinee within a `#[loop_match]`")]
1268pub(crate) struct LoopMatchInvalidMatch {
1269    #[primary_span]
1270    pub span: Span,
1271}
1272
1273#[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)]
1274#[diag("this `#[loop_match]` state value has type `{$ty}`, which is not supported")]
1275#[note("only integers, floats, bool, char, and enums without fields are supported")]
1276pub(crate) struct LoopMatchUnsupportedType<'tcx> {
1277    #[primary_span]
1278    pub span: Span,
1279    pub ty: Ty<'tcx>,
1280}
1281
1282#[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)]
1283#[diag("statements are not allowed in this position within a `#[loop_match]`")]
1284pub(crate) struct LoopMatchBadStatements {
1285    #[primary_span]
1286    pub span: Span,
1287}
1288
1289#[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)]
1290#[diag("this expression must be a single `match` wrapped in a labeled block")]
1291pub(crate) struct LoopMatchBadRhs {
1292    #[primary_span]
1293    pub span: Span,
1294}
1295
1296#[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)]
1297#[diag("expected a single assignment expression")]
1298pub(crate) struct LoopMatchMissingAssignment {
1299    #[primary_span]
1300    pub span: Span,
1301}
1302
1303#[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)]
1304#[diag("match arms that are part of a `#[loop_match]` cannot have guards")]
1305pub(crate) struct LoopMatchArmWithGuard {
1306    #[primary_span]
1307    pub span: Span,
1308}
1309
1310#[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)]
1311#[diag("could not determine the target branch for this `#[const_continue]`")]
1312#[help("try extracting the expression into a `const` item")]
1313pub(crate) struct ConstContinueNotMonomorphicConst {
1314    #[primary_span]
1315    pub span: Span,
1316
1317    #[subdiagnostic]
1318    pub reason: ConstContinueNotMonomorphicConstReason,
1319}
1320
1321#[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)]
1322pub(crate) enum ConstContinueNotMonomorphicConstReason {
1323    #[label("constant parameters may use generics, and are not evaluated early enough")]
1324    ConstantParameter {
1325        #[primary_span]
1326        span: Span,
1327    },
1328
1329    #[label("`const` blocks may use generics, and are not evaluated early enough")]
1330    ConstBlock {
1331        #[primary_span]
1332        span: Span,
1333    },
1334
1335    #[label("this value must be a literal or a monomorphic const")]
1336    Other {
1337        #[primary_span]
1338        span: Span,
1339    },
1340}
1341
1342#[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)]
1343#[diag("could not determine the target branch for this `#[const_continue]`")]
1344pub(crate) struct ConstContinueBadConst {
1345    #[primary_span]
1346    #[label("this value is too generic")]
1347    pub span: Span,
1348}
1349
1350#[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)]
1351#[diag("a `#[const_continue]` must break to a label with a value")]
1352pub(crate) struct ConstContinueMissingLabelOrValue {
1353    #[primary_span]
1354    pub span: Span,
1355}
1356
1357#[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)]
1358#[diag("the target of this `#[const_continue]` is not statically known")]
1359pub(crate) struct ConstContinueUnknownJumpTarget {
1360    #[primary_span]
1361    pub span: Span,
1362}