1
Fork 0

Split {Idx, IndexVec, IndexSlice} into their own modules

This commit is contained in:
Maybe Waffle 2023-04-19 10:57:17 +00:00
parent 64bcb32651
commit e496fbec92
150 changed files with 472 additions and 454 deletions

View file

@ -10,7 +10,7 @@ use crate::def_path_hash_map::DefPathHashMap;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{Hash64, StableHasher};
use rustc_index::vec::IndexVec;
use rustc_index::IndexVec;
use rustc_span::symbol::{kw, sym, Symbol};
use std::fmt::{self, Write};

View file

@ -14,7 +14,7 @@ use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_error_messages::MultiSpan;
use rustc_index::vec::IndexVec;
use rustc_index::IndexVec;
use rustc_macros::HashStable_Generic;
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::Spanned;
@ -863,7 +863,7 @@ pub struct OwnerNodes<'tcx> {
impl<'tcx> OwnerNodes<'tcx> {
pub fn node(&self) -> OwnerNode<'tcx> {
use rustc_index::vec::Idx;
use rustc_index::Idx;
let node = self.nodes[ItemLocalId::new(0)].as_ref().unwrap().node;
let node = node.as_owner().unwrap(); // Indexing must ensure it is an OwnerNode.
node

View file

@ -35,7 +35,7 @@ impl OwnerId {
}
}
impl rustc_index::vec::Idx for OwnerId {
impl rustc_index::Idx for OwnerId {
#[inline]
fn new(idx: usize) -> Self {
OwnerId { def_id: LocalDefId { local_def_index: DefIndex::from_usize(idx) } }
@ -116,10 +116,7 @@ impl HirId {
}
pub fn index(self) -> (usize, usize) {
(
rustc_index::vec::Idx::index(self.owner.def_id),
rustc_index::vec::Idx::index(self.local_id),
)
(rustc_index::Idx::index(self.owner.def_id), rustc_index::Idx::index(self.local_id))
}
}