diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-07-28 15:39:02 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-07-28 15:39:02 -0400 |
| commit | e359147d1214c6fe8e010118c5df05ca10f0a2b9 (patch) | |
| tree | 0c7b9dcf0cfdfb01c2dc7cd73757fd9be5659cc0 | |
| parent | 2f9fff21911a3e419b21e56dba145bf0deab6f81 (diff) | |
| download | rust-e359147d1214c6fe8e010118c5df05ca10f0a2b9.tar.gz rust-e359147d1214c6fe8e010118c5df05ca10f0a2b9.zip | |
hash def-path's better
actually we shouldn't even hash nested items at all, but that is addressed in a followup PR
| -rw-r--r-- | src/librustc_incremental/calculate_svh.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/librustc_incremental/calculate_svh.rs b/src/librustc_incremental/calculate_svh.rs index 70704f5dec0..d433bdea6ec 100644 --- a/src/librustc_incremental/calculate_svh.rs +++ b/src/librustc_incremental/calculate_svh.rs @@ -119,6 +119,7 @@ mod svh_visitor { use rustc::ty::TyCtxt; use rustc::hir; use rustc::hir::*; + use rustc::hir::map::DefPath; use rustc::hir::intravisit as visit; use rustc::hir::intravisit::{Visitor, FnKind}; @@ -135,6 +136,15 @@ mod svh_visitor { -> Self { StrictVersionHashVisitor { st: st, tcx: tcx } } + + fn hash_def_path(&mut self, path: &DefPath) { + self.tcx.crate_name(path.krate).hash(self.st); + self.tcx.crate_disambiguator(path.krate).hash(self.st); + for data in &path.data { + data.data.as_interned_str().hash(self.st); + data.disambiguator.hash(self.st); + } + } } // To off-load the bulk of the hash-computation on #[derive(Hash)], @@ -289,9 +299,9 @@ mod svh_visitor { impl<'a, 'tcx> Visitor<'a> for StrictVersionHashVisitor<'a, 'tcx> { fn visit_nested_item(&mut self, item: ItemId) { - debug!("visit_nested_item: {:?} st={:?}", item, self.st); - let def_path = self.tcx.map.def_path_from_id(item.id); - def_path.hash(self.st); + let def_path = self.tcx.map.def_path_from_id(item.id).unwrap(); + debug!("visit_nested_item: def_path={:?} st={:?}", def_path, self.st); + self.hash_def_path(&def_path); } fn visit_variant_data(&mut self, s: &'a VariantData, name: Name, |
