incr.comp.: Replace Fingerprint::zero() with a constant.

This commit is contained in:
Michael Woerister 2017-12-20 14:06:11 +01:00
parent e6e5589db4
commit b2f72394ce
4 changed files with 11 additions and 13 deletions

View File

@ -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,
}
}

View File

@ -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);

View File

@ -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 {

View File

@ -781,7 +781,7 @@ impl<'a, 'tcx> CrateMetadata {
} else {
ExternBodyNestedBodies {
nested_bodies: Rc::new(BTreeMap::new()),
fingerprint: Fingerprint::zero(),
fingerprint: Fingerprint::ZERO,
}
}
}