rustc: Fix a borrow mut error with debug assertions

This commit is contained in:
Alex Crichton 2017-08-30 11:53:57 -07:00
parent 4af1284053
commit 4dec2a8f81

View File

@ -235,10 +235,13 @@ impl DepGraph {
debug_str_gen: F) debug_str_gen: F)
where F: FnOnce() -> String where F: FnOnce() -> String
{ {
let mut dep_node_debug = self.data.as_ref().unwrap().dep_node_debug.borrow_mut(); let dep_node_debug = &self.data.as_ref().unwrap().dep_node_debug;
dep_node_debug.entry(dep_node) if dep_node_debug.borrow().contains_key(&dep_node) {
.or_insert_with(debug_str_gen); return
}
let debug_str = debug_str_gen();
dep_node_debug.borrow_mut().insert(dep_node, debug_str);
} }
pub(super) fn dep_node_debug_str(&self, dep_node: DepNode) -> Option<String> { pub(super) fn dep_node_debug_str(&self, dep_node: DepNode) -> Option<String> {