Skip to content

Commit 7bf60b7

Browse files
committed
Rollup merge of #51203 - nnethercote:obligations-2, r=michaelwoerister
Two minor `obligation_forest` tweaks. Pretty minimal improvements, but improvements nonetheless.
2 parents 874b623 + b43f76e commit 7bf60b7

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/librustc_data_structures/obligation_forest/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ pub struct ObligationForest<O: ForestObligation> {
7575
done_cache: FxHashSet<O::Predicate>,
7676
/// An cache of the nodes in `nodes`, indexed by predicate.
7777
waiting_cache: FxHashMap<O::Predicate, NodeIndex>,
78-
/// A list of the obligations added in snapshots, to allow
79-
/// for their removal.
80-
cache_list: Vec<O::Predicate>,
8178
scratch: Option<Vec<usize>>,
8279
}
8380

@@ -158,7 +155,6 @@ impl<O: ForestObligation> ObligationForest<O> {
158155
nodes: vec![],
159156
done_cache: FxHashSet(),
160157
waiting_cache: FxHashMap(),
161-
cache_list: vec![],
162158
scratch: Some(vec![]),
163159
}
164160
}
@@ -207,7 +203,6 @@ impl<O: ForestObligation> ObligationForest<O> {
207203
debug!("register_obligation_at({:?}, {:?}) - ok, new index is {}",
208204
obligation, parent, self.nodes.len());
209205
v.insert(NodeIndex::new(self.nodes.len()));
210-
self.cache_list.push(obligation.as_predicate().clone());
211206
self.nodes.push(Node::new(parent, obligation));
212207
Ok(())
213208
}

src/librustc_data_structures/obligation_forest/node_index.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ pub struct NodeIndex {
1717
}
1818

1919
impl NodeIndex {
20+
#[inline]
2021
pub fn new(value: usize) -> NodeIndex {
2122
assert!(value < (u32::MAX as usize));
2223
NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() }
2324
}
2425

26+
#[inline]
2527
pub fn get(self) -> usize {
2628
(self.index.get() - 1) as usize
2729
}

0 commit comments

Comments
 (0)