@@ -28,7 +28,7 @@ use rustc_abi::{
2828 Align , FieldIdx , Integer , IntegerType , ReprFlags , ReprOptions , ScalableElt , VariantIdx ,
2929} ;
3030use rustc_ast:: node_id:: NodeMap ;
31- use rustc_ast:: { self as ast} ;
31+ use rustc_ast:: { self as ast, NodeId } ;
3232pub use rustc_ast_ir:: { Movability , Mutability , try_visit} ;
3333use rustc_data_structures:: fx:: { FxIndexMap , FxIndexSet } ;
3434use rustc_data_structures:: intern:: Interned ;
@@ -224,6 +224,8 @@ pub struct PerOwnerResolverData<'tcx> {
224224
225225 /// Resolution for import nodes, which have multiple resolutions in different namespaces.
226226 pub import_res : hir:: def:: PerNS < Option < Res < ast:: NodeId > > > = Default :: default ( ) ,
227+ /// Lifetime parameters that lowering will have to introduce.
228+ pub extra_lifetime_params_map : NodeMap < Vec < ( Ident , ast:: NodeId , MissingLifetimeKind ) > > = Default :: default ( ) ,
227229
228230 /// The id of the owner
229231 pub id : ast:: NodeId ,
@@ -245,6 +247,17 @@ impl<'tcx> PerOwnerResolverData<'tcx> {
245247 pub fn get_lifetime_res ( & self , id : ast:: NodeId ) -> Option < LifetimeRes > {
246248 self . lifetimes_res_map . get ( & id) . copied ( )
247249 }
250+
251+ /// Obtain the list of lifetimes parameters to add to an item.
252+ ///
253+ /// Extra lifetime parameters should only be added in places that can appear
254+ /// as a `binder` in `LifetimeRes`.
255+ ///
256+ /// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring
257+ /// should appear at the enclosing `PolyTraitRef`.
258+ pub fn extra_lifetime_params ( & self , id : NodeId ) -> & [ ( Ident , NodeId , MissingLifetimeKind ) ] {
259+ self . extra_lifetime_params_map . get ( & id) . map_or ( & [ ] , |v| & v[ ..] )
260+ }
248261}
249262
250263/// Resolutions that should only be used for lowering.
@@ -253,8 +266,6 @@ impl<'tcx> PerOwnerResolverData<'tcx> {
253266pub struct ResolverAstLowering < ' tcx > {
254267 /// Resolutions for nodes that have a single resolution.
255268 pub partial_res_map : NodeMap < hir:: def:: PartialRes > ,
256- /// Lifetime parameters that lowering will have to introduce.
257- pub extra_lifetime_params_map : NodeMap < Vec < ( Ident , ast:: NodeId , MissingLifetimeKind ) > > ,
258269
259270 pub next_node_id : ast:: NodeId ,
260271
0 commit comments