@@ -22,7 +22,7 @@ pub(crate) fn collect_definitions(
2222) {
2323 let invocation_parent = resolver. invocation_parents [ & expansion] ;
2424 debug ! ( "new fragment to visit with invocation_parent: {invocation_parent:?}" ) ;
25- let mut visitor = DefCollector { resolver, expansion, invocation_parent, is_delegation : false } ;
25+ let mut visitor = DefCollector { resolver, expansion, invocation_parent } ;
2626 fragment. visit_with ( & mut visitor) ;
2727}
2828
@@ -31,7 +31,6 @@ struct DefCollector<'a, 'ra, 'tcx> {
3131 resolver : & ' a mut Resolver < ' ra , ' tcx > ,
3232 invocation_parent : InvocationParent ,
3333 expansion : LocalExpnId ,
34- is_delegation : bool ,
3534}
3635
3736pub ( super ) struct ParentContext {
@@ -59,7 +58,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
5958 node_id, def_kind, parent
6059 ) ;
6160
62- let ctx = ParentContext { parent, is_delegation : self . is_delegation } ;
61+ let ctx = ParentContext { parent, is_delegation : self . invocation_parent . is_delegation } ;
6362
6463 self . resolver
6564 . create_def (
@@ -77,11 +76,12 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
7776 let parent_ctx = parent_ctx. into ( ) ;
7877 let orig_parent_def =
7978 mem:: replace ( & mut self . invocation_parent . parent_def , parent_ctx. parent ) ;
80- let orig_is_delegation = mem:: replace ( & mut self . is_delegation , parent_ctx. is_delegation ) ;
79+ let orig_is_delegation =
80+ mem:: replace ( & mut self . invocation_parent . is_delegation , parent_ctx. is_delegation ) ;
8181
8282 f ( self ) ;
8383
84- self . is_delegation = orig_is_delegation;
84+ self . invocation_parent . is_delegation = orig_is_delegation;
8585 self . invocation_parent . parent_def = orig_parent_def;
8686 }
8787
0 commit comments