Unroll while_capturing_lifetimes into lower_opaque_impl_trait

This commit is contained in:
Santiago Pastorino 2022-07-19 22:16:32 -03:00
parent 0f11a0cd24
commit 84a24a1b3c
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF

View File

@ -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);