Skip to main content

rustc_borrowck/
session_diagnostics.rs

1use rustc_errors::codes::*;
2use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan};
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_middle::ty::{GenericArg, Ty};
5use rustc_span::Span;
6
7use crate::diagnostics::RegionName;
8
9#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            MoveUnsized<'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 {
                    MoveUnsized { ty: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot move a value of type `{$ty}`")));
                        diag.code(E0161);
                        ;
                        diag.arg("ty", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the size of `{$ty}` cannot be statically determined")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
10#[diag("cannot move a value of type `{$ty}`", code = E0161)]
11pub(crate) struct MoveUnsized<'tcx> {
12    pub ty: Ty<'tcx>,
13    #[primary_span]
14    #[label("the size of `{$ty}` cannot be statically determined")]
15    pub span: Span,
16}
17
18#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            HigherRankedLifetimeError where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    HigherRankedLifetimeError {
                        cause: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("higher-ranked lifetime error")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag.span(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
19#[diag("higher-ranked lifetime error")]
20pub(crate) struct HigherRankedLifetimeError {
21    #[subdiagnostic]
22    pub cause: Option<HigherRankedErrorCause>,
23    #[primary_span]
24    pub span: Span,
25}
26
27#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for HigherRankedErrorCause {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    HigherRankedErrorCause::CouldNotProve {
                        predicate: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("predicate".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not prove `{$predicate}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                    HigherRankedErrorCause::CouldNotNormalize {
                        value: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("value".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not normalize `{$value}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
28pub(crate) enum HigherRankedErrorCause {
29    #[note("could not prove `{$predicate}`")]
30    CouldNotProve { predicate: String },
31    #[note("could not normalize `{$value}`")]
32    CouldNotNormalize { value: String },
33}
34
35#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            HigherRankedSubtypeError where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    HigherRankedSubtypeError { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("higher-ranked subtype error")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
36#[diag("higher-ranked subtype error")]
37pub(crate) struct HigherRankedSubtypeError {
38    #[primary_span]
39    pub span: Span,
40}
41
42#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GenericDoesNotLiveLongEnough where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    GenericDoesNotLiveLongEnough {
                        kind: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$kind}` does not live long enough")));
                        ;
                        diag.arg("kind", __binding_0);
                        diag.span(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
43#[diag("`{$kind}` does not live long enough")]
44pub(crate) struct GenericDoesNotLiveLongEnough {
45    pub kind: String,
46    #[primary_span]
47    pub span: Span,
48}
49
50#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for VarNeedNotMut
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    VarNeedNotMut { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable does not need to be mutable")));
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this `mut`")),
                            __code_0, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
51#[diag("variable does not need to be mutable")]
52pub(crate) struct VarNeedNotMut {
53    #[suggestion(
54        "remove this `mut`",
55        style = "short",
56        applicability = "machine-applicable",
57        code = ""
58    )]
59    pub span: Span,
60}
61#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FnMutError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FnMutError { span: __binding_0, ty_err: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("captured variable cannot escape `FnMut` closure body")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`FnMut` closures only have access to their captured variables while they are executing...")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("...therefore, they cannot allow references to captured variables to escape")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
62#[diag("captured variable cannot escape `FnMut` closure body")]
63#[note("`FnMut` closures only have access to their captured variables while they are executing...")]
64#[note("...therefore, they cannot allow references to captured variables to escape")]
65pub(crate) struct FnMutError {
66    #[primary_span]
67    pub span: Span,
68    #[subdiagnostic]
69    pub ty_err: FnMutReturnTypeErr,
70}
71
72#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VarHereDenote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    VarHereDenote::Captured { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable captured here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    VarHereDenote::Defined { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable defined here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    VarHereDenote::FnMutInferred { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("inferred to be a `FnMut` closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
73pub(crate) enum VarHereDenote {
74    #[label("variable captured here")]
75    Captured {
76        #[primary_span]
77        span: Span,
78    },
79    #[label("variable defined here")]
80    Defined {
81        #[primary_span]
82        span: Span,
83    },
84    #[label("inferred to be a `FnMut` closure")]
85    FnMutInferred {
86        #[primary_span]
87        span: Span,
88    },
89}
90
91#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FnMutReturnTypeErr {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FnMutReturnTypeErr::ReturnClosure { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returns a closure that contains a reference to a captured variable, which then escapes the closure body")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    FnMutReturnTypeErr::ReturnAsyncBlock { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returns an `async` block that contains a reference to a captured variable, which then escapes the closure body")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    FnMutReturnTypeErr::ReturnRef { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("returns a reference to a captured variable which escapes the closure body")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
92pub(crate) enum FnMutReturnTypeErr {
93    #[label(
94        "returns a closure that contains a reference to a captured variable, which then escapes the closure body"
95    )]
96    ReturnClosure {
97        #[primary_span]
98        span: Span,
99    },
100    #[label(
101        "returns an `async` block that contains a reference to a captured variable, which then escapes the closure body"
102    )]
103    ReturnAsyncBlock {
104        #[primary_span]
105        span: Span,
106    },
107    #[label("returns a reference to a captured variable which escapes the closure body")]
108    ReturnRef {
109        #[primary_span]
110        span: Span,
111    },
112}
113
114#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LifetimeOutliveErr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LifetimeOutliveErr { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime may not live long enough")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
115#[diag("lifetime may not live long enough")]
116pub(crate) struct LifetimeOutliveErr {
117    #[primary_span]
118    pub span: Span,
119}
120
121#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for LifetimeReturnCategoryErr<'a>
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    LifetimeReturnCategoryErr::WrongReturn {
                        span: __binding_0,
                        mir_def_name: __binding_1,
                        outlived_fr_name: __binding_2,
                        fr_name: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("mir_def_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("outlived_fr_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("fr_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}`")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    LifetimeReturnCategoryErr::ShortReturn {
                        span: __binding_0,
                        category_desc: __binding_1,
                        free_region_name: __binding_2,
                        outlived_fr_name: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("category_desc".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("free_region_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("outlived_fr_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$category_desc}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}`")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
122pub(crate) enum LifetimeReturnCategoryErr<'a> {
123    #[label(
124        "{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}`"
125    )]
126    WrongReturn {
127        #[primary_span]
128        span: Span,
129        mir_def_name: &'a str,
130        outlived_fr_name: RegionName,
131        fr_name: &'a RegionName,
132    },
133    #[label(
134        "{$category_desc}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}`"
135    )]
136    ShortReturn {
137        #[primary_span]
138        span: Span,
139        category_desc: &'static str,
140        free_region_name: &'a RegionName,
141        outlived_fr_name: RegionName,
142    },
143}
144
145#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RequireStaticErr {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RequireStaticErr::UsedImpl { multi_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the used `impl` has a `'static` requirement")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
146pub(crate) enum RequireStaticErr {
147    #[note("the used `impl` has a `'static` requirement")]
148    UsedImpl {
149        #[primary_span]
150        multi_span: MultiSpan,
151    },
152}
153
154#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CaptureVarPathUseCause {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureVarPathUseCause::BorrowInCoroutine {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::UseInCoroutine {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::AssignInCoroutine {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("assign occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::AssignPartInCoroutine {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("assign to part occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::BorrowInClosure {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::UseInClosure {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::AssignInClosure {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("assignment occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarPathUseCause::AssignPartInClosure {
                        path_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("assignment to part occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
155pub(crate) enum CaptureVarPathUseCause {
156    #[label("borrow occurs due to use in coroutine")]
157    BorrowInCoroutine {
158        #[primary_span]
159        path_span: Span,
160    },
161    #[label("use occurs due to use in coroutine")]
162    UseInCoroutine {
163        #[primary_span]
164        path_span: Span,
165    },
166    #[label("assign occurs due to use in coroutine")]
167    AssignInCoroutine {
168        #[primary_span]
169        path_span: Span,
170    },
171    #[label("assign to part occurs due to use in coroutine")]
172    AssignPartInCoroutine {
173        #[primary_span]
174        path_span: Span,
175    },
176    #[label("borrow occurs due to use in closure")]
177    BorrowInClosure {
178        #[primary_span]
179        path_span: Span,
180    },
181    #[label("use occurs due to use in closure")]
182    UseInClosure {
183        #[primary_span]
184        path_span: Span,
185    },
186    #[label("assignment occurs due to use in closure")]
187    AssignInClosure {
188        #[primary_span]
189        path_span: Span,
190    },
191    #[label("assignment to part occurs due to use in closure")]
192    AssignPartInClosure {
193        #[primary_span]
194        path_span: Span,
195    },
196}
197
198#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CaptureVarKind {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureVarKind::Immut { kind_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("capture is immutable because of use here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarKind::Mut { kind_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("capture is mutable because of use here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarKind::Move { kind_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("capture is moved because of use here")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
199pub(crate) enum CaptureVarKind {
200    #[label("capture is immutable because of use here")]
201    Immut {
202        #[primary_span]
203        kind_span: Span,
204    },
205    #[label("capture is mutable because of use here")]
206    Mut {
207        #[primary_span]
208        kind_span: Span,
209    },
210    #[label("capture is moved because of use here")]
211    Move {
212        #[primary_span]
213        kind_span: Span,
214    },
215}
216
217#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CaptureVarCause {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureVarCause::BorrowUsePlaceCoroutine {
                        is_single_var: __binding_0,
                        place: __binding_1,
                        var_span: __binding_2 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_single_var".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_single_var ->\n            *[true] borrow occurs\n            [false] borrows occur\n        } due to use of {$place} in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_2, __message);
                    }
                    CaptureVarCause::BorrowUsePlaceClosure {
                        is_single_var: __binding_0,
                        place: __binding_1,
                        var_span: __binding_2 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_single_var".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_single_var ->\n            *[true] borrow occurs\n            [false] borrows occur\n        } due to use of {$place} in closure")),
                                &sub_args);
                        diag.span_label(__binding_2, __message);
                    }
                    CaptureVarCause::BorrowUseInCoroutine {
                        var_span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarCause::BorrowUseInClosure { var_span: __binding_0
                        } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarCause::MoveUseInCoroutine { var_span: __binding_0
                        } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move occurs due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarCause::MoveUseInClosure { var_span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move occurs due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarCause::FirstBorrowUsePlaceCoroutine {
                        place: __binding_0, var_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first borrow occurs due to use of {$place} in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureVarCause::FirstBorrowUsePlaceClosure {
                        place: __binding_0, var_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first borrow occurs due to use of {$place} in closure")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureVarCause::SecondBorrowUsePlaceCoroutine {
                        place: __binding_0, var_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second borrow occurs due to use of {$place} in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureVarCause::SecondBorrowUsePlaceClosure {
                        place: __binding_0, var_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second borrow occurs due to use of {$place} in closure")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureVarCause::MutableBorrowUsePlaceClosure {
                        place: __binding_0, var_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mutable borrow occurs due to use of {$place} in closure")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureVarCause::PartialMoveUseInCoroutine {
                        var_span: __binding_0, is_partial: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to use in coroutine")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureVarCause::PartialMoveUseInClosure {
                        var_span: __binding_0, is_partial: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to use in closure")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
218pub(crate) enum CaptureVarCause {
219    #[label(
220        "{$is_single_var ->
221            *[true] borrow occurs
222            [false] borrows occur
223        } due to use of {$place} in coroutine"
224    )]
225    BorrowUsePlaceCoroutine {
226        is_single_var: bool,
227        place: String,
228        #[primary_span]
229        var_span: Span,
230    },
231    #[label(
232        "{$is_single_var ->
233            *[true] borrow occurs
234            [false] borrows occur
235        } due to use of {$place} in closure"
236    )]
237    BorrowUsePlaceClosure {
238        is_single_var: bool,
239        place: String,
240        #[primary_span]
241        var_span: Span,
242    },
243    #[label("borrow occurs due to use in coroutine")]
244    BorrowUseInCoroutine {
245        #[primary_span]
246        var_span: Span,
247    },
248    #[label("borrow occurs due to use in closure")]
249    BorrowUseInClosure {
250        #[primary_span]
251        var_span: Span,
252    },
253    #[label("move occurs due to use in coroutine")]
254    MoveUseInCoroutine {
255        #[primary_span]
256        var_span: Span,
257    },
258    #[label("move occurs due to use in closure")]
259    MoveUseInClosure {
260        #[primary_span]
261        var_span: Span,
262    },
263    #[label("first borrow occurs due to use of {$place} in coroutine")]
264    FirstBorrowUsePlaceCoroutine {
265        place: String,
266        #[primary_span]
267        var_span: Span,
268    },
269    #[label("first borrow occurs due to use of {$place} in closure")]
270    FirstBorrowUsePlaceClosure {
271        place: String,
272        #[primary_span]
273        var_span: Span,
274    },
275    #[label("second borrow occurs due to use of {$place} in coroutine")]
276    SecondBorrowUsePlaceCoroutine {
277        place: String,
278        #[primary_span]
279        var_span: Span,
280    },
281    #[label("second borrow occurs due to use of {$place} in closure")]
282    SecondBorrowUsePlaceClosure {
283        place: String,
284        #[primary_span]
285        var_span: Span,
286    },
287    #[label("mutable borrow occurs due to use of {$place} in closure")]
288    MutableBorrowUsePlaceClosure {
289        place: String,
290        #[primary_span]
291        var_span: Span,
292    },
293    #[label(
294        "variable {$is_partial ->
295            [true] partially moved
296            *[false] moved
297        } due to use in coroutine"
298    )]
299    PartialMoveUseInCoroutine {
300        #[primary_span]
301        var_span: Span,
302        is_partial: bool,
303    },
304    #[label(
305        "variable {$is_partial ->
306            [true] partially moved
307            *[false] moved
308        } due to use in closure"
309    )]
310    PartialMoveUseInClosure {
311        #[primary_span]
312        var_span: Span,
313        is_partial: bool,
314    },
315}
316
317#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MoveBorrow<'a> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MoveBorrow {
                        place: __binding_0,
                        borrow_place: __binding_1,
                        value_place: __binding_2,
                        span: __binding_3,
                        borrow_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot move out of {$place ->\n    [value] value\n    *[other] {$place}\n} because it is borrowed")));
                        diag.code(E0505);
                        ;
                        diag.arg("place", __binding_0);
                        diag.arg("borrow_place", __binding_1);
                        diag.arg("value_place", __binding_2);
                        diag.span(__binding_3);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move out of {$value_place ->\n            [value] value\n            *[other] {$value_place}\n        } occurs here")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("borrow of {$borrow_place ->\n            [value] value\n            *[other] {$borrow_place}\n        } occurs here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
