Skip to content

Commit b2f7239

Browse files
incr.comp.: Replace Fingerprint::zero() with a constant.
1 parent e6e5589 commit b2f7239

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ macro_rules! define_dep_nodes {
279279

280280
DepNode {
281281
kind: DepKind::$variant,
282-
hash: Fingerprint::zero(),
282+
hash: Fingerprint::ZERO,
283283
}
284284
}
285285
)*
@@ -308,7 +308,7 @@ macro_rules! define_dep_nodes {
308308
assert!(!kind.has_params());
309309
DepNode {
310310
kind,
311-
hash: Fingerprint::zero(),
311+
hash: Fingerprint::ZERO,
312312
}
313313
}
314314

src/librustc/dep_graph/graph.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl DepGraph {
9797
// Pre-allocate the fingerprints array. We over-allocate a little so
9898
// that we hopefully don't have to re-allocate during this compilation
9999
// session.
100-
let fingerprints = IndexVec::from_elem_n(Fingerprint::zero(),
100+
let fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO,
101101
(prev_graph.node_count() * 115) / 100);
102102
DepGraph {
103103
data: Some(Rc::new(DepGraphData {
@@ -236,10 +236,10 @@ impl DepGraph {
236236
let mut fingerprints = self.fingerprints.borrow_mut();
237237

238238
if dep_node_index.index() >= fingerprints.len() {
239-
fingerprints.resize(dep_node_index.index() + 1, Fingerprint::zero());
239+
fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO);
240240
}
241241

242-
debug_assert!(fingerprints[dep_node_index] == Fingerprint::zero(),
242+
debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO,
243243
"DepGraph::with_task() - Duplicate fingerprint \
244244
insertion for {:?}", key);
245245
fingerprints[dep_node_index] = current_fingerprint;
@@ -451,7 +451,7 @@ impl DepGraph {
451451

452452
// Make sure we don't run out of bounds below.
453453
if current_dep_graph.nodes.len() > fingerprints.len() {
454-
fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::zero());
454+
fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::ZERO);
455455
}
456456

457457
let nodes: IndexVec<_, (DepNode, Fingerprint)> =
@@ -644,10 +644,10 @@ impl DepGraph {
644644
let mut fingerprints = self.fingerprints.borrow_mut();
645645

646646
if dep_node_index.index() >= fingerprints.len() {
647-
fingerprints.resize(dep_node_index.index() + 1, Fingerprint::zero());
647+
fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO);
648648
}
649649

650-
debug_assert!(fingerprints[dep_node_index] == Fingerprint::zero(),
650+
debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO,
651651
"DepGraph::try_mark_green() - Duplicate fingerprint \
652652
insertion for {:?}", dep_node);
653653

src/librustc/ich/fingerprint.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ use rustc_data_structures::stable_hasher;
1414
pub struct Fingerprint(u64, u64);
1515

1616
impl Fingerprint {
17-
#[inline]
18-
pub fn zero() -> Fingerprint {
19-
Fingerprint(0, 0)
20-
}
17+
18+
pub const ZERO: Fingerprint = Fingerprint(0, 0);
2119

2220
#[inline]
2321
pub fn from_smaller_hash(hash: u64) -> Fingerprint {

src/librustc_metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ impl<'a, 'tcx> CrateMetadata {
781781
} else {
782782
ExternBodyNestedBodies {
783783
nested_bodies: Rc::new(BTreeMap::new()),
784-
fingerprint: Fingerprint::zero(),
784+
fingerprint: Fingerprint::ZERO,
785785
}
786786
}
787787
}

0 commit comments

Comments
 (0)