Skip to content

Commit 1fec51c

Browse files
committed
Remove DepNodeColorMap::insert_red
This method is only used to initialize the always-red node, which can be done with `try_set_color` instead.
1 parent e19ad08 commit 1fec51c

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

  • compiler/rustc_middle/src/dep_graph

compiler/rustc_middle/src/dep_graph/graph.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ impl DepGraph {
164164
);
165165
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
166166
if prev_graph_node_count > 0 {
167-
colors.insert_red(SerializedDepNodeIndex::from_u32(
168-
DepNodeIndex::FOREVER_RED_NODE.as_u32(),
169-
));
167+
let prev_index =
168+
const { SerializedDepNodeIndex::from_u32(DepNodeIndex::FOREVER_RED_NODE.as_u32()) };
169+
let result = colors.try_set_color(prev_index, DesiredColor::Red);
170+
assert_matches!(result, TrySetColorResult::Success);
170171
}
171172

172173
DepGraph {
@@ -1455,13 +1456,6 @@ impl DepNodeColorMap {
14551456
DepNodeColor::Unknown
14561457
}
14571458
}
1458-
1459-
#[inline]
1460-
pub(super) fn insert_red(&self, index: SerializedDepNodeIndex) {
1461-
let value = self.values[index].swap(COMPRESSED_RED, Ordering::Release);
1462-
// Sanity check for duplicate nodes
1463-
assert_eq!(value, COMPRESSED_UNKNOWN, "tried to color an already colored node as red");
1464-
}
14651459
}
14661460

14671461
/// The color that [`DepNodeColorMap::try_set_color`] should try to apply to a node.

0 commit comments

Comments
 (0)