fn with_parent_item_lifetime_defs<T>(
        &mut self,
        parent_hir_id: hir::HirId,
        f: impl FnOnce(&mut LoweringContext<'_>) -> T,
    ) -> T {
        let old_len = self.in_scope_lifetimes.len();

        let parent_generics = match self.items.get(&parent_hir_id).unwrap().kind {
            hir::ItemKind::Impl(_, _, _, ref generics, ..)
            | hir::ItemKind::Trait(_, _, ref generics, ..) => {
                &generics.params[..]
            }
            _ => &[],
        };
        let lt_def_names = parent_generics.iter().filter_map(|param| match param.kind {
            hir::GenericParamKind::Lifetime { .. } => Some(param.name.modern()),
            _ => None,
        });
        self.in_scope_lifetimes.extend(lt_def_names);

        let res = f(self);

        self.in_scope_lifetimes.truncate(old_len);
        res
    }
// Same as the method above, but accepts `hir::GenericParam`s
// instead of `ast::GenericParam`s.
// This should only be used with generics that have already had their
// in-band lifetimes added. In practice, this means that this function is
// only used when lowering a child item of a trait or impl.
Same as the method above, but accepts `hir::GenericParam`s
instead of `ast::GenericParam`s.
This should only be used with generics that have already had their
in-band lifetimes added. In practice, this means that this function is
only used when lowering a child item of a trait or impl.
Same as the method above but accepts ` hir :: GenericParam ` s instead of ` ast :: GenericParam ` s . This should only be used with generics that have already had their in - band lifetimes added . In practice this means that this function is only used when lowering a child item of a trait or impl .
fn with_parent_item_lifetime_defs<T>(
        &mut self,
        parent_hir_id: hir::HirId,
        f: impl FnOnce(&mut LoweringContext<'_>) -> T,
    ) -> T {
        let old_len = self.in_scope_lifetimes.len();
        let parent_generics = match self.items.get(&parent_hir_id).unwrap().kind {
            hir::ItemKind::Impl(_, _, _, ref generics, ..)
            | hir::ItemKind::Trait(_, _, ref generics, ..) => {
                &generics.params[..]
            }
            _ => &[],
        };
        let lt_def_names = parent_generics.iter().filter_map(|param| match param.kind {
            hir::GenericParamKind::Lifetime { .. } => Some(param.name.modern()),
            _ => None,
        });
        self.in_scope_lifetimes.extend(lt_def_names);
        let res = f(self);
        self.in_scope_lifetimes.truncate(old_len);
        res
    }
fn with_parent_item_lifetime_defs < T > ( & mut self , parent_hir_id : hir :: HirId , f : impl FnOnce ( & mut LoweringContext < ' _ > ) -> T , ) -> T { let old_len = self . in_scope_lifetimes . len ( ) ; let parent_generics = match self . items . get ( & parent_hir_id ) . unwrap ( ) . kind { hir :: ItemKind :: Impl ( _ , _ , _ , ref generics , .. ) | hir :: ItemKind :: Trait ( _ , _ , ref generics , .. ) => { & generics . params [ .. ] } _ => & [ ] , } ; let lt_def_names = parent_generics . iter ( ) . filter_map ( | param | match param . kind { hir :: GenericParamKind :: Lifetime { .. } => Some ( param . name . modern ( ) ) , _ => None , } ) ; self . in_scope_lifetimes . extend ( lt_def_names ) ; let res = f ( self ) ; self . in_scope_lifetimes . truncate ( old_len ) ; res }
Same as the method above, but accepts `hir::GenericParam`s
instead of `ast::GenericParam`s.
Same as the method above but accepts ` hir :: GenericParam ` s instead of ` ast :: GenericParam ` s .
&mut self
parent_hir_id
hir::HirId
f
impl FnOnce(&mut LoweringContext<'_>) -> T
&mut self
parent_hir_id
hir::HirId
f
impl FnOnce(&mut LoweringContext<'_>) -> T