diff options
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/hir/lowering.rs | 6 | ||||
| -rw-r--r-- | src/librustc/hir/map/mod.rs | 11 | ||||
| -rw-r--r-- | src/librustc/hir/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc/ich/impls_hir.rs | 1 | ||||
| -rw-r--r-- | src/librustc/middle/resolve_lifetime.rs | 25 |
5 files changed, 22 insertions, 24 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index f4452555ba6..f551eb48c6c 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -780,7 +780,6 @@ impl<'a> LoweringContext<'a> { ); hir::GenericParam { - id: node_id, hir_id, name: hir_name, attrs: hir_vec![], @@ -1300,7 +1299,6 @@ impl<'a> LoweringContext<'a> { // Set the name to `impl Bound1 + Bound2`. let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span); in_band_ty_params.push(hir::GenericParam { - id: def_node_id, hir_id, name: ParamName::Plain(ident), pure_wrt_drop: false, @@ -1567,7 +1565,6 @@ impl<'a> LoweringContext<'a> { }; self.output_lifetime_params.push(hir::GenericParam { - id: def_node_id, hir_id, name, span: lifetime.span, @@ -2519,10 +2516,9 @@ impl<'a> LoweringContext<'a> { } }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(param.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(param.id); hir::GenericParam { - id: node_id, hir_id, name, span: param.ident.span, diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 39203208855..052802810f0 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -395,9 +395,14 @@ impl<'hir> Map<'hir> { } Node::GenericParam(param) => { Some(match param.kind { - GenericParamKind::Lifetime { .. } => Def::Local(param.id), - GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)), - GenericParamKind::Const { .. } => Def::ConstParam(self.local_def_id(param.id)), + GenericParamKind::Lifetime { .. } => { + let node_id = self.hir_to_node_id(param.hir_id); + Def::Local(node_id) + }, + GenericParamKind::Type { .. } => Def::TyParam( + self.local_def_id_from_hir_id(param.hir_id)), + GenericParamKind::Const { .. } => Def::ConstParam( + self.local_def_id_from_hir_id(param.hir_id)), }) } } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index f655b9fe4c8..a5b61f002f7 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -420,7 +420,7 @@ impl GenericArg { match self { GenericArg::Lifetime(l) => l.hir_id, GenericArg::Type(t) => t.hir_id, - GenericArg::Const(c) => c.value.id, + GenericArg::Const(c) => c.value.hir_id, } } } @@ -552,7 +552,6 @@ pub enum GenericParamKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct GenericParam { - pub id: NodeId, pub hir_id: HirId, pub name: ParamName, pub attrs: HirVec<Attribute>, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 7c9d64950a6..0bee2a6f260 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -206,7 +206,6 @@ impl_stable_hash_for!(enum hir::TraitBoundModifier { }); impl_stable_hash_for!(struct hir::GenericParam { - id, hir_id, name, pure_wrt_drop, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index a8104a47e67..31e9eb9b746 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -13,7 +13,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; -use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, NodeMap, NodeSet}; +use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet, NodeMap}; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::sync::Lrc; use std::borrow::Cow; @@ -83,7 +83,7 @@ impl 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.id); + let def_id = hir_map.local_def_id_from_hir_id(param.hir_id); let origin = LifetimeDefOrigin::from_param(param); debug!("Region::early: index={} def_id={:?}", i, def_id); (param.name.modern(), Region::EarlyBound(i, def_id, origin)) @@ -91,7 +91,7 @@ impl Region { fn late(hir_map: &Map<'_>, param: &GenericParam) -> (ParamName, Region) { let depth = ty::INNERMOST; - let def_id = hir_map.local_def_id(param.id); + let def_id = hir_map.local_def_id_from_hir_id(param.hir_id); let origin = LifetimeDefOrigin::from_param(param); debug!( "Region::late: param={:?} depth={:?} def_id={:?} origin={:?}", @@ -200,7 +200,7 @@ struct NamedRegionMap { // the set of lifetime def ids that are late-bound; a region can // be late-bound if (a) it does NOT appear in a where-clause and // (b) it DOES appear in the arguments. - pub late_bound: NodeSet, + pub late_bound: HirIdSet, // For each type and trait definition, maps type parameters // to the trait object lifetime defaults computed from them. @@ -389,8 +389,7 @@ fn resolve_lifetimes<'tcx>( let map = rl.defs.entry(hir_id.owner_local_def_id()).or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id, v); } - for k in named_region_map.late_bound { - let hir_id = tcx.hir().node_to_hir_id(k); + for hir_id in named_region_map.late_bound { let map = rl.late_bound .entry(hir_id.owner_local_def_id()) .or_default(); @@ -1338,7 +1337,7 @@ fn object_lifetime_defaults_for_item( add_bounds(&mut set, ¶m.bounds); - let param_def_id = tcx.hir().local_def_id(param.id); + let param_def_id = tcx.hir().local_def_id_from_hir_id(param.hir_id); for predicate in &generics.where_clause.predicates { // Look for `type: ...` where clauses. let data = match *predicate { @@ -1373,7 +1372,7 @@ fn object_lifetime_defaults_for_item( .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => Some(( - param.id, + param.hir_id, hir::LifetimeName::Param(param.name), LifetimeDefOrigin::from_param(param), )), @@ -1382,7 +1381,7 @@ fn object_lifetime_defaults_for_item( .enumerate() .find(|&(_, (_, lt_name, _))| lt_name == name) .map_or(Set1::Many, |(i, (id, _, origin))| { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); Set1::One(Region::EarlyBound(i as u32, def_id, origin)) }) } @@ -1707,7 +1706,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let mut non_lifetime_count = 0; let lifetimes = generics.params.iter().filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - if self.map.late_bound.contains(¶m.id) { + if self.map.late_bound.contains(¶m.hir_id) { Some(Region::late(&self.tcx.hir(), param)) } else { Some(Region::early(&self.tcx.hir(), &mut index, param)) @@ -2792,11 +2791,11 @@ fn insert_late_bound_lifetimes( debug!( "insert_late_bound_lifetimes: lifetime {:?} with id {:?} is late-bound", param.name.ident(), - param.id + param.hir_id ); - let inserted = map.late_bound.insert(param.id); - assert!(inserted, "visited lifetime {:?} twice", param.id); + let inserted = map.late_bound.insert(param.hir_id); + assert!(inserted, "visited lifetime {:?} twice", param.hir_id); } return; |
