Rename some functions to represent their generalized behavior · rust-lang/rust@0241618 (original) (raw)
`@@ -1195,7 +1195,7 @@ impl<'tcx> TyCtxt<'tcx> {
`
1195
1195
`if self.def_kind(scope) == DefKind::OpaqueTy {
`
1196
1196
`// Lifetime params of opaque types are synthetic and thus irrelevant to
`
1197
1197
`// 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);
`
1199
1199
`continue;
`
1200
1200
`}
`
1201
1201
`break (scope, ty::BrNamed(def_id.into(), self.item_name(def_id.into())));
`
`@@ -2160,31 +2160,31 @@ impl<'tcx> TyCtxt<'tcx> {
`
2160
2160
`)
`
2161
2161
`}
`
2162
2162
``
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
`
2164
2164
`/// a duplicated captured lifetime, map it back to the early- or late-bound
`
2165
2165
`/// lifetime of the function from which it originally as captured. If it is
`
2166
2166
`` /// a late-bound lifetime, this will represent the liberated (ReLateParam
) lifetime
``
2167
2167
`/// of the signature.
`
2168
2168
`// FIXME(RPITIT): if we ever synthesize new lifetimes for RPITITs and not just
`
2169
2169
`// 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(
`
2171
2171
`self,
`
2172
``
`-
mut rpit_lifetime_param_def_id: LocalDefId,
`
``
2172
`+
mut opaque_lifetime_param_def_id: LocalDefId,
`
2173
2173
`) -> ty::Region<'tcx> {
`
2174
2174
`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())
`
2178
2178
`);
`
2179
2179
``
2180
2180
`loop {
`
2181
``
`-
let parent = self.local_parent(rpit_lifetime_param_def_id);
`
``
2181
`+
let parent = self.local_parent(opaque_lifetime_param_def_id);
`
2182
2182
`let hir::OpaqueTy { lifetime_mapping, .. } =
`
2183
2183
`self.hir_node_by_def_id(parent).expect_item().expect_opaque_ty();
`
2184
2184
``
2185
2185
`let Some((lifetime, _)) = lifetime_mapping
`
2186
2186
`.iter()
`
2187
``
`-
.find(|(_, duplicated_param)| *duplicated_param == rpit_lifetime_param_def_id)
`
``
2187
`+
.find(|(_, duplicated_param)| *duplicated_param == opaque_lifetime_param_def_id)
`
2188
2188
`else {
`
2189
2189
`bug!("duplicated lifetime param should be present");
`
2190
2190
`};
`
`@@ -2197,7 +2197,7 @@ impl<'tcx> TyCtxt<'tcx> {
`
2197
2197
`// of the opaque we mapped from. Continue mapping.
`
2198
2198
`if matches!(self.def_kind(new_parent), DefKind::OpaqueTy) {
`
2199
2199
`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();
`
2201
2201
`continue;
`
2202
2202
`}
`
2203
2203
``