Skip to content

Commit 85a56cb

Browse files
committed
Inline mark_as_waiting_from.
It has a single call site, and the code is easier to read this way.
1 parent 4a7fb8b commit 85a56cb

File tree

1 file changed

+13
-12
lines changed
  • src/librustc_data_structures/obligation_forest

1 file changed

+13
-12
lines changed

src/librustc_data_structures/obligation_forest/mod.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,19 @@ impl<O: ForestObligation> ObligationForest<O> {
570570
#[inline(always)]
571571
fn inlined_mark_neighbors_as_waiting_from(&self, node: &Node<O>) {
572572
for &index in node.dependents.iter() {
573-
self.mark_as_waiting_from(&self.nodes[index]);
573+
let node = &self.nodes[index];
574+
match node.state.get() {
575+
NodeState::Waiting | NodeState::Error => {}
576+
NodeState::Success => {
577+
node.state.set(NodeState::Waiting);
578+
// This call site is cold.
579+
self.uninlined_mark_neighbors_as_waiting_from(node);
580+
}
581+
NodeState::Pending | NodeState::Done => {
582+
// This call site is cold.
583+
self.uninlined_mark_neighbors_as_waiting_from(node);
584+
}
585+
}
574586
}
575587
}
576588

@@ -596,17 +608,6 @@ impl<O: ForestObligation> ObligationForest<O> {
596608
}
597609
}
598610

599-
fn mark_as_waiting_from(&self, node: &Node<O>) {
600-
match node.state.get() {
601-
NodeState::Waiting | NodeState::Error => return,
602-
NodeState::Success => node.state.set(NodeState::Waiting),
603-
NodeState::Pending | NodeState::Done => {},
604-
}
605-
606-
// This call site is cold.
607-
self.uninlined_mark_neighbors_as_waiting_from(node);
608-
}
609-
610611
/// Compresses the vector, removing all popped nodes. This adjusts
611612
/// the indices and hence invalidates any outstanding
612613
/// indices. Cannot be used during a transaction.

0 commit comments

Comments
 (0)