Unconditionally record lifetime mapping
This commit is contained in:
parent
443c3161dd
commit
8dcb8e0759
4 changed files with 4 additions and 8 deletions
|
@ -1663,11 +1663,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
);
|
);
|
||||||
debug!("lower_async_fn_ret_ty: generic_params={:#?}", generic_params);
|
debug!("lower_async_fn_ret_ty: generic_params={:#?}", generic_params);
|
||||||
|
|
||||||
let lifetime_mapping = if in_trait {
|
let lifetime_mapping = self.arena.alloc_slice(&synthesized_lifetime_args);
|
||||||
Some(&*self.arena.alloc_slice(&synthesized_lifetime_args))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let opaque_ty_item = hir::OpaqueTy {
|
let opaque_ty_item = hir::OpaqueTy {
|
||||||
generics: this.arena.alloc(hir::Generics {
|
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
|
/// This mapping associated a captured lifetime (first parameter) with the new
|
||||||
/// early-bound lifetime that was generated for the opaque.
|
/// 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)
|
/// 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
|
/// originating from a trait method. This makes it so that the opaque is
|
||||||
/// lowered as an associated type.
|
/// 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_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 opaque_ty_node = tcx.hir().get(opaque_ty_id);
|
||||||
let Node::Item(&Item {
|
let Node::Item(&Item {
|
||||||
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping: Some(lifetime_mapping), .. }),
|
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping, .. }),
|
||||||
..
|
..
|
||||||
}) = opaque_ty_node
|
}) = opaque_ty_node
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -67,7 +67,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
|
||||||
let mut mapping = FxHashMap::default();
|
let mut mapping = FxHashMap::default();
|
||||||
let generics = tcx.generics_of(def_id);
|
let generics = tcx.generics_of(def_id);
|
||||||
for &(lifetime, new_early_bound_def_id) in
|
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)) =
|
if let Some(rbv::ResolvedArg::LateBound(_, _, def_id)) =
|
||||||
tcx.named_bound_var(lifetime.hir_id)
|
tcx.named_bound_var(lifetime.hir_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue