about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2017-12-20 14:06:11 +0100
committerMichael Woerister <michaelwoerister@posteo>2017-12-20 14:06:11 +0100
commitb2f72394ce4755cf145afc116077b32aaaed61b1 (patch)
tree207954d77d7a282657ba3821561033732503ea51
parente6e5589db4c835c00df96714894ad150f8963fd6 (diff)
downloadrust-b2f72394ce4755cf145afc116077b32aaaed61b1.tar.gz
rust-b2f72394ce4755cf145afc116077b32aaaed61b1.zip
incr.comp.: Replace Fingerprint::zero() with a constant.
-rw-r--r--src/librustc/dep_graph/dep_node.rs4
-rw-r--r--src/librustc/dep_graph/graph.rs12
-rw-r--r--src/librustc/ich/fingerprint.rs6
-rw-r--r--src/librustc_metadata/decoder.rs2
4 files changed, 11 insertions, 13 deletions
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 1f65df288ad..29839bb565b 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -279,7 +279,7 @@ macro_rules! define_dep_nodes {
 
                             DepNode {
                                 kind: DepKind::$variant,
-                                hash: Fingerprint::zero(),
+                                hash: Fingerprint::ZERO,
                             }
                         }
                     )*
@@ -308,7 +308,7 @@ macro_rules! define_dep_nodes {
                 assert!(!kind.has_params());
                 DepNode {
                     kind,
-                    hash: Fingerprint::zero(),
+                    hash: Fingerprint::ZERO,
                 }
             }
 
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index 5fa0cedfe74..7acb466e9f3 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -97,7 +97,7 @@ impl DepGraph {
         // Pre-allocate the fingerprints array. We over-allocate a little so
         // that we hopefully don't have to re-allocate during this compilation
         // session.
-        let fingerprints = IndexVec::from_elem_n(Fingerprint::zero(),
+        let fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO,
                                                  (prev_graph.node_count() * 115) / 100);
         DepGraph {
             data: Some(Rc::new(DepGraphData {
@@ -236,10 +236,10 @@ impl DepGraph {
                 let mut fingerprints = self.fingerprints.borrow_mut();
 
                 if dep_node_index.index() >= fingerprints.len() {
-                    fingerprints.resize(dep_node_index.index() + 1, Fingerprint::zero());
+                    fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO);
                 }
 
-                debug_assert!(fingerprints[dep_node_index] == Fingerprint::zero(),
+                debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO,
                               "DepGraph::with_task() - Duplicate fingerprint \
                                insertion for {:?}", key);
                 fingerprints[dep_node_index] = current_fingerprint;
@@ -451,7 +451,7 @@ impl DepGraph {
 
         // Make sure we don't run out of bounds below.
         if current_dep_graph.nodes.len() > fingerprints.len() {
-            fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::zero());
+            fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::ZERO);
         }
 
         let nodes: IndexVec<_, (DepNode, Fingerprint)> =
@@ -644,10 +644,10 @@ impl DepGraph {
             let mut fingerprints = self.fingerprints.borrow_mut();
 
             if dep_node_index.index() >= fingerprints.len() {
-                fingerprints.resize(dep_node_index.index() + 1, Fingerprint::zero());
+                fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO);
             }
 
-            debug_assert!(fingerprints[dep_node_index] == Fingerprint::zero(),
+            debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO,
                 "DepGraph::try_mark_green() - Duplicate fingerprint \
                 insertion for {:?}", dep_node);
 
diff --git a/src/librustc/ich/fingerprint.rs b/src/librustc/ich/fingerprint.rs
index 3d089d8e75f..dc7b9dbe2ef 100644
--- a/src/librustc/ich/fingerprint.rs
+++ b/src/librustc/ich/fingerprint.rs
@@ -14,10 +14,8 @@ use rustc_data_structures::stable_hasher;
 pub struct Fingerprint(u64, u64);
 
 impl Fingerprint {
-    #[inline]
-    pub fn zero() -> Fingerprint {
-        Fingerprint(0, 0)
-    }
+
+    pub const ZERO: Fingerprint = Fingerprint(0, 0);
 
     #[inline]
     pub fn from_smaller_hash(hash: u64) -> Fingerprint {
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 49a017535ff..2e2bde5dad5 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -781,7 +781,7 @@ impl<'a, 'tcx> CrateMetadata {
         } else {
             ExternBodyNestedBodies {
                 nested_bodies: Rc::new(BTreeMap::new()),
-                fingerprint: Fingerprint::zero(),
+                fingerprint: Fingerprint::ZERO,
             }
         }
     }