Remove further usage of &hir::Map
This commit is contained in:
parent
89ac81a6e6
commit
7eff2feb62
6 changed files with 24 additions and 27 deletions
|
@ -41,9 +41,9 @@ pub enum LifetimeUseSet<'tcx> {
|
|||
}
|
||||
|
||||
trait RegionExt {
|
||||
fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam<'_>) -> (ParamName, Region);
|
||||
fn early(hir_map: Map<'_>, index: &mut u32, param: &GenericParam<'_>) -> (ParamName, Region);
|
||||
|
||||
fn late(index: u32, hir_map: &Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region);
|
||||
fn late(index: u32, hir_map: Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region);
|
||||
|
||||
fn late_anon(named_late_bound_vars: u32, index: &Cell<u32>) -> Region;
|
||||
|
||||
|
@ -59,7 +59,7 @@ trait RegionExt {
|
|||
}
|
||||
|
||||
impl RegionExt for Region {
|
||||
fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam<'_>) -> (ParamName, Region) {
|
||||
fn early(hir_map: Map<'_>, index: &mut u32, param: &GenericParam<'_>) -> (ParamName, Region) {
|
||||
let i = *index;
|
||||
*index += 1;
|
||||
let def_id = hir_map.local_def_id(param.hir_id);
|
||||
|
@ -68,7 +68,7 @@ impl RegionExt for Region {
|
|||
(param.name.normalize_to_macros_2_0(), Region::EarlyBound(i, def_id.to_def_id(), origin))
|
||||
}
|
||||
|
||||
fn late(idx: u32, hir_map: &Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region) {
|
||||
fn late(idx: u32, hir_map: Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region) {
|
||||
let depth = ty::INNERMOST;
|
||||
let def_id = hir_map.local_def_id(param.hir_id);
|
||||
let origin = LifetimeDefOrigin::from_param(param);
|
||||
|
@ -817,7 +817,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {
|
||||
Some(Region::early(&self.tcx.hir(), &mut index, param))
|
||||
Some(Region::early(self.tcx.hir(), &mut index, param))
|
||||
}
|
||||
GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
|
||||
non_lifetime_count += 1;
|
||||
|
@ -888,7 +888,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.filter(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
|
||||
.enumerate()
|
||||
.map(|(late_bound_idx, param)| {
|
||||
let pair = Region::late(late_bound_idx as u32, &self.tcx.hir(), param);
|
||||
let pair = Region::late(late_bound_idx as u32, self.tcx.hir(), param);
|
||||
let r = late_region_as_bound_region(self.tcx, &pair.1);
|
||||
(pair, r)
|
||||
})
|
||||
|
@ -1045,7 +1045,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
for param in generics.params {
|
||||
match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {
|
||||
let (name, reg) = Region::early(&self.tcx.hir(), &mut index, ¶m);
|
||||
let (name, reg) = Region::early(self.tcx.hir(), &mut index, ¶m);
|
||||
let Region::EarlyBound(_, def_id, _) = reg else {
|
||||
bug!();
|
||||
};
|
||||
|
@ -1145,7 +1145,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {
|
||||
Some(Region::early(&self.tcx.hir(), &mut index, param))
|
||||
Some(Region::early(self.tcx.hir(), &mut index, param))
|
||||
}
|
||||
GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
|
||||
non_lifetime_count += 1;
|
||||
|
@ -1214,7 +1214,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {
|
||||
Some(Region::early(&self.tcx.hir(), &mut index, param))
|
||||
Some(Region::early(self.tcx.hir(), &mut index, param))
|
||||
}
|
||||
GenericParamKind::Const { .. } | GenericParamKind::Type { .. } => {
|
||||
non_lifetime_count += 1;
|
||||
|
@ -1368,7 +1368,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.enumerate()
|
||||
.map(|(late_bound_idx, param)| {
|
||||
let pair =
|
||||
Region::late(late_bound_idx as u32, &this.tcx.hir(), param);
|
||||
Region::late(late_bound_idx as u32, this.tcx.hir(), param);
|
||||
let r = late_region_as_bound_region(this.tcx, &pair.1);
|
||||
(pair, r)
|
||||
})
|
||||
|
@ -1463,11 +1463,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
.filter(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
|
||||
.enumerate()
|
||||
.map(|(late_bound_idx, param)| {
|
||||
let pair = Region::late(
|
||||
initial_bound_vars + late_bound_idx as u32,
|
||||
&self.tcx.hir(),
|
||||
param,
|
||||
);
|
||||
let pair =
|
||||
Region::late(initial_bound_vars + late_bound_idx as u32, self.tcx.hir(), param);
|
||||
let r = late_region_as_bound_region(self.tcx, &pair.1);
|
||||
lifetimes.insert(pair.0, pair.1);
|
||||
r
|
||||
|
@ -2200,9 +2197,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
if self.map.late_bound.contains(¶m.hir_id) {
|
||||
let late_bound_idx = named_late_bound_vars;
|
||||
named_late_bound_vars += 1;
|
||||
Some(Region::late(late_bound_idx, &self.tcx.hir(), param))
|
||||
Some(Region::late(late_bound_idx, self.tcx.hir(), param))
|
||||
} else {
|
||||
Some(Region::early(&self.tcx.hir(), &mut next_early_index, param))
|
||||
Some(Region::early(self.tcx.hir(), &mut next_early_index, param))
|
||||
}
|
||||
}
|
||||
GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
|
||||
|
@ -2222,7 +2219,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
})
|
||||
.enumerate()
|
||||
.map(|(late_bound_idx, param)| {
|
||||
let pair = Region::late(late_bound_idx as u32, &self.tcx.hir(), param);
|
||||
let pair = Region::late(late_bound_idx as u32, self.tcx.hir(), param);
|
||||
late_region_as_bound_region(self.tcx, &pair.1)
|
||||
})
|
||||
.collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue