fn report_general_error(&self, errci: &ErrorConstraintInfo) -> DiagnosticBuilder<'tcx> {
        let ErrorConstraintInfo {
            fr,
            fr_is_local,
            outlived_fr,
            outlived_fr_is_local,
            span,
            category,
            ..
        } = errci;

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

        let (_, mir_def_name) =
            self.infcx.tcx.article_and_description(self.mir_def_id().to_def_id());

        let fr_name = self.give_region_a_name(*fr).unwrap();
        fr_name.highlight_region_name(&mut diag);
        let outlived_fr_name = self.give_region_a_name(*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(&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, errci: &ErrorConstraintInfo) -> DiagnosticBuilder<'tcx> {
        let ErrorConstraintInfo {
            fr,
            fr_is_local,
            outlived_fr,
            outlived_fr_is_local,
            span,
            category,
            ..
        } = errci;
        let mut diag =
            self.infcx.tcx.sess.struct_span_err(*span, "lifetime may not live long enough");
        let (_, mir_def_name) =
            self.infcx.tcx.article_and_description(self.mir_def_id().to_def_id());
        let fr_name = self.give_region_a_name(*fr).unwrap();
        fr_name.highlight_region_name(&mut diag);
        let outlived_fr_name = self.give_region_a_name(*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(&mut diag, *fr, fr_name, *outlived_fr);
        diag
    }
fn report_general_error ( & self , errci : & ErrorConstraintInfo ) -> DiagnosticBuilder < ' tcx > { let ErrorConstraintInfo { fr , fr_is_local , outlived_fr , outlived_fr_is_local , span , category , .. } = errci ; let mut diag = self . infcx . tcx . sess . struct_span_err ( * span , " " ) ; let ( _ , mir_def_name ) = self . infcx . tcx . article_and_description ( self . mir_def_id ( ) . to_def_id ( ) ) ; let fr_name = self . give_region_a_name ( * fr ) . unwrap ( ) ; fr_name . highlight_region_name ( & mut diag ) ; let outlived_fr_name = self . give_region_a_name ( * 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 ( & 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
errci
&ErrorConstraintInfo
&self
errci
&ErrorConstraintInfo