|
1 |
| -use rustc_data_structures::fx::FxHashMap; |
| 1 | +use rustc_data_structures::fx::FxIndexSet; |
2 | 2 | use rustc_index::bit_set::{HybridBitSet, SparseBitMatrix};
|
3 | 3 | use rustc_index::vec::Idx;
|
4 | 4 | use rustc_index::vec::IndexVec;
|
@@ -193,26 +193,25 @@ impl<N: Idx> LivenessValues<N> {
|
193 | 193 | /// NLL.
|
194 | 194 | #[derive(Default)]
|
195 | 195 | crate struct PlaceholderIndices {
|
196 |
| - to_index: FxHashMap<ty::PlaceholderRegion, PlaceholderIndex>, |
197 |
| - from_index: IndexVec<PlaceholderIndex, ty::PlaceholderRegion>, |
| 196 | + indices: FxIndexSet<ty::PlaceholderRegion>, |
198 | 197 | }
|
199 | 198 |
|
200 | 199 | impl PlaceholderIndices {
|
201 | 200 | crate fn insert(&mut self, placeholder: ty::PlaceholderRegion) -> PlaceholderIndex {
|
202 |
| - let PlaceholderIndices { to_index, from_index } = self; |
203 |
| - *to_index.entry(placeholder).or_insert_with(|| from_index.push(placeholder)) |
| 201 | + let (index, _) = self.indices.insert_full(placeholder); |
| 202 | + index.into() |
204 | 203 | }
|
205 | 204 |
|
206 | 205 | crate fn lookup_index(&self, placeholder: ty::PlaceholderRegion) -> PlaceholderIndex {
|
207 |
| - self.to_index[&placeholder] |
| 206 | + self.indices.get_index_of(&placeholder).unwrap().into() |
208 | 207 | }
|
209 | 208 |
|
210 | 209 | crate fn lookup_placeholder(&self, placeholder: PlaceholderIndex) -> ty::PlaceholderRegion {
|
211 |
| - self.from_index[placeholder] |
| 210 | + self.indices[placeholder.index()] |
212 | 211 | }
|
213 | 212 |
|
214 | 213 | crate fn len(&self) -> usize {
|
215 |
| - self.from_index.len() |
| 214 | + self.indices.len() |
216 | 215 | }
|
217 | 216 | }
|
218 | 217 |
|
|
0 commit comments