Skip to content

Commit 8dcb8e0

Browse files
Unconditionally record lifetime mapping
1 parent 443c316 commit 8dcb8e0

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,11 +1663,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16631663
);
16641664
debug!("lower_async_fn_ret_ty: generic_params={:#?}", generic_params);
16651665

1666-
let lifetime_mapping = if in_trait {
1667-
Some(&*self.arena.alloc_slice(&synthesized_lifetime_args))
1668-
} else {
1669-
None
1670-
};
1666+
let lifetime_mapping = self.arena.alloc_slice(&synthesized_lifetime_args);
16711667

16721668
let opaque_ty_item = hir::OpaqueTy {
16731669
generics: this.arena.alloc(hir::Generics {

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,7 @@ pub struct OpaqueTy<'hir> {
26752675
///
26762676
/// This mapping associated a captured lifetime (first parameter) with the new
26772677
/// early-bound lifetime that was generated for the opaque.
2678-
pub lifetime_mapping: Option<&'hir [(&'hir Lifetime, LocalDefId)]>,
2678+
pub lifetime_mapping: &'hir [(&'hir Lifetime, LocalDefId)],
26792679
/// Whether the opaque is a return-position impl trait (or async future)
26802680
/// originating from a trait method. This makes it so that the opaque is
26812681
/// lowered as an associated type.

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
5959
let opaque_ty_id = tcx.hir().local_def_id_to_hir_id(opaque_def_id.expect_local());
6060
let opaque_ty_node = tcx.hir().get(opaque_ty_id);
6161
let Node::Item(&Item {
62-
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping: Some(lifetime_mapping), .. }),
62+
kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping, .. }),
6363
..
6464
}) = opaque_ty_node
6565
else {

compiler/rustc_ty_utils/src/implied_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
6767
let mut mapping = FxHashMap::default();
6868
let generics = tcx.generics_of(def_id);
6969
for &(lifetime, new_early_bound_def_id) in
70-
lifetime_mapping.expect("expected lifetime mapping for RPITIT")
70+
lifetime_mapping
7171
{
7272
if let Some(rbv::ResolvedArg::LateBound(_, _, def_id)) =
7373
tcx.named_bound_var(lifetime.hir_id)

0 commit comments

Comments
 (0)