318#[diag("cannot move out of {$place ->
319    [value] value
320    *[other] {$place}
321} because it is borrowed", code = E0505)]
322pub(crate) struct MoveBorrow<'a> {
323    pub place: &'a str,
324    pub borrow_place: &'a str,
325    pub value_place: &'a str,
326    #[primary_span]
327    #[label(
328        "move out of {$value_place ->
329            [value] value
330            *[other] {$value_place}
331        } occurs here"
332    )]
333    pub span: Span,
334    #[label(
335        "borrow of {$borrow_place ->
336            [value] value
337            *[other] {$borrow_place}
338        } occurs here"
339    )]
340    pub borrow_span: Span,
341}
342
343#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            LifetimeMismatchOpaqueParam<'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 {
                    LifetimeMismatchOpaqueParam {
                        arg: __binding_0,
                        prev: __binding_1,
                        span: __binding_2,
                        prev_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("opaque type used twice with different lifetimes")));
                        ;
                        diag.arg("arg", __binding_0);
                        diag.arg("prev", __binding_1);
                        diag.span(__binding_2);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime `{$arg}` used here")));
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime `{$prev}` previously used here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
344#[diag("opaque type used twice with different lifetimes")]
345pub(crate) struct LifetimeMismatchOpaqueParam<'tcx> {
346    pub arg: GenericArg<'tcx>,
347    pub prev: GenericArg<'tcx>,
348    #[primary_span]
349    #[label("lifetime `{$arg}` used here")]
350    #[note(
351        "if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types"
352    )]
353    pub span: Span,
354    #[label("lifetime `{$prev}` previously used here")]
355    pub prev_span: Span,
356}
357
358#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for CaptureReasonLabel<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureReasonLabel::Call {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to this {$is_loop_message ->\n            [true] call, in previous iteration of loop\n            *[false] call\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::OperatorUse {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to usage in {$is_loop_message ->\n            [true] operator, in previous iteration of loop\n            *[false] operator\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::QuestionMark {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to the question mark {$is_loop_message ->\n            [true] operator, in previous iteration of loop\n            *[false] operator\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::ImplicitCall {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to this implicit call to {$is_loop_message ->\n            [true] `.into_iter()`, in previous iteration of loop\n            *[false] `.into_iter()`\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::ImplicitAsyncCall {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to this implicit call to {$is_loop_message ->\n            [true] `.into_async_iter()`, in previous iteration of loop\n            *[false] `.into_async_iter()`\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::MethodCall {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to this method {$is_loop_message ->\n            [true] call, in previous iteration of loop\n            *[false] call\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::Await {
                        fn_call_span: __binding_0,
                        place_name: __binding_1,
                        is_partial: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place_name} {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } due to this {$is_loop_message ->\n            [true] await, in previous iteration of loop\n            *[false] await\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::MovedHere {
                        move_span: __binding_0,
                        is_partial: __binding_1,
                        is_move_msg: __binding_2,
                        is_loop_message: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_partial".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_move_msg".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("is_loop_message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value {$is_partial ->\n            [true] partially moved\n            *[false] moved\n        } {$is_move_msg ->\n            [true] into closure here\n            *[false] here\n        }{$is_loop_message ->\n            [true] , in previous iteration of loop\n            *[false] {\"\"}\n        }")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    CaptureReasonLabel::BorrowContent { var_span: __binding_0 }
                        => {
                        let __code_1 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".as_ref()"))
                                            })].into_iter();
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".as_mut()"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider calling `.as_ref()` to borrow the value's contents")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_1, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider calling `.as_mut()` to mutably borrow the value's contents")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
359pub(crate) enum CaptureReasonLabel<'a> {
360    #[label(
361        "{$place_name} {$is_partial ->
362            [true] partially moved
363            *[false] moved
364        } due to this {$is_loop_message ->
365            [true] call, in previous iteration of loop
366            *[false] call
367        }"
368    )]
369    Call {
370        #[primary_span]
371        fn_call_span: Span,
372        place_name: &'a str,
373        is_partial: bool,
374        is_loop_message: bool,
375    },
376    #[label(
377        "{$place_name} {$is_partial ->
378            [true] partially moved
379            *[false] moved
380        } due to usage in {$is_loop_message ->
381            [true] operator, in previous iteration of loop
382            *[false] operator
383        }"
384    )]
385    OperatorUse {
386        #[primary_span]
387        fn_call_span: Span,
388        place_name: &'a str,
389        is_partial: bool,
390        is_loop_message: bool,
391    },
392    #[label(
393        "{$place_name} {$is_partial ->
394            [true] partially moved
395            *[false] moved
396        } due to the question mark {$is_loop_message ->
397            [true] operator, in previous iteration of loop
398            *[false] operator
399        }"
400    )]
401    QuestionMark {
402        #[primary_span]
403        fn_call_span: Span,
404        place_name: &'a str,
405        is_partial: bool,
406        is_loop_message: bool,
407    },
408    #[label(
409        "{$place_name} {$is_partial ->
410            [true] partially moved
411            *[false] moved
412        } due to this implicit call to {$is_loop_message ->
413            [true] `.into_iter()`, in previous iteration of loop
414            *[false] `.into_iter()`
415        }"
416    )]
417    ImplicitCall {
418        #[primary_span]
419        fn_call_span: Span,
420        place_name: &'a str,
421        is_partial: bool,
422        is_loop_message: bool,
423    },
424    #[label(
425        "{$place_name} {$is_partial ->
426            [true] partially moved
427            *[false] moved
428        } due to this implicit call to {$is_loop_message ->
429            [true] `.into_async_iter()`, in previous iteration of loop
430            *[false] `.into_async_iter()`
431        }"
432    )]
433    ImplicitAsyncCall {
434        #[primary_span]
435        fn_call_span: Span,
436        place_name: &'a str,
437        is_partial: bool,
438        is_loop_message: bool,
439    },
440    #[label(
441        "{$place_name} {$is_partial ->
442            [true] partially moved
443            *[false] moved
444        } due to this method {$is_loop_message ->
445            [true] call, in previous iteration of loop
446            *[false] call
447        }"
448    )]
449    MethodCall {
450        #[primary_span]
451        fn_call_span: Span,
452        place_name: &'a str,
453        is_partial: bool,
454        is_loop_message: bool,
455    },
456    #[label(
457        "{$place_name} {$is_partial ->
458            [true] partially moved
459            *[false] moved
460        } due to this {$is_loop_message ->
461            [true] await, in previous iteration of loop
462            *[false] await
463        }"
464    )]
465    Await {
466        #[primary_span]
467        fn_call_span: Span,
468        place_name: &'a str,
469        is_partial: bool,
470        is_loop_message: bool,
471    },
472    #[label(
473        "value {$is_partial ->
474            [true] partially moved
475            *[false] moved
476        } {$is_move_msg ->
477            [true] into closure here
478            *[false] here
479        }{$is_loop_message ->
480            [true] , in previous iteration of loop
481            *[false] {\"\"}
482        }"
483    )]
484    MovedHere {
485        #[primary_span]
486        move_span: Span,
487        is_partial: bool,
488        is_move_msg: bool,
489        is_loop_message: bool,
490    },
491    #[suggestion(
492        "consider calling `.as_ref()` to borrow the value's contents",
493        applicability = "maybe-incorrect",
494        code = ".as_ref()",
495        style = "verbose"
496    )]
497    #[suggestion(
498        "consider calling `.as_mut()` to mutably borrow the value's contents",
499        applicability = "maybe-incorrect",
500        code = ".as_mut()",
501        style = "verbose"
502    )]
503    BorrowContent {
504        #[primary_span]
505        var_span: Span,
506    },
507}
508
509#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CaptureReasonNote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureReasonNote::FnOnceMoveInCall { var_span: __binding_0
                        } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this value implements `FnOnce`, which causes it to be moved when called")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    CaptureReasonNote::UnOpMoveByOperator { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calling this operator moves the value")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    CaptureReasonNote::LhsMoveByOperator { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("calling this operator moves the left-hand side")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    CaptureReasonNote::FuncTakeSelf {
                        func: __binding_0,
                        place_name: __binding_1,
                        span: __binding_2 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("func".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$func}` takes ownership of the receiver `self`, which moves {$place_name}")),
                                &sub_args);
                        diag.span_note(__binding_2, __message);
                    }
                    CaptureReasonNote::DesugaringFuncTakeSelf {
                        desugar_name: __binding_0,
                        func: __binding_1,
                        place_name: __binding_2,
                        span: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("desugar_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("func".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$desugar_name} is desugared into a call to `{$func}`, which takes ownership of the receiver `self`, which moves {$place_name}")),
                                &sub_args);
                        diag.span_note(__binding_3, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
510pub(crate) enum CaptureReasonNote {
511    #[note("this value implements `FnOnce`, which causes it to be moved when called")]
512    FnOnceMoveInCall {
513        #[primary_span]
514        var_span: Span,
515    },
516    #[note("calling this operator moves the value")]
517    UnOpMoveByOperator {
518        #[primary_span]
519        span: Span,
520    },
521    #[note("calling this operator moves the left-hand side")]
522    LhsMoveByOperator {
523        #[primary_span]
524        span: Span,
525    },
526    #[note("`{$func}` takes ownership of the receiver `self`, which moves {$place_name}")]
527    FuncTakeSelf {
528        func: String,
529        place_name: String,
530        #[primary_span]
531        span: Span,
532    },
533    #[note(
534        "the {$desugar_name} is desugared into a call to `{$func}`, which takes ownership of the \
535         receiver `self`, which moves {$place_name}"
536    )]
537    DesugaringFuncTakeSelf {
538        desugar_name: &'static str,
539        func: String,
540        place_name: String,
541        #[primary_span]
542        span: Span,
543    },
544}
545
546#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for CaptureReasonSuggest<'tcx>
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureReasonSuggest::IterateSlice {
                        ty: __binding_0, span: __binding_1 } => {
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("&"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider iterating over a slice of the `{$ty}`'s content to avoid moving into the `for` loop")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_1, __message,
                            __code_3, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    CaptureReasonSuggest::FreshReborrow { span: __binding_0 } =>
                        {
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(".as_mut()"))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider reborrowing the `Pin` instead of moving it")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_4, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
547pub(crate) enum CaptureReasonSuggest<'tcx> {
548    #[suggestion(
549        "consider iterating over a slice of the `{$ty}`'s content to avoid moving into the `for` loop",
550        applicability = "maybe-incorrect",
551        code = "&",
552        style = "verbose"
553    )]
554    IterateSlice {
555        ty: Ty<'tcx>,
556        #[primary_span]
557        span: Span,
558    },
559    #[suggestion(
560        "consider reborrowing the `Pin` instead of moving it",
561        applicability = "maybe-incorrect",
562        code = ".as_mut()",
563        style = "verbose"
564    )]
565    FreshReborrow {
566        #[primary_span]
567        span: Span,
568    },
569}
570
571#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CaptureArgLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CaptureArgLabel::Capture {
                        is_within: __binding_0, args_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_within".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value captured {$is_within ->\n            [true] here by coroutine\n            *[false] here\n        }")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                    CaptureArgLabel::MoveOutPlace {
                        place: __binding_0, args_span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$place} is moved here")),
                                &sub_args);
                        diag.span_label(__binding_1, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
572pub(crate) enum CaptureArgLabel {
573    #[label(
574        "value captured {$is_within ->
575            [true] here by coroutine
576            *[false] here
577        }"
578    )]
579    Capture {
580        is_within: bool,
581        #[primary_span]
582        args_span: Span,
583    },
584    #[label("{$place} is moved here")]
585    MoveOutPlace {
586        place: String,
587        #[primary_span]
588        args_span: Span,
589    },
590}
591
592#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OnClosureNote<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnClosureNote::InvokedTwice {
                        place_name: __binding_0, span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closure cannot be invoked more than once because it moves the variable `{$place_name}` out of its environment")),
                                &sub_args);
                        diag.span_note(__binding_1, __message);
                    }
                    OnClosureNote::MovedTwice {
                        place_name: __binding_0, span: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("place_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place_name}` out of its environment")),
                                &sub_args);
                        diag.span_note(__binding_1, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
593pub(crate) enum OnClosureNote<'a> {
594    #[note(
595        "closure cannot be invoked more than once because it moves the variable `{$place_name}` out of its environment"
596    )]
597    InvokedTwice {
598        place_name: &'a str,
599        #[primary_span]
600        span: Span,
601    },
602    #[note(
603        "closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place_name}` out of its environment"
604    )]
605    MovedTwice {
606        place_name: &'a str,
607        #[primary_span]
608        span: Span,
609    },
610}
611
612#[derive(const _: () =
    {
        impl<'a, 'tcx> rustc_errors::Subdiagnostic for TypeNoCopy<'a, 'tcx> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    TypeNoCopy::Label {
                        is_partial_move: __binding_0,
                        ty: __binding_1,
                        place: __binding_2,
                        span: __binding_3 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_partial_move".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_partial_move ->\n            [true] partial move\n            *[false] move\n        } occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait")),
                                &sub_args);
                        diag.span_label(__binding_3, __message);
                    }
                    TypeNoCopy::LabelMovedHere {
                        ty: __binding_0, place: __binding_1, span: __binding_2 } =>
                        {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("data moved here because {$place} has type `{$ty}`, which does not implement the `Copy` trait")),
                                &sub_args);
                        diag.span_label(__binding_2, __message);
                    }
                    TypeNoCopy::Note {
                        is_partial_move: __binding_0,
                        ty: __binding_1,
                        place: __binding_2 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("is_partial_move".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("ty".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("place".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_partial_move ->\n            [true] partial move\n            *[false] move\n        } occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
613pub(crate) enum TypeNoCopy<'a, 'tcx> {
614    #[label(
615        "{$is_partial_move ->
616            [true] partial move
617            *[false] move
618        } occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait"
619    )]
620    Label {
621        is_partial_move: bool,
622        ty: Ty<'tcx>,
623        place: &'a str,
624        #[primary_span]
625        span: Span,
626    },
627    #[label(
628        "data moved here because {$place} has type `{$ty}`, which does not implement the `Copy` \
629         trait"
630    )]
631    LabelMovedHere {
632        ty: Ty<'tcx>,
633        place: &'a str,
634        #[primary_span]
635        span: Span,
636    },
637    #[note(
638        "{$is_partial_move ->
639            [true] partial move
640            *[false] move
641        } occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait"
642    )]
643    Note { is_partial_move: bool, ty: Ty<'tcx>, place: &'a str },
644}
645
646#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SimdIntrinsicArgConst where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SimdIntrinsicArgConst {
                        span: __binding_0, arg: __binding_1, intrinsic: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$arg ->\n        [1] 1st\n        [2] 2nd\n        [3] 3rd\n        *[other] {$arg}th\n    } argument of `{$intrinsic}` is required to be a `const` item")));
                        ;
                        diag.arg("arg", __binding_1);
                        diag.arg("intrinsic", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
647#[diag(
648    "{$arg ->
649        [1] 1st
650        [2] 2nd
651        [3] 3rd
652        *[other] {$arg}th
653    } argument of `{$intrinsic}` is required to be a `const` item"
654)]
655pub(crate) struct SimdIntrinsicArgConst {
656    #[primary_span]
657    pub span: Span,
658    pub arg: usize,
659    pub intrinsic: String,
660}
661
662pub(crate) struct TailExprDropOrder<F: FnOnce(&mut Diag<'_, ()>)> {
663    pub borrowed: Span,
664    pub callback: F,
665}
666
667impl<'a, F: FnOnce(&mut Diag<'_, ()>)> Diagnostic<'a, ()> for TailExprDropOrder<F> {
668    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
669        let Self { borrowed, callback } = self;
670        let mut diag = Diag::new(dcx, level, "relative drop order changing in Rust 2024")
671            .with_span_label(
672                borrowed,
673                "this temporary value will be dropped at the end of the block",
674            );
675        callback(&mut diag);
676        diag
677    }
678}