|
74 | 74 |
|
75 | 75 | use crate::fx::{FxHashMap, FxHashSet}; |
76 | 76 |
|
77 | | -use std::cell::{Cell, RefCell}; |
| 77 | +use std::cell::Cell; |
78 | 78 | use std::collections::hash_map::Entry; |
79 | 79 | use std::fmt::Debug; |
80 | 80 | use std::hash; |
@@ -146,7 +146,7 @@ pub struct ObligationForest<O: ForestObligation> { |
146 | 146 | active_cache: FxHashMap<O::Predicate, usize>, |
147 | 147 |
|
148 | 148 | /// A vector reused in compress(), to avoid allocating new vectors. |
149 | | - node_rewrites: RefCell<Vec<usize>>, |
| 149 | + node_rewrites: Vec<usize>, |
150 | 150 |
|
151 | 151 | obligation_tree_id_generator: ObligationTreeIdGenerator, |
152 | 152 |
|
@@ -285,7 +285,7 @@ impl<O: ForestObligation> ObligationForest<O> { |
285 | 285 | nodes: vec![], |
286 | 286 | done_cache: Default::default(), |
287 | 287 | active_cache: Default::default(), |
288 | | - node_rewrites: RefCell::new(vec![]), |
| 288 | + node_rewrites: vec![], |
289 | 289 | obligation_tree_id_generator: (0..).map(ObligationTreeId), |
290 | 290 | error_cache: Default::default(), |
291 | 291 | } |
@@ -590,7 +590,7 @@ impl<O: ForestObligation> ObligationForest<O> { |
590 | 590 | #[inline(never)] |
591 | 591 | fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>> { |
592 | 592 | let orig_nodes_len = self.nodes.len(); |
593 | | - let mut node_rewrites: Vec<_> = self.node_rewrites.replace(vec![]); |
| 593 | + let mut node_rewrites: Vec<_> = std::mem::take(&mut self.node_rewrites); |
594 | 594 | debug_assert!(node_rewrites.is_empty()); |
595 | 595 | node_rewrites.extend(0..orig_nodes_len); |
596 | 596 | let mut dead_nodes = 0; |
@@ -651,7 +651,7 @@ impl<O: ForestObligation> ObligationForest<O> { |
651 | 651 | } |
652 | 652 |
|
653 | 653 | node_rewrites.truncate(0); |
654 | | - self.node_rewrites.replace(node_rewrites); |
| 654 | + self.node_rewrites = node_rewrites; |
655 | 655 |
|
656 | 656 | if do_completed == DoCompleted::Yes { Some(removed_done_obligations) } else { None } |
657 | 657 | } |
|
0 commit comments