diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-07-19 22:16:32 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-08-04 11:26:51 -0300 |
| commit | 84a24a1b3c183066644be2db03c48545d796f01f (patch) | |
| tree | 479c8d1bea6bee49322d1e494fb9663a50f2efad | |
| parent | 0f11a0cd2482f6c8cf2e4eb00242214172835c36 (diff) | |
| download | rust-84a24a1b3c183066644be2db03c48545d796f01f.tar.gz rust-84a24a1b3c183066644be2db03c48545d796f01f.zip | |
Unroll while_capturing_lifetimes into lower_opaque_impl_trait
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 2749af72b68..72e0466761a 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1376,11 +1376,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let hir_bounds = if origin == hir::OpaqueTyOrigin::TyAlias { lower_bounds(lctx) } else { - lctx.while_capturing_lifetimes( - opaque_ty_def_id, - &mut collected_lifetimes, - lower_bounds, - ) + let lifetime_stash = std::mem::replace( + &mut lctx.captured_lifetimes, + Some(LifetimeCaptureContext { + parent_def_id: opaque_ty_def_id, + captures: std::mem::take(&mut collected_lifetimes), + binders_to_ignore: Default::default(), + }), + ); + + let ret = lower_bounds(lctx); + + let ctxt = std::mem::replace(&mut lctx.captured_lifetimes, lifetime_stash).unwrap(); + collected_lifetimes = ctxt.captures; + + ret }; debug!(?collected_lifetimes); |
