X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fhir%2Fintravisit.rs;h=dcc0f8545e5d77f560094aea0dbab7a5ee4b7985;hb=63ac2aae51034f93c23cffde7be711a86f9d139f;hp=942f1cbd6651b63c2c6df2cd6482270bb83a218a;hpb=5efac03f340f37cad681fa0bf83c1df928a25352;p=rust.git diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 942f1cbd665..dcc0f8545e5 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -298,6 +298,9 @@ fn visit_fn_decl(&mut self, fd: &'v FnDecl) { fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: BodyId, s: Span, id: NodeId) { walk_fn(self, fk, fd, b, s, id) } + fn visit_use(&mut self, path: &'v Path, id: NodeId, hir_id: HirId) { + walk_use(self, path, id, hir_id) + } fn visit_trait_item(&mut self, ti: &'v TraitItem) { walk_trait_item(self, ti) } @@ -436,7 +439,9 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime visitor.visit_ident(ident); } LifetimeName::Param(ParamName::Fresh(_)) | + LifetimeName::Param(ParamName::Error) | LifetimeName::Static | + LifetimeName::Error | LifetimeName::Implicit | LifetimeName::Underscore => {} } @@ -469,8 +474,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { } } ItemKind::Use(ref path, _) => { - visitor.visit_id(item.id); - visitor.visit_path(path, item.hir_id); + visitor.visit_use(path, item.id, item.hir_id); } ItemKind::Static(ref typ, _, body) | ItemKind::Const(ref typ, body) => { @@ -552,6 +556,14 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { walk_list!(visitor, visit_attribute, &item.attrs); } +pub fn walk_use<'v, V: Visitor<'v>>(visitor: &mut V, + path: &'v Path, + item_id: NodeId, + hir_id: HirId) { + visitor.visit_id(item_id); + visitor.visit_path(path, hir_id); +} + pub fn walk_enum_def<'v, V: Visitor<'v>>(visitor: &mut V, enum_definition: &'v EnumDef, generics: &'v Generics, @@ -650,6 +662,9 @@ pub fn walk_path_segment<'v, V: Visitor<'v>>(visitor: &mut V, path_span: Span, segment: &'v PathSegment) { visitor.visit_ident(segment.ident); + if let Some(id) = segment.id { + visitor.visit_id(id); + } if let Some(ref args) = segment.args { visitor.visit_generic_args(path_span, args); } @@ -747,7 +762,7 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v Generi walk_list!(visitor, visit_attribute, ¶m.attrs); match param.name { ParamName::Plain(ident) => visitor.visit_ident(ident), - ParamName::Fresh(_) => {} + ParamName::Error | ParamName::Fresh(_) => {} } match param.kind { GenericParamKind::Lifetime { .. } => {}