about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/lowering.rs6
-rw-r--r--src/librustc/hir/map/mod.rs11
-rw-r--r--src/librustc/hir/mod.rs3
-rw-r--r--src/librustc/ich/impls_hir.rs1
-rw-r--r--src/librustc/middle/resolve_lifetime.rs25
-rw-r--r--src/librustc_metadata/encoder.rs4
-rw-r--r--src/librustc_typeck/collect.rs30
-rw-r--r--src/librustdoc/clean/mod.rs12
8 files changed, 46 insertions, 46 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, &param.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(&param.id) {
+                if self.map.late_bound.contains(&param.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;
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 7e325ecc76c..ef2cca708d1 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -1702,13 +1702,13 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
             match param.kind {
                 hir::GenericParamKind::Lifetime { .. } => {}
                 hir::GenericParamKind::Type { ref default, .. } => {
-                    let def_id = self.tcx.hir().local_def_id(param.id);
+                    let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
                     let has_default = Untracked(default.is_some());
                     let encode_info = IsolatedEncoder::encode_info_for_ty_param;
                     self.record(def_id, encode_info, (def_id, has_default));
                 }
                 hir::GenericParamKind::Const { .. } => {
-                    let def_id = self.tcx.hir().local_def_id(param.id);
+                    let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
                     let encode_info = IsolatedEncoder::encode_info_for_const_param;
                     self.record(def_id, encode_info, def_id);
                 }
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index b0427a5be3e..2ef6aaf4f04 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -129,12 +129,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
                 hir::GenericParamKind::Type {
                     default: Some(_), ..
                 } => {
-                    let def_id = self.tcx.hir().local_def_id(param.id);
+                    let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
                     self.tcx.type_of(def_id);
                 }
                 hir::GenericParamKind::Type { .. } => {}
                 hir::GenericParamKind::Const { .. } => {
-                    let def_id = self.tcx.hir().local_def_id(param.id);
+                    let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
                     self.tcx.type_of(def_id);
                 }
             }
@@ -322,9 +322,10 @@ fn type_param_predicates<'a, 'tcx>(
     };
 
     let icx = ItemCtxt::new(tcx, item_def_id);
+    let param_hir_id = tcx.hir().node_to_hir_id(param_id);
     Lrc::make_mut(&mut result)
         .predicates
-        .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_id, ty,
+        .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_hir_id, ty,
             OnlySelfBounds(true)));
     result
 }
