Skip to content

Commit 95158fd

Browse files
committed
No need to store parent_def_id in LifetimeCaptureContext
1 parent 552f6b0 commit 95158fd

File tree

1 file changed

+9
-9
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+9
-9
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ struct LoweringContext<'a, 'hir> {
136136
/// to rebind the introduced lifetimes.
137137
#[derive(Debug)]
138138
struct LifetimeCaptureContext {
139-
/// parent def_id for new definitions
140-
parent_def_id: LocalDefId,
141139
/// Set of lifetimes to rebind.
142140
captures: FxHashMap<
143141
LocalDefId, // original parameter id
@@ -1347,7 +1345,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13471345
let lifetime_stash = std::mem::replace(
13481346
&mut lctx.captured_lifetimes,
13491347
Some(LifetimeCaptureContext {
1350-
parent_def_id: opaque_ty_def_id,
13511348
captures: std::mem::take(&mut collected_lifetimes),
13521349
binders_to_ignore: Default::default(),
13531350
}),
@@ -1357,7 +1354,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13571354
lifetime_collector::lifetimes_in_bounds(&lctx.resolver, bounds);
13581355
debug!(?lifetimes_in_bounds);
13591356

1360-
lctx.create_and_capture_lifetime_defs(&lifetimes_in_bounds);
1357+
lctx.create_and_capture_lifetime_defs(opaque_ty_def_id, &lifetimes_in_bounds);
13611358

13621359
let ret = lctx.lower_param_bounds(bounds, itctx);
13631360

@@ -1446,7 +1443,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14461443
hir::OwnerNode::Item(self.arena.alloc(opaque_ty_item))
14471444
}
14481445

1449-
fn create_and_capture_lifetime_defs(&mut self, lifetimes_in_bounds: &[Lifetime]) {
1446+
fn create_and_capture_lifetime_defs(
1447+
&mut self,
1448+
parent_def_id: LocalDefId,
1449+
lifetimes_in_bounds: &[Lifetime],
1450+
) {
14501451
for lifetime in lifetimes_in_bounds {
14511452
let ident = lifetime.ident;
14521453
let span = ident.span;
@@ -1464,7 +1465,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14641465
let name = ParamName::Plain(ident);
14651466

14661467
self.create_def(
1467-
captured_lifetimes.parent_def_id,
1468+
parent_def_id,
14681469
node_id,
14691470
DefPathData::LifetimeNs(name.ident().name),
14701471
);
@@ -1485,7 +1486,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14851486
let name = ParamName::Fresh;
14861487

14871488
self.create_def(
1488-
captured_lifetimes.parent_def_id,
1489+
parent_def_id,
14891490
node_id,
14901491
DefPathData::LifetimeNs(kw::UnderscoreLifetime),
14911492
);
@@ -1735,7 +1736,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17351736
let lifetime_stash = std::mem::replace(
17361737
&mut this.captured_lifetimes,
17371738
Some(LifetimeCaptureContext {
1738-
parent_def_id: opaque_ty_def_id,
17391739
captures: std::mem::take(&mut captures),
17401740
binders_to_ignore: Default::default(),
17411741
}),
@@ -1745,7 +1745,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17451745
lifetime_collector::lifetimes_in_ret_ty(&this.resolver, output);
17461746
debug!(?lifetimes_in_bounds);
17471747

1748-
this.create_and_capture_lifetime_defs(&lifetimes_in_bounds);
1748+
this.create_and_capture_lifetime_defs(opaque_ty_def_id, &lifetimes_in_bounds);
17491749

17501750
// We have to be careful to get elision right here. The
17511751
// idea is that we create a lifetime parameter for each

0 commit comments

Comments
 (0)