@@ -145,7 +145,9 @@ struct LoweringContext<'a, 'hir> {
145145 /// Maps the `NodeId`s created during lowering to `LocalDefId`s.
146146 node_id_to_def_id : NodeMap < LocalDefId > ,
147147 /// Overlay over resolver's `partial_res_map` used by delegation.
148- partial_res_overrides : NodeMap < PartialRes > ,
148+ /// This only contains `PartialRes::new(Res::Local(self_param_id))`,
149+ /// so we only store `self_param_id`.
150+ partial_res_overrides : NodeMap < NodeId > ,
149151
150152 allow_contracts : Arc < [ Symbol ] > ,
151153 allow_try_trait : Arc < [ Symbol ] > ,
@@ -261,6 +263,9 @@ impl<'tcx> ResolverAstLowering<'tcx> {
261263 return None ;
262264 }
263265
266+ // We do not need to look at `partial_res_overrides`. That map only contains overrides for
267+ // `self_param` locals. And here we are looking for the function definition that `expr`
268+ // resolves to.
264269 let def_id = self . partial_res_map . get ( & expr. id ) ?. full_res ( ) ?. opt_def_id ( ) ?;
265270
266271 // We only support cross-crate argument rewriting. Uses
@@ -669,10 +674,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
669674 }
670675
671676 fn get_partial_res ( & self , id : NodeId ) -> Option < PartialRes > {
672- self . partial_res_overrides
673- . get ( & id )
674- . or_else ( || self . resolver . partial_res_map . get ( & id) )
675- . copied ( )
677+ match self . partial_res_overrides . get ( & id ) {
678+ Some ( self_param_id ) => Some ( PartialRes :: new ( Res :: Local ( * self_param_id ) ) ) ,
679+ None => self . resolver . partial_res_map . get ( & id) . copied ( ) ,
680+ }
676681 }
677682
678683 /// Given the id of an owner node in the AST, returns the corresponding `OwnerId`.
0 commit comments