@@ -337,7 +338,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> {
     fn type_parameter_bounds_in_generics(
         &self,
         ast_generics: &hir::Generics,
-        param_id: ast::NodeId,
+        param_id: hir::HirId,
         ty: Ty<'tcx>,
         only_self_bounds: OnlySelfBounds,
     ) -> Vec<(ty::Predicate<'tcx>, Span)> {
@@ -345,7 +346,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> {
             .params
             .iter()
             .filter_map(|param| match param.kind {
-                GenericParamKind::Type { .. } if param.id == param_id => Some(&param.bounds),
+                GenericParamKind::Type { .. } if param.hir_id == param_id => Some(&param.bounds),
                 _ => None,
             })
             .flat_map(|bounds| bounds.iter())
@@ -382,12 +383,12 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> {
 fn is_param<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     ast_ty: &hir::Ty,
-    param_id: ast::NodeId,
+    param_id: hir::HirId,
 ) -> bool {
     if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
         match path.def {
             Def::SelfTy(Some(def_id), None) | Def::TyParam(def_id) => {
-                def_id == tcx.hir().local_def_id(param_id)
+                def_id == tcx.hir().local_def_id_from_hir_id(param_id)
             }
             _ => false,
         }
@@ -721,7 +722,7 @@ fn super_predicates_of<'a, 'tcx>(
     // as one of its "superpredicates".
     let is_trait_alias = tcx.is_trait_alias(trait_def_id);
     let superbounds2 = icx.type_parameter_bounds_in_generics(
-        generics, item.id, self_param_ty, OnlySelfBounds(!is_trait_alias));
+        generics, item.hir_id, self_param_ty, OnlySelfBounds(!is_trait_alias));
 
     // Combine the two lists to form the complete set of superbounds:
     let superbounds: Vec<_> = superbounds1.into_iter().chain(superbounds2).collect();
@@ -987,7 +988,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
             .map(|(i, param)| ty::GenericParamDef {
                 name: param.name.ident().as_interned_str(),
                 index: own_start + i as u32,
-                def_id: tcx.hir().local_def_id(param.id),
+                def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
                 pure_wrt_drop: param.pure_wrt_drop,
                 kind: ty::GenericParamDefKind::Lifetime,
             }),
@@ -1018,9 +1019,9 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
 
                     if !allow_defaults && default.is_some() {
                         if !tcx.features().default_type_parameter_fallback {
-                            tcx.lint_node(
+                            tcx.lint_hir(
                                 lint::builtin::INVALID_TYPE_PARAM_DEFAULT,
-                                param.id,
+                                param.hir_id,
                                 param.span,
                                 &format!(
                                     "defaults for type parameters are only allowed in \
@@ -1033,7 +1034,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
                     let ty_param = ty::GenericParamDef {
                         index: type_start + i as u32,
                         name: param.name.ident().as_interned_str(),
-                        def_id: tcx.hir().local_def_id(param.id),
+                        def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
                         pure_wrt_drop: param.pure_wrt_drop,
                         kind: ty::GenericParamDefKind::Type {
                             has_default: default.is_some(),
@@ -1704,8 +1705,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>(
         .iter()
         .filter(move |param| match param.kind {
             GenericParamKind::Lifetime { .. } => {
-                let hir_id = tcx.hir().node_to_hir_id(param.id);
-                !tcx.is_late_bound(hir_id)
+                !tcx.is_late_bound(param.hir_id)
             }
             _ => false,
         })
@@ -1942,7 +1942,7 @@ fn explicit_predicates_of<'a, 'tcx>(
     let mut index = parent_count + has_own_self as u32;
     for param in early_bound_lifetimes_from_generics(tcx, ast_generics) {
         let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion {
-            def_id: tcx.hir().local_def_id(param.id),
+            def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
             index,
             name: param.name.ident().as_interned_str(),
         }));
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 1171b5ac3b6..03f248f41ad 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1511,7 +1511,7 @@ impl Clean<GenericParamDef> for hir::GenericParam {
             }
             hir::GenericParamKind::Type { ref default, synthetic } => {
                 (self.name.ident().name.clean(cx), GenericParamDefKind::Type {
-                    did: cx.tcx.hir().local_def_id(self.id),
+                    did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id),
                     bounds: self.bounds.clean(cx),
                     default: default.clean(cx),
                     synthetic: synthetic,
@@ -1519,7 +1519,7 @@ impl Clean<GenericParamDef> for hir::GenericParam {
             }
             hir::GenericParamKind::Const { ref ty } => {
                 (self.name.ident().name.clean(cx), GenericParamDefKind::Const {
-                    did: cx.tcx.hir().local_def_id(self.id),
+                    did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id),
                     ty: ty.clean(cx),
                 })
             }
@@ -2597,7 +2597,7 @@ impl Clean<Type> for hir::Ty {
                                     if let Some(lt) = lifetime.cloned() {
                                         if !lt.is_elided() {
                                             let lt_def_id =
-                                                cx.tcx.hir().local_def_id(param.id);
+                                                cx.tcx.hir().local_def_id_from_hir_id(param.hir_id);
                                             lt_substs.insert(lt_def_id, lt.clean(cx));
                                         }
                                     }
@@ -2605,7 +2605,8 @@ impl Clean<Type> for hir::Ty {
                                 }
                                 hir::GenericParamKind::Type { ref default, .. } => {
                                     let ty_param_def =
-                                        Def::TyParam(cx.tcx.hir().local_def_id(param.id));
+                                        Def::TyParam(
+                                            cx.tcx.hir().local_def_id_from_hir_id(param.hir_id));
                                     let mut j = 0;
                                     let type_ = generic_args.args.iter().find_map(|arg| {
                                         match arg {
@@ -2629,7 +2630,8 @@ impl Clean<Type> for hir::Ty {
                                 }
                                 hir::GenericParamKind::Const { .. } => {
                                     let const_param_def =
-                                        Def::ConstParam(cx.tcx.hir().local_def_id(param.id));
+                                        Def::ConstParam(
+                                            cx.tcx.hir().local_def_id_from_hir_id(param.hir_id));
                                     let mut j = 0;
                                     let const_ = generic_args.args.iter().find_map(|arg| {
                                         match arg {