about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2017-12-19 15:14:41 +0100
committerMichael Woerister <michaelwoerister@posteo>2017-12-19 15:27:50 +0100
commit0258c6dacaa6e187ae9bf744fd3184e79f78f2ef (patch)
tree93126f94926ad0ef74e640f0ff2be0e60a4b84a1 /src/librustc
parentb39c4bc12358078f77ddd01288b24252f757f37d (diff)
downloadrust-0258c6dacaa6e187ae9bf744fd3184e79f78f2ef.tar.gz
rust-0258c6dacaa6e187ae9bf744fd3184e79f78f2ef.zip
incr.comp.: Precompute small hash for filenames to save some work.
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/ich/hcx.rs2
-rw-r--r--src/librustc/ich/impls_syntax.rs5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index 7099b951129..2945b1ab912 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -341,7 +341,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span {
         std_hash::Hash::hash(&TAG_VALID_SPAN, hasher);
         // We truncate the stable_id hash and line and col numbers. The chances
         // of causing a collision this way should be minimal.
-        std_hash::Hash::hash(&file_lo.name, hasher);
+        std_hash::Hash::hash(&(file_lo.name_hash as u64), hasher);
 
         let col = (col_lo.0 as u64) & 0xFF;
         let line = ((line_lo as u64) & 0xFF_FF_FF) << 8;
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index c25aa10eb1e..57120d61e7c 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -387,7 +387,8 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap {
                                           hcx: &mut StableHashingContext<'gcx>,
                                           hasher: &mut StableHasher<W>) {
         let FileMap {
-            ref name,
+            name: _, // We hash the smaller name_hash instead of this
+            name_hash,
             name_was_remapped,
             unmapped_path: _,
             crate_of_origin,
@@ -402,7 +403,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap {
             ref non_narrow_chars,
         } = *self;
 
-        name.hash_stable(hcx, hasher);
+        (name_hash as u64).hash_stable(hcx, hasher);
         name_was_remapped.hash_stable(hcx, hasher);
 
         DefId {