Skip to content

Commit

Permalink
hir: remove NodeId from PathSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Mar 7, 2019
1 parent cd06038 commit 78f91e3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
11 changes: 4 additions & 7 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,6 @@ impl<'a> LoweringContext<'a> {

hir::PathSegment::new(
segment.ident,
Some(id.node_id),
Some(id.hir_id),
Some(def),
generic_args,
Expand Down Expand Up @@ -3276,10 +3275,8 @@ impl<'a> LoweringContext<'a> {
debug!("renumber_segment_ids(path = {:?})", path);
let mut path = path.clone();
for seg in path.segments.iter_mut() {
if seg.id.is_some() {
let next_id = self.next_id();
seg.id = Some(next_id.node_id);
seg.hir_id = Some(next_id.hir_id);
if seg.hir_id.is_some() {
seg.hir_id = Some(self.next_id().hir_id);
}
}
path
Expand Down Expand Up @@ -5024,8 +5021,8 @@ impl<'a> LoweringContext<'a> {


for seg in path.segments.iter_mut() {
if let Some(id) = seg.id {
seg.id = Some(self.lower_node_id(id).node_id);
if seg.hir_id.is_some() {
seg.hir_id = Some(self.next_id().hir_id);
}
}
path
Expand Down
4 changes: 0 additions & 4 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ pub struct PathSegment {
// therefore will not have 'jump to def' in IDEs, but otherwise will not be
// affected. (In general, we don't bother to get the defs for synthesized
// segments, only for segments which have come from the AST).
pub id: Option<NodeId>,
pub hir_id: Option<HirId>,
pub def: Option<Def>,

Expand All @@ -350,7 +349,6 @@ impl PathSegment {
pub fn from_ident(ident: Ident) -> PathSegment {
PathSegment {
ident,
id: None,
hir_id: None,
def: None,
infer_types: true,
Expand All @@ -360,15 +358,13 @@ impl PathSegment {

pub fn new(
ident: Ident,
id: Option<NodeId>,
hir_id: Option<HirId>,
def: Option<Def>,
args: GenericArgs,
infer_types: bool,
) -> Self {
PathSegment {
ident,
id,
hir_id,
def,
infer_types,
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ impl_stable_hash_for!(struct hir::Path {

impl_stable_hash_for!(struct hir::PathSegment {
ident -> (ident.name),
id,
hir_id,
def,
infer_types,
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4250,7 +4250,6 @@ where F: Fn(DefId) -> Def {
def: def_ctor(def_id),
segments: hir::HirVec::from_vec(apb.names.iter().map(|s| hir::PathSegment {
ident: ast::Ident::from_str(&s),
id: None,
hir_id: None,
def: None,
args: None,
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> {
real_name.unwrap_or(last.ident),
None,
None,
None,
self.generics_to_path_params(generics.clone()),
false,
));
Expand Down

0 comments on commit 78f91e3

Please sign in to comment.