Remove RefCell usage from ObligationForest.
It's not needed.
This commit is contained in:
parent
002287d25f
commit
6ad725e9f0
1 changed files with 5 additions and 5 deletions
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
use crate::fx::{FxHashMap, FxHashSet};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cell::Cell;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::fmt::Debug;
|
||||
use std::hash;
|
||||
|
|
@ -146,7 +146,7 @@ pub struct ObligationForest<O: ForestObligation> {
|
|||
active_cache: FxHashMap<O::Predicate, usize>,
|
||||
|
||||
/// A vector reused in compress(), to avoid allocating new vectors.
|
||||
node_rewrites: RefCell<Vec<usize>>,
|
||||
node_rewrites: Vec<usize>,
|
||||
|
||||
obligation_tree_id_generator: ObligationTreeIdGenerator,
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
|||
nodes: vec![],
|
||||
done_cache: Default::default(),
|
||||
active_cache: Default::default(),
|
||||
node_rewrites: RefCell::new(vec![]),
|
||||
node_rewrites: vec![],
|
||||
obligation_tree_id_generator: (0..).map(ObligationTreeId),
|
||||
error_cache: Default::default(),
|
||||
}
|
||||
|
|
@ -590,7 +590,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
|||
#[inline(never)]
|
||||
fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>> {
|
||||
let orig_nodes_len = self.nodes.len();
|
||||
let mut node_rewrites: Vec<_> = self.node_rewrites.replace(vec![]);
|
||||
let mut node_rewrites: Vec<_> = std::mem::take(&mut self.node_rewrites);
|
||||
debug_assert!(node_rewrites.is_empty());
|
||||
node_rewrites.extend(0..orig_nodes_len);
|
||||
let mut dead_nodes = 0;
|
||||
|
|
@ -651,7 +651,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
|||
}
|
||||
|
||||
node_rewrites.truncate(0);
|
||||
self.node_rewrites.replace(node_rewrites);
|
||||
self.node_rewrites = node_rewrites;
|
||||
|
||||
if do_completed == DoCompleted::Yes { Some(removed_done_obligations) } else { None }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue