Skip to content

Commit eff2cb7

Browse files
Rename some region-specific stuff
1 parent 262a344 commit eff2cb7

File tree

18 files changed

+185
-174
lines changed

18 files changed

+185
-174
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::errors::{
1414
AmbiguousLifetimeBound, MultipleRelaxedDefaultBounds, TraitObjectDeclaredWithNoTraits,
1515
TypeofReservedKeywordUsed, ValueOfAssociatedStructAlreadySpecified,
1616
};
17-
use crate::middle::resolve_lifetime as rl;
17+
use crate::middle::resolve_bound_vars as rbv;
1818
use crate::require_c_abi_if_c_variadic;
1919
use rustc_ast::TraitObjectSyntax;
2020
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@@ -225,10 +225,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
225225
let tcx = self.tcx();
226226
let lifetime_name = |def_id| tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id));
227227

228-
match tcx.named_region(lifetime.hir_id) {
229-
Some(rl::Region::Static) => tcx.lifetimes.re_static,
228+
match tcx.named_bound_var(lifetime.hir_id) {
229+
Some(rbv::ResolvedArg::StaticLifetime) => tcx.lifetimes.re_static,
230230

231-
Some(rl::Region::LateBound(debruijn, index, def_id)) => {
231+
Some(rbv::ResolvedArg::LateBound(debruijn, index, def_id)) => {
232232
let name = lifetime_name(def_id.expect_local());
233233
let br = ty::BoundRegion {
234234
var: ty::BoundVar::from_u32(index),
@@ -237,15 +237,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
237237
tcx.mk_region(ty::ReLateBound(debruijn, br))
238238
}
239239

240-
Some(rl::Region::EarlyBound(def_id)) => {
240+
Some(rbv::ResolvedArg::EarlyBound(def_id)) => {
241241
let name = tcx.hir().ty_param_name(def_id.expect_local());
242242
let item_def_id = tcx.hir().ty_param_owner(def_id.expect_local());
243243
let generics = tcx.generics_of(item_def_id);
244244
let index = generics.param_def_id_to_index[&def_id];
245245
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }))
246246
}
247247

248-
Some(rl::Region::Free(scope, id)) => {
248+
Some(rbv::ResolvedArg::Free(scope, id)) => {
249249
let name = lifetime_name(id.expect_local());
250250
tcx.mk_region(ty::ReFree(ty::FreeRegion {
251251
scope,
@@ -1604,7 +1604,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16041604
self.ast_region_to_region(lifetime, None)
16051605
} else {
16061606
self.compute_object_lifetime_bound(span, existential_predicates).unwrap_or_else(|| {
1607-
if tcx.named_region(lifetime.hir_id).is_some() {
1607+
if tcx.named_bound_var(lifetime.hir_id).is_some() {
16081608
self.ast_region_to_region(lifetime, None)
16091609
} else {
16101610
self.re_infer(None, span).unwrap_or_else(|| {

compiler/rustc_hir_analysis/src/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use std::iter;
4141

4242
mod generics_of;
4343
mod item_bounds;
44-
mod lifetimes;
4544
mod predicates_of;
45+
mod resolve_bound_vars;
4646
mod type_of;
4747

4848
///////////////////////////////////////////////////////////////////////////
@@ -53,7 +53,7 @@ fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
5353
}
5454

5555
pub fn provide(providers: &mut Providers) {
56-
lifetimes::provide(providers);
56+
resolve_bound_vars::provide(providers);
5757
*providers = Providers {
5858
opt_const_param_of: type_of::opt_const_param_of,
5959
type_of: type_of::type_of,

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::middle::resolve_lifetime as rl;
1+
use crate::middle::resolve_bound_vars as rbv;
22
use hir::{
33
intravisit::{self, Visitor},
44
GenericParamKind, HirId, Node,
@@ -394,10 +394,11 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
394394
return;
395395
}
396396

397-
match self.tcx.named_region(lt.hir_id) {
398-
Some(rl::Region::Static | rl::Region::EarlyBound(..)) => {}
399-
Some(rl::Region::LateBound(debruijn, _, _)) if debruijn < self.outer_index => {}
400-
Some(rl::Region::LateBound(..) | rl::Region::Free(..)) | None => {
397+
match self.tcx.named_bound_var(lt.hir_id) {
398+
Some(rbv::ResolvedArg::StaticLifetime | rbv::ResolvedArg::EarlyBound(..)) => {}
399+
Some(rbv::ResolvedArg::LateBound(debruijn, _, _))
400+
if debruijn < self.outer_index => {}
401+
Some(rbv::ResolvedArg::LateBound(..) | rbv::ResolvedArg::Free(..)) | None => {
401402
self.has_late_bound_regions = Some(lt.ident.span);
402403
}
403404
}

0 commit comments

Comments
 (0)