@@ -153,6 +153,7 @@ trait ResolverAstLoweringExt {
153
153
fn get_label_res ( & self , id : NodeId ) -> Option < NodeId > ;
154
154
fn get_lifetime_res ( & self , id : NodeId ) -> Option < LifetimeRes > ;
155
155
fn take_extra_lifetime_params ( & mut self , id : NodeId ) -> Vec < ( Ident , NodeId , LifetimeRes ) > ;
156
+ fn remap_extra_lifetime_params ( & mut self , from : NodeId , to : NodeId ) ;
156
157
fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind ;
157
158
}
158
159
@@ -213,6 +214,11 @@ impl ResolverAstLoweringExt for ResolverAstLowering {
213
214
self . extra_lifetime_params_map . remove ( & id) . unwrap_or_default ( )
214
215
}
215
216
217
+ fn remap_extra_lifetime_params ( & mut self , from : NodeId , to : NodeId ) {
218
+ let lifetimes = self . extra_lifetime_params_map . remove ( & from) . unwrap_or_default ( ) ;
219
+ self . extra_lifetime_params_map . insert ( to, lifetimes) ;
220
+ }
221
+
216
222
fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind {
217
223
self . builtin_macro_kinds . get ( & def_id) . copied ( ) . unwrap_or ( MacroKind :: Bang )
218
224
}
@@ -1089,6 +1095,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1089
1095
// constructing the HIR for `impl bounds...` and then lowering that.
1090
1096
1091
1097
let impl_trait_node_id = self . next_node_id ( ) ;
1098
+ // Shift `impl Trait` lifetime captures from the associated type bound's
1099
+ // node id to the opaque node id, so that the opaque can actually use
1100
+ // these lifetime bounds.
1101
+ self . resolver
1102
+ . remap_extra_lifetime_params ( constraint. id , impl_trait_node_id) ;
1092
1103
1093
1104
self . with_dyn_type_scope ( false , |this| {
1094
1105
let node_id = this. next_node_id ( ) ;
0 commit comments