From f46d0213e4825633f182d9b9026b96a7358a1e93 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 30 May 2018 11:36:31 +1000 Subject: [PATCH 1/2] Remove `ObligationForest::cache_list`. It's never used in a meaningful way. --- src/librustc_data_structures/obligation_forest/mod.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 42a17d33fa6f5..612f44f09cf65 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -75,9 +75,6 @@ pub struct ObligationForest { done_cache: FxHashSet, /// An cache of the nodes in `nodes`, indexed by predicate. waiting_cache: FxHashMap, - /// A list of the obligations added in snapshots, to allow - /// for their removal. - cache_list: Vec, scratch: Option>, } @@ -158,7 +155,6 @@ impl ObligationForest { nodes: vec![], done_cache: FxHashSet(), waiting_cache: FxHashMap(), - cache_list: vec![], scratch: Some(vec![]), } } @@ -207,7 +203,6 @@ impl ObligationForest { debug!("register_obligation_at({:?}, {:?}) - ok, new index is {}", obligation, parent, self.nodes.len()); v.insert(NodeIndex::new(self.nodes.len())); - self.cache_list.push(obligation.as_predicate().clone()); self.nodes.push(Node::new(parent, obligation)); Ok(()) } From a5ffcf6dd830367ccd9b0924c1a1f052330173a2 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 30 May 2018 16:58:48 +1000 Subject: [PATCH 2/2] Inline `NodeIndex` methods. Because they are small and hot. --- src/librustc_data_structures/obligation_forest/node_index.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs index 37512e4bcd57f..d89bd22ec9637 100644 --- a/src/librustc_data_structures/obligation_forest/node_index.rs +++ b/src/librustc_data_structures/obligation_forest/node_index.rs @@ -17,11 +17,13 @@ pub struct NodeIndex { } impl NodeIndex { + #[inline] pub fn new(value: usize) -> NodeIndex { assert!(value < (u32::MAX as usize)); NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() } } + #[inline] pub fn get(self) -> usize { (self.index.get() - 1) as usize }