Skip to content

Commit 4dec2a8

Browse files
committed
rustc: Fix a borrow mut error with debug assertions
1 parent 4af1284 commit 4dec2a8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,13 @@ impl DepGraph {
235235
debug_str_gen: F)
236236
where F: FnOnce() -> String
237237
{
238-
let mut dep_node_debug = self.data.as_ref().unwrap().dep_node_debug.borrow_mut();
238+
let dep_node_debug = &self.data.as_ref().unwrap().dep_node_debug;
239239

240-
dep_node_debug.entry(dep_node)
241-
.or_insert_with(debug_str_gen);
240+
if dep_node_debug.borrow().contains_key(&dep_node) {
241+
return
242+
}
243+
let debug_str = debug_str_gen();
244+
dep_node_debug.borrow_mut().insert(dep_node, debug_str);
242245
}
243246

244247
pub(super) fn dep_node_debug_str(&self, dep_node: DepNode) -> Option<String> {

0 commit comments

Comments
 (0)