Skip to content

Commit 63866b8

Browse files
committed
Place is_delegation in InvocationParent
1 parent d7e224c commit 63866b8

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

compiler/rustc_resolve/src/def_collector.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

3736
pub(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

compiler/rustc_resolve/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ struct InvocationParent {
188188
impl_trait_context: ImplTraitContext,
189189
in_attr: bool,
190190
const_arg_context: ConstArgContext,
191+
is_delegation: bool,
191192
}
192193

193194
impl InvocationParent {
@@ -196,6 +197,7 @@ impl InvocationParent {
196197
impl_trait_context: ImplTraitContext::Existential,
197198
in_attr: false,
198199
const_arg_context: ConstArgContext::NonDirect,
200+
is_delegation: false,
199201
};
200202
}
201203

0 commit comments

Comments
 (0)