Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0241618

Browse files
committedMar 6, 2024
Rename some functions to represent their generalized behavior
1 parent f70d989 commit 0241618

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed
 

‎compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn check_opaque_meets_bounds<'tcx>(
358358
tcx, parent,
359359
)
360360
.extend_to(tcx, def_id.to_def_id(), |param, _| {
361-
tcx.map_rpit_lifetime_to_fn_lifetime(param.def_id.expect_local()).into()
361+
tcx.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local()).into()
362362
}),
363363
};
364364

‎compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn compute_bidirectional_outlives_predicates<'tcx>(
339339
predicates: &mut Vec<(ty::Clause<'tcx>, Span)>,
340340
) {
341341
for param in opaque_own_params {
342-
let orig_lifetime = tcx.map_rpit_lifetime_to_fn_lifetime(param.def_id.expect_local());
342+
let orig_lifetime = tcx.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local());
343343
if let ty::ReEarlyParam(..) = *orig_lifetime {
344344
let dup_lifetime = ty::Region::new_early_param(
345345
tcx,

‎compiler/rustc_middle/src/ty/context.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ impl<'tcx> TyCtxt<'tcx> {
11951195
if self.def_kind(scope) == DefKind::OpaqueTy {
11961196
// Lifetime params of opaque types are synthetic and thus irrelevant to
11971197
// diagnostics. Map them back to their origin!
1198-
region = self.map_rpit_lifetime_to_fn_lifetime(def_id);
1198+
region = self.map_opaque_lifetime_to_parent_lifetime(def_id);
11991199
continue;
12001200
}
12011201
break (scope, ty::BrNamed(def_id.into(), self.item_name(def_id.into())));
@@ -2160,31 +2160,31 @@ impl<'tcx> TyCtxt<'tcx> {
21602160
)
21612161
}
21622162

2163-
/// Given the def-id of an early-bound lifetime on an RPIT corresponding to
2163+
/// Given the def-id of an early-bound lifetime on an opaque corresponding to
21642164
/// a duplicated captured lifetime, map it back to the early- or late-bound
21652165
/// lifetime of the function from which it originally as captured. If it is
21662166
/// a late-bound lifetime, this will represent the liberated (`ReLateParam`) lifetime
21672167
/// of the signature.
21682168
// FIXME(RPITIT): if we ever synthesize new lifetimes for RPITITs and not just
21692169
// re-use the generics of the opaque, this function will need to be tweaked slightly.
2170-
pub fn map_rpit_lifetime_to_fn_lifetime(
2170+
pub fn map_opaque_lifetime_to_parent_lifetime(
21712171
self,
2172-
mut rpit_lifetime_param_def_id: LocalDefId,
2172+
mut opaque_lifetime_param_def_id: LocalDefId,
21732173
) -> ty::Region<'tcx> {
21742174
debug_assert!(
2175-
matches!(self.def_kind(rpit_lifetime_param_def_id), DefKind::LifetimeParam),
2176-
"{rpit_lifetime_param_def_id:?} is a {}",
2177-
self.def_descr(rpit_lifetime_param_def_id.to_def_id())
2175+
matches!(self.def_kind(opaque_lifetime_param_def_id), DefKind::LifetimeParam),
2176+
"{opaque_lifetime_param_def_id:?} is a {}",
2177+
self.def_descr(opaque_lifetime_param_def_id.to_def_id())
21782178
);
21792179

21802180
loop {
2181-
let parent = self.local_parent(rpit_lifetime_param_def_id);
2181+
let parent = self.local_parent(opaque_lifetime_param_def_id);
21822182
let hir::OpaqueTy { lifetime_mapping, .. } =
21832183
self.hir_node_by_def_id(parent).expect_item().expect_opaque_ty();
21842184

21852185
let Some((lifetime, _)) = lifetime_mapping
21862186
.iter()
2187-
.find(|(_, duplicated_param)| *duplicated_param == rpit_lifetime_param_def_id)
2187+
.find(|(_, duplicated_param)| *duplicated_param == opaque_lifetime_param_def_id)
21882188
else {
21892189
bug!("duplicated lifetime param should be present");
21902190
};
@@ -2197,7 +2197,7 @@ impl<'tcx> TyCtxt<'tcx> {
21972197
// of the opaque we mapped from. Continue mapping.
21982198
if matches!(self.def_kind(new_parent), DefKind::OpaqueTy) {
21992199
debug_assert_eq!(self.parent(parent.to_def_id()), new_parent);
2200-
rpit_lifetime_param_def_id = ebv.expect_local();
2200+
opaque_lifetime_param_def_id = ebv.expect_local();
22012201
continue;
22022202
}
22032203

‎compiler/rustc_ty_utils/src/implied_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
7171
// the end of the list corresponding to the opaque's generics.
7272
for param in &generics.params[tcx.generics_of(fn_def_id).params.len()..] {
7373
let orig_lt =
74-
tcx.map_rpit_lifetime_to_fn_lifetime(param.def_id.expect_local());
74+
tcx.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local());
7575
if matches!(*orig_lt, ty::ReLateParam(..)) {
7676
mapping.insert(
7777
orig_lt,

0 commit comments

Comments
 (0)
Failed to load comments.