fn highlight_named_span(
        &self,
        tcx: TyCtxt<'_, '_, 'tcx>,
        error_region: &RegionKind,
        name: &InternedString,
        diag: &mut DiagnosticBuilder<'_>,
    ) {
        let cm = tcx.sess.source_map();

        let scope = error_region.free_region_binding_scope(tcx);
        let node = tcx.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);

        let mut sp = cm.def_span(tcx.hir.span(node));
        if let Some(param) = tcx.hir.get_generics(scope).and_then(|generics| {
            generics.get_named(name)
        }) {
            sp = param.span;
        }

        diag.span_label(
            sp,
            format!("lifetime `{}` defined here", name),
        );
    }
/// Highlight a named span to provide context for error messages that
/// mention that span, for example:
///
/// ```
///  |
///  | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
///  |                --  -- lifetime `'b` defined here
///  |                |
///  |                lifetime `'a` defined here
///  |
///  |     with_signature(cell, t, |cell, t| require(cell, t));
///  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must
///  |                                                         outlive `'a`
/// ```
Highlight a named span to provide context for error messages that
mention that span, for example.


Highlight a named span to provide context for error messages that mention that span for example .
fn highlight_named_span(
        &self,
        tcx: TyCtxt<'_, '_, 'tcx>,
        error_region: &RegionKind,
        name: &InternedString,
        diag: &mut DiagnosticBuilder<'_>,
    ) {
        let cm = tcx.sess.source_map();
        let scope = error_region.free_region_binding_scope(tcx);
        let node = tcx.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
        let mut sp = cm.def_span(tcx.hir.span(node));
        if let Some(param) = tcx.hir.get_generics(scope).and_then(|generics| {
            generics.get_named(name)
        }) {
            sp = param.span;
        }
        diag.span_label(
            sp,
            format!("lifetime `{}` defined here", name),
        );
    }
fn highlight_named_span ( & self , tcx : TyCtxt < ' _ , ' _ , ' tcx > , error_region : & RegionKind , name : & InternedString , diag : & mut DiagnosticBuilder < ' _ > , ) { let cm = tcx . sess . source_map ( ) ; let scope = error_region . free_region_binding_scope ( tcx ) ; let node = tcx . hir . as_local_node_id ( scope ) . unwrap_or ( DUMMY_NODE_ID ) ; let mut sp = cm . def_span ( tcx . hir . span ( node ) ) ; if let Some ( param ) = tcx . hir . get_generics ( scope ) . and_then ( | generics | { generics . get_named ( name ) } ) { sp = param . span ; } diag . span_label ( sp , format ! ( " " name ) , ) ; }
Highlight a named span to provide context for error messages that
mention that span, for example:
Highlight a named span to provide context for error messages that mention that span for example :
&self
tcx
TyCtxt<'_, '_, 'tcx>
error_region
&RegionKind
name
&InternedString
diag
&mut DiagnosticBuilder<'_>
&self
tcx
TyCtxt<'_, '_, 'tcx>
error_region
&RegionKind
name
&InternedString
diag
&mut DiagnosticBuilder<'_>