ICH: Fix some omissions around foreign mods in hasher.
This commit is contained in:
parent
d0c61ebc12
commit
6fac703293
2 changed files with 35 additions and 9 deletions
|
@ -264,6 +264,9 @@ pub trait Visitor<'v> : Sized {
|
|||
fn visit_where_predicate(&mut self, predicate: &'v WherePredicate) {
|
||||
walk_where_predicate(self, predicate)
|
||||
}
|
||||
fn visit_fn_decl(&mut self, fd: &'v FnDecl) {
|
||||
walk_fn_decl(self, fd)
|
||||
}
|
||||
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: ExprId, s: Span, id: NodeId) {
|
||||
walk_fn(self, fk, fd, b, s, id)
|
||||
}
|
||||
|
@ -532,7 +535,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
|
|||
walk_list!(visitor, visit_ty, tuple_element_types);
|
||||
}
|
||||
TyBareFn(ref function_declaration) => {
|
||||
walk_fn_decl(visitor, &function_declaration.decl);
|
||||
visitor.visit_fn_decl(&function_declaration.decl);
|
||||
walk_list!(visitor, visit_lifetime_def, &function_declaration.lifetimes);
|
||||
}
|
||||
TyPath(ref qpath) => {
|
||||
|
@ -661,7 +664,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
|
|||
|
||||
match foreign_item.node {
|
||||
ForeignItemFn(ref function_declaration, ref generics) => {
|
||||
walk_fn_decl(visitor, function_declaration);
|
||||
visitor.visit_fn_decl(function_declaration);
|
||||
visitor.visit_generics(generics)
|
||||
}
|
||||
ForeignItemStatic(ref typ, _) => visitor.visit_ty(typ),
|
||||
|
@ -765,7 +768,7 @@ pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
|
|||
_span: Span,
|
||||
id: NodeId) {
|
||||
visitor.visit_id(id);
|
||||
walk_fn_decl(visitor, function_declaration);
|
||||
visitor.visit_fn_decl(function_declaration);
|
||||
walk_fn_kind(visitor, function_kind);
|
||||
visitor.visit_body(body_id)
|
||||
}
|
||||
|
@ -777,7 +780,7 @@ pub fn walk_fn_with_body<'v, V: Visitor<'v>>(visitor: &mut V,
|
|||
_span: Span,
|
||||
id: NodeId) {
|
||||
visitor.visit_id(id);
|
||||
walk_fn_decl(visitor, function_declaration);
|
||||
visitor.visit_fn_decl(function_declaration);
|
||||
walk_fn_kind(visitor, function_kind);
|
||||
visitor.visit_expr(body)
|
||||
}
|
||||
|
@ -794,7 +797,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
|
|||
MethodTraitItem(ref sig, None) => {
|
||||
visitor.visit_id(trait_item.id);
|
||||
visitor.visit_generics(&sig.generics);
|
||||
walk_fn_decl(visitor, &sig.decl);
|
||||
visitor.visit_fn_decl(&sig.decl);
|
||||
}
|
||||
MethodTraitItem(ref sig, Some(body_id)) => {
|
||||
visitor.visit_fn(FnKind::Method(trait_item.name,
|
||||
|
|
|
@ -180,9 +180,10 @@ enum SawAbiComponent<'a> {
|
|||
SawLifetimeDef(usize),
|
||||
|
||||
SawMod,
|
||||
SawForeignItem,
|
||||
SawForeignItem(SawForeignItemComponent),
|
||||
SawItem(SawItemComponent),
|
||||
SawTy(SawTyComponent),
|
||||
SawFnDecl(bool),
|
||||
SawGenerics,
|
||||
SawTraitItem(SawTraitOrImplItemComponent),
|
||||
SawImplItem(SawTraitOrImplItemComponent),
|
||||
|
@ -364,7 +365,7 @@ enum SawItemComponent {
|
|||
SawItemConst,
|
||||
SawItemFn(Unsafety, Constness, Abi),
|
||||
SawItemMod,
|
||||
SawItemForeignMod,
|
||||
SawItemForeignMod(Abi),
|
||||
SawItemTy,
|
||||
SawItemEnum,
|
||||
SawItemStruct,
|
||||
|
@ -382,7 +383,7 @@ fn saw_item(node: &Item_) -> SawItemComponent {
|
|||
ItemConst(..) =>SawItemConst,
|
||||
ItemFn(_, unsafety, constness, abi, _, _) => SawItemFn(unsafety, constness, abi),
|
||||
ItemMod(..) => SawItemMod,
|
||||
ItemForeignMod(..) => SawItemForeignMod,
|
||||
ItemForeignMod(ref fm) => SawItemForeignMod(fm.abi),
|
||||
ItemTy(..) => SawItemTy,
|
||||
ItemEnum(..) => SawItemEnum,
|
||||
ItemStruct(..) => SawItemStruct,
|
||||
|
@ -393,6 +394,12 @@ fn saw_item(node: &Item_) -> SawItemComponent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Hash)]
|
||||
enum SawForeignItemComponent {
|
||||
Static { mutable: bool },
|
||||
Fn,
|
||||
}
|
||||
|
||||
#[derive(Hash)]
|
||||
enum SawPatComponent {
|
||||
SawPatWild,
|
||||
|
@ -602,7 +609,17 @@ impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'has
|
|||
fn visit_foreign_item(&mut self, i: &'tcx ForeignItem) {
|
||||
debug!("visit_foreign_item: st={:?}", self.st);
|
||||
|
||||
SawForeignItem.hash(self.st);
|
||||
match i.node {
|
||||
ForeignItemFn(..) => {
|
||||
SawForeignItem(SawForeignItemComponent::Fn)
|
||||
}
|
||||
ForeignItemStatic(_, mutable) => {
|
||||
SawForeignItem(SawForeignItemComponent::Static {
|
||||
mutable: mutable
|
||||
})
|
||||
}
|
||||
}.hash(self.st);
|
||||
|
||||
hash_span!(self, i.span);
|
||||
hash_attrs!(self, &i.attrs);
|
||||
visit::walk_foreign_item(self, i)
|
||||
|
@ -639,6 +656,12 @@ impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'has
|
|||
visit::walk_generics(self, g)
|
||||
}
|
||||
|
||||
fn visit_fn_decl(&mut self, fd: &'tcx FnDecl) {
|
||||
debug!("visit_fn_decl: st={:?}", self.st);
|
||||
SawFnDecl(fd.variadic).hash(self.st);
|
||||
visit::walk_fn_decl(self, fd)
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, ti: &'tcx TraitItem) {
|
||||
debug!("visit_trait_item: st={:?}", self.st);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue