Skip to content

Commit a4162d9

Browse files
committed
Change DepNodeColorMap::insert to insert_red.
Because it's only ever used for inserting red. (`None` is only used as a starting value, and `Green` is inserted by `try_mark_green` and friends.)
1 parent f644f2c commit a4162d9

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

compiler/rustc_query_system/src/dep_graph/graph.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,9 @@ impl<D: Deps> DepGraph<D> {
148148
);
149149
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
150150
if prev_graph_node_count > 0 {
151-
colors.insert(
152-
SerializedDepNodeIndex::from_u32(DepNodeIndex::FOREVER_RED_NODE.as_u32()),
153-
DepNodeColor::Red,
154-
);
151+
colors.insert_red(SerializedDepNodeIndex::from_u32(
152+
DepNodeIndex::FOREVER_RED_NODE.as_u32(),
153+
));
155154
}
156155

157156
DepGraph {
@@ -1384,14 +1383,8 @@ impl DepNodeColorMap {
13841383
}
13851384

13861385
#[inline]
1387-
pub(super) fn insert(&self, index: SerializedDepNodeIndex, color: DepNodeColor) {
1388-
self.values[index].store(
1389-
match color {
1390-
DepNodeColor::Red => COMPRESSED_RED,
1391-
DepNodeColor::Green(index) => index.as_u32(),
1392-
},
1393-
Ordering::Release,
1394-
)
1386+
pub(super) fn insert_red(&self, index: SerializedDepNodeIndex) {
1387+
self.values[index].store(COMPRESSED_RED, Ordering::Release)
13951388
}
13961389
}
13971390

compiler/rustc_query_system/src/dep_graph/serialized.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
5959
use rustc_session::Session;
6060
use tracing::{debug, instrument};
6161

62-
use super::graph::{CurrentDepGraph, DepNodeColor, DepNodeColorMap};
62+
use super::graph::{CurrentDepGraph, DepNodeColorMap};
6363
use super::query::DepGraphQuery;
6464
use super::{DepKind, DepNode, DepNodeIndex, Deps};
6565
use crate::dep_graph::edges::EdgesVec;
@@ -906,7 +906,7 @@ impl<D: Deps> GraphEncoder<D> {
906906
Err(dep_node_index) => return dep_node_index,
907907
}
908908
} else {
909-
colors.insert(prev_index, DepNodeColor::Red);
909+
colors.insert_red(prev_index);
910910
}
911911

912912
self.status.bump_index(&mut *local);

0 commit comments

Comments
 (0)