Skip to content

Commit 01cf66b

Browse files
committed
hir: remove NodeId from TraitRef
1 parent aa6a9c3 commit 01cf66b

File tree

7 files changed

+7
-15
lines changed

7 files changed

+7
-15
lines changed

src/librustc/hir/lowering.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2338,13 +2338,12 @@ impl<'a> LoweringContext<'a> {
23382338
let future_path =
23392339
this.std_path(span, &["future", "Future"], Some(future_params), false);
23402340

2341-
let LoweredNodeId { node_id, hir_id } = this.next_id();
2341+
let LoweredNodeId { node_id: _, hir_id } = this.next_id();
23422342
let mut bounds = vec![
23432343
hir::GenericBound::Trait(
23442344
hir::PolyTraitRef {
23452345
trait_ref: hir::TraitRef {
23462346
path: future_path,
2347-
ref_id: node_id,
23482347
hir_ref_id: hir_id,
23492348
},
23502349
bound_generic_params: hir_vec![],
@@ -2714,10 +2713,9 @@ impl<'a> LoweringContext<'a> {
27142713
hir::QPath::Resolved(None, path) => path.and_then(|path| path),
27152714
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath),
27162715
};
2717-
let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.ref_id);
2716+
let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(p.ref_id);
27182717
hir::TraitRef {
27192718
path,
2720-
ref_id: node_id,
27212719
hir_ref_id: hir_id,
27222720
}
27232721
}
@@ -5056,7 +5054,6 @@ impl<'a> LoweringContext<'a> {
50565054
bound_generic_params: hir::HirVec::new(),
50575055
trait_ref: hir::TraitRef {
50585056
path: path.and_then(|path| path),
5059-
ref_id: id.node_id,
50605057
hir_ref_id: id.hir_id,
50615058
},
50625059
span,

src/librustc/hir/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,6 @@ pub enum UseKind {
20622062
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
20632063
pub struct TraitRef {
20642064
pub path: Path,
2065-
pub ref_id: NodeId,
20662065
pub hir_ref_id: HirId,
20672066
}
20682067

src/librustc/ich/impls_hir.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ impl_stable_hash_for!(enum hir::ImplicitSelfKind {
385385
});
386386

387387
impl_stable_hash_for!(struct hir::TraitRef {
388-
// Don't hash the ref_id. It is tracked via the thing it is used to access
389-
ref_id -> _,
388+
// Don't hash the hir_ref_id. It is tracked via the thing it is used to access
390389
hir_ref_id -> _,
391390
path,
392391
});

src/librustc_typeck/astconv.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
718718
// specify type to assert that error was already reported in Err case:
719719
let predicate: Result<_, ErrorReported> =
720720
self.ast_type_binding_to_poly_projection_predicate(
721-
trait_ref.ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings);
721+
trait_ref.hir_ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings);
722722
// okay to ignore Err because of ErrorReported (see above)
723723
Some((predicate.ok()?, binding.span))
724724
}));
@@ -802,7 +802,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
802802

803803
fn ast_type_binding_to_poly_projection_predicate(
804804
&self,
805-
ref_id: ast::NodeId,
805+
hir_ref_id: hir::HirId,
806806
trait_ref: ty::PolyTraitRef<'tcx>,
807807
binding: &ConvertedBinding<'tcx>,
808808
speculative: bool,
@@ -874,7 +874,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
874874
binding.item_name, binding.span)
875875
}?;
876876

877-
let hir_ref_id = self.tcx().hir().node_to_hir_id(ref_id);
878877
let (assoc_ident, def_scope) =
879878
tcx.adjust_ident(binding.item_name, candidate.def_id(), hir_ref_id);
880879
let assoc_ty = tcx.associated_items(candidate.def_id()).find(|i| {

src/librustc_typeck/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait:
386386
// In case there are any projections etc, find the "environment"
387387
// def-id that will be used to determine the traits/predicates in
388388
// scope. This is derived from the enclosing item-like thing.
389-
let env_node_id = tcx.hir().get_parent(hir_trait.ref_id);
390-
let env_def_id = tcx.hir().local_def_id(env_node_id);
389+
let env_hir_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id);
390+
let env_def_id = tcx.hir().local_def_id_from_hir_id(env_hir_id);
391391
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
392392
let mut projections = Vec::new();
393393
let (principal, _) = astconv::AstConv::instantiate_poly_trait_ref_inner(

src/librustdoc/clean/auto_trait.rs

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
115115
if result.is_auto() {
116116
let trait_ = hir::TraitRef {
117117
path: get_path_for_type(self.cx.tcx, trait_def_id, hir::def::Def::Trait),
118-
ref_id: ast::DUMMY_NODE_ID,
119118
hir_ref_id: hir::DUMMY_HIR_ID,
120119
};
121120

src/librustdoc/clean/blanket_impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
123123
path: get_path_for_type(infcx.tcx,
124124
trait_def_id,
125125
hir::def::Def::Trait),
126-
ref_id: ast::DUMMY_NODE_ID,
127126
hir_ref_id: hir::DUMMY_HIR_ID,
128127
};
129128
let provided_trait_methods =

0 commit comments

Comments
 (0)