fn report_general_error(
        &self,
        errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
        errci: &ErrorConstraintInfo,
        renctx: &mut RegionErrorNamingCtx,
    ) -> DiagnosticBuilder<'_> {
        let ErrorReportingCtx {
            infcx, mir_def_id, ..
        } = errctx;
        let ErrorConstraintInfo {
            fr, fr_is_local, outlived_fr, outlived_fr_is_local, span, category, ..
        } = errci;

        let mut diag = infcx.tcx.sess.struct_span_err(
            *span,
            "lifetime may not live long enough"
        );

        let mir_def_name = if infcx.tcx.is_closure(*mir_def_id) {
            "closure"
        } else {
            "function"
        };

        let fr_name = self.give_region_a_name(errctx, renctx, *fr).unwrap();
        fr_name.highlight_region_name(&mut diag);
        let outlived_fr_name = self.give_region_a_name(errctx, renctx, *outlived_fr).unwrap();
        outlived_fr_name.highlight_region_name(&mut diag);

        match (category, outlived_fr_is_local, fr_is_local) {
            (ConstraintCategory::Return, true, _) => {
                diag.span_label(
                    *span,
                    format!(
                        "{} was supposed to return data with lifetime `{}` but it is returning \
                         data with lifetime `{}`",
                        mir_def_name, outlived_fr_name, fr_name
                    ),
                );
            }
            _ => {
                diag.span_label(
                    *span,
                    format!(
                        "{}requires that `{}` must outlive `{}`",
                        category.description(),
                        fr_name,
                        outlived_fr_name,
                    ),
                );
            }
        }

        self.add_static_impl_trait_suggestion(infcx, &mut diag, *fr, fr_name, *outlived_fr);

        diag
    }
/// Reports a region inference error for the general case with named/synthesized lifetimes to
/// explain what is happening.
///
/// ```text
/// error: unsatisfied lifetime constraints
///   --> $DIR/regions-creating-enums3.rs:17:5
///    |
/// LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
///    |                -- -- lifetime `'b` defined here
///    |                |
///    |                lifetime `'a` defined here
/// LL |     ast::add(x, y)
///    |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it
///    |                    is returning data with lifetime `'b`
/// ```
Reports a region inference error for the general case with named/synthesized lifetimes to
explain what is happening.


Reports a region inference error for the general case with named / synthesized lifetimes to explain what is happening .
fn report_general_error(
        &self,
        errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
        errci: &ErrorConstraintInfo,
        renctx: &mut RegionErrorNamingCtx,
    ) -> DiagnosticBuilder<'_> {
        let ErrorReportingCtx {
            infcx, mir_def_id, ..
        } = errctx;
        let ErrorConstraintInfo {
            fr, fr_is_local, outlived_fr, outlived_fr_is_local, span, category, ..
        } = errci;
        let mut diag = infcx.tcx.sess.struct_span_err(
            *span,
            "lifetime may not live long enough"
        );
        let mir_def_name = if infcx.tcx.is_closure(*mir_def_id) {
            "closure"
        } else {
            "function"
        };
        let fr_name = self.give_region_a_name(errctx, renctx, *fr).unwrap();
        fr_name.highlight_region_name(&mut diag);
        let outlived_fr_name = self.give_region_a_name(errctx, renctx, *outlived_fr).unwrap();
        outlived_fr_name.highlight_region_name(&mut diag);
        match (category, outlived_fr_is_local, fr_is_local) {
            (ConstraintCategory::Return, true, _) => {
                diag.span_label(
                    *span,
                    format!(
                        "{} was supposed to return data with lifetime `{}` but it is returning \
                         data with lifetime `{}`",
                        mir_def_name, outlived_fr_name, fr_name
                    ),
                );
            }
            _ => {
                diag.span_label(
                    *span,
                    format!(
                        "{}requires that `{}` must outlive `{}`",
                        category.description(),
                        fr_name,
                        outlived_fr_name,
                    ),
                );
            }
        }
        self.add_static_impl_trait_suggestion(infcx, &mut diag, *fr, fr_name, *outlived_fr);
        diag
    }
fn report_general_error ( & self , errctx : & ErrorReportingCtx < ' _ , ' _ , ' tcx > , errci : & ErrorConstraintInfo , renctx : & mut RegionErrorNamingCtx , ) -> DiagnosticBuilder < ' _ > { let ErrorReportingCtx { infcx , mir_def_id , .. } = errctx ; let ErrorConstraintInfo { fr , fr_is_local , outlived_fr , outlived_fr_is_local , span , category , .. } = errci ; let mut diag = infcx . tcx . sess . struct_span_err ( * span , " " ) ; let mir_def_name = if infcx . tcx . is_closure ( * mir_def_id ) { " " } else { " " } ; let fr_name = self . give_region_a_name ( errctx , renctx , * fr ) . unwrap ( ) ; fr_name . highlight_region_name ( & mut diag ) ; let outlived_fr_name = self . give_region_a_name ( errctx , renctx , * outlived_fr ) . unwrap ( ) ; outlived_fr_name . highlight_region_name ( & mut diag ) ; match ( category , outlived_fr_is_local , fr_is_local ) { ( ConstraintCategory :: Return , true , _ ) => { diag . span_label ( * span , format ! ( " \
 " mir_def_name outlived_fr_name fr_name ) , ) ; } _ => { diag . span_label ( * span , format ! ( " " category description ( ) fr_name outlived_fr_name ) , ) ; } } self . add_static_impl_trait_suggestion ( infcx , & mut diag , * fr , fr_name , * outlived_fr ) ; diag }
Reports a region inference error for the general case with named/synthesized lifetimes to
explain what is happening.
Reports a region inference error for the general case with named / synthesized lifetimes to explain what is happening .
&self
errctx
&ErrorReportingCtx<'_, '_, 'tcx>
errci
&ErrorConstraintInfo
renctx
&mut RegionErrorNamingCtx