Unconditionally record lifetime mapping
This commit is contained in:
parent
443c3161dd
commit
8dcb8e0759
@ -1663,11 +1663,7 @@ fn lower_opaque_inner(
|
||||
);
|
||||
debug!("lower_async_fn_ret_ty: generic_params={:#?}", generic_params);
|
||||
|
||||
let lifetime_mapping = if in_trait {
|
||||
Some(&*self.arena.alloc_slice(&synthesized_lifetime_args))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let lifetime_mapping = self.arena.alloc_slice(&synthesized_lifetime_args);
|
||||
|
||||
let opaque_ty_item = hir::OpaqueTy {
|
||||
generics: this.arena.alloc(hir::Generics {
|
||||
|
@ -2675,7 +2675,7 @@ pub struct OpaqueTy<'hir> {
|
||||
///
|
||||
/// This mapping associated a captured lifetime (first parameter) with the new
|
||||
/// early-bound lifetime that was generated for the opaque.
|
||||
pub lifetime_mapping: Option<&'hir [(&'hir Lifetime, LocalDefId)]>,
|
||||
pub lifetime_mapping: &'hir [(&'hir Lifetime, LocalDefId)],
|
||||
/// Whether the opaque is a return-position impl trait (or async future)
|
||||
/// originating from a trait method. This makes it so that the opaque is
|
||||
/// lowered as an associated type.
|
||||
|
@ -59,7 +59,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
||||
let opaque_ty_id = tcx.hir().local_def_id_to_hir_id(opaque_def_id.expect_local());
|
||||
let opaque_ty_node = tcx.hir().get(opaque_ty_id);
|
||||
let Node::Item(&Item {
|
||||
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping: Some(lifetime_mapping), .. }),
|
||||
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping, .. }),
|
||||
..
|
||||
}) = opaque_ty_node
|
||||
else {
|
||||
|
@ -67,7 +67,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
|
||||
let mut mapping = FxHashMap::default();
|
||||
let generics = tcx.generics_of(def_id);
|
||||
for &(lifetime, new_early_bound_def_id) in
|
||||
lifetime_mapping.expect("expected lifetime mapping for RPITIT")
|
||||
lifetime_mapping
|
||||
{
|
||||
if let Some(rbv::ResolvedArg::LateBound(_, _, def_id)) =
|
||||
tcx.named_bound_var(lifetime.hir_id)
|
||||
|
Loading…
Reference in New Issue
Block a user