Skip to content

Commit adddafa

Browse files
committed
rename IdxVec => IndexVec
1 parent 9a2e61d commit adddafa

File tree

14 files changed

+123
-123
lines changed

14 files changed

+123
-123
lines changed

src/librustc/mir/cache.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
// except according to those terms.
1010

1111
use std::cell::{Ref, RefCell};
12-
use rustc_data_structures::indexed_vec::IdxVec;
12+
use rustc_data_structures::indexed_vec::IndexVec;
1313

1414
use mir::repr::{Mir, BasicBlock};
1515

1616
use rustc_serialize as serialize;
1717

1818
#[derive(Clone)]
1919
pub struct Cache {
20-
predecessors: RefCell<Option<IdxVec<BasicBlock, Vec<BasicBlock>>>>
20+
predecessors: RefCell<Option<IndexVec<BasicBlock, Vec<BasicBlock>>>>
2121
}
2222

2323

@@ -46,7 +46,7 @@ impl Cache {
4646
*self.predecessors.borrow_mut() = None;
4747
}
4848

49-
pub fn predecessors(&self, mir: &Mir) -> Ref<IdxVec<BasicBlock, Vec<BasicBlock>>> {
49+
pub fn predecessors(&self, mir: &Mir) -> Ref<IndexVec<BasicBlock, Vec<BasicBlock>>> {
5050
if self.predecessors.borrow().is_none() {
5151
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
5252
}
@@ -55,8 +55,8 @@ impl Cache {
5555
}
5656
}
5757

58-
fn calculate_predecessors(mir: &Mir) -> IdxVec<BasicBlock, Vec<BasicBlock>> {
59-
let mut result = IdxVec::from_elem(vec![], mir.basic_blocks());
58+
fn calculate_predecessors(mir: &Mir) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
59+
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
6060
for (bb, data) in mir.basic_blocks().iter_enumerated() {
6161
if let Some(ref term) = data.terminator {
6262
for &tgt in term.successors().iter() {

src/librustc/mir/repr.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use graphviz::IntoCow;
1212
use middle::const_val::ConstVal;
1313
use rustc_const_math::{ConstUsize, ConstInt, ConstMathErr};
14-
use rustc_data_structures::indexed_vec::{IdxVec, Idx};
14+
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
1515
use hir::def_id::DefId;
1616
use ty::subst::Substs;
1717
use ty::{self, AdtDef, ClosureSubsts, FnOutput, Region, Ty};
@@ -58,32 +58,32 @@ macro_rules! newtype_index {
5858
pub struct Mir<'tcx> {
5959
/// List of basic blocks. References to basic block use a newtyped index type `BasicBlock`
6060
/// that indexes into this vector.
61-
basic_blocks: IdxVec<BasicBlock, BasicBlockData<'tcx>>,
61+
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
6262

6363
/// List of lexical scopes; these are referenced by statements and
6464
/// used (eventually) for debuginfo. Indexed by a `ScopeId`.
65-
pub scopes: IdxVec<ScopeId, ScopeData>,
65+
pub scopes: IndexVec<ScopeId, ScopeData>,
6666

6767
/// Rvalues promoted from this function, such as borrows of constants.
6868
/// Each of them is the Mir of a constant with the fn's type parameters
6969
/// in scope, but no vars or args and a separate set of temps.
70-
pub promoted: IdxVec<Promoted, Mir<'tcx>>,
70+
pub promoted: IndexVec<Promoted, Mir<'tcx>>,
7171

7272
/// Return type of the function.
7373
pub return_ty: FnOutput<'tcx>,
7474

7575
/// Variables: these are stack slots corresponding to user variables. They may be
7676
/// assigned many times.
77-
pub var_decls: IdxVec<Var, VarDecl<'tcx>>,
77+
pub var_decls: IndexVec<Var, VarDecl<'tcx>>,
7878

7979
/// Args: these are stack slots corresponding to the input arguments.
80-
pub arg_decls: IdxVec<Arg, ArgDecl<'tcx>>,
80+
pub arg_decls: IndexVec<Arg, ArgDecl<'tcx>>,
8181

8282
/// Temp declarations: stack slots that for temporaries created by
8383
/// the compiler. These are assigned once, but they are not SSA
8484
/// values in that it is possible to borrow them and mutate them
8585
/// through the resulting reference.
86-
pub temp_decls: IdxVec<Temp, TempDecl<'tcx>>,
86+
pub temp_decls: IndexVec<Temp, TempDecl<'tcx>>,
8787

8888
/// Names and capture modes of all the closure upvars, assuming
8989
/// the first argument is either the closure or a reference to it.
@@ -100,13 +100,13 @@ pub struct Mir<'tcx> {
100100
pub const START_BLOCK: BasicBlock = BasicBlock(0);
101101

102102
impl<'tcx> Mir<'tcx> {
103-
pub fn new(basic_blocks: IdxVec<BasicBlock, BasicBlockData<'tcx>>,
104-
scopes: IdxVec<ScopeId, ScopeData>,
105-
promoted: IdxVec<Promoted, Mir<'tcx>>,
103+
pub fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
104+
scopes: IndexVec<ScopeId, ScopeData>,
105+
promoted: IndexVec<Promoted, Mir<'tcx>>,
106106
return_ty: FnOutput<'tcx>,
107-
var_decls: IdxVec<Var, VarDecl<'tcx>>,
108-
arg_decls: IdxVec<Arg, ArgDecl<'tcx>>,
109-
temp_decls: IdxVec<Temp, TempDecl<'tcx>>,
107+
var_decls: IndexVec<Var, VarDecl<'tcx>>,
108+
arg_decls: IndexVec<Arg, ArgDecl<'tcx>>,
109+
temp_decls: IndexVec<Temp, TempDecl<'tcx>>,
110110
upvar_decls: Vec<UpvarDecl>,
111111
span: Span) -> Self
112112
{
@@ -125,18 +125,18 @@ impl<'tcx> Mir<'tcx> {
125125
}
126126

127127
#[inline]
128-
pub fn basic_blocks(&self) -> &IdxVec<BasicBlock, BasicBlockData<'tcx>> {
128+
pub fn basic_blocks(&self) -> &IndexVec<BasicBlock, BasicBlockData<'tcx>> {
129129
&self.basic_blocks
130130
}
131131

132132
#[inline]
133-
pub fn basic_blocks_mut(&mut self) -> &mut IdxVec<BasicBlock, BasicBlockData<'tcx>> {
133+
pub fn basic_blocks_mut(&mut self) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>> {
134134
self.cache.invalidate();
135135
&mut self.basic_blocks
136136
}
137137

138138
#[inline]
139-
pub fn predecessors(&self) -> Ref<IdxVec<BasicBlock, Vec<BasicBlock>>> {
139+
pub fn predecessors(&self) -> Ref<IndexVec<BasicBlock, Vec<BasicBlock>>> {
140140
self.cache.predecessors(self)
141141
}
142142

src/librustc_borrowck/borrowck/mir/gather_moves.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use rustc::ty::{FnOutput, TyCtxt};
1313
use rustc::mir::repr::*;
1414
use rustc::util::nodemap::FnvHashMap;
15-
use rustc_data_structures::indexed_vec::{Idx, IdxVec};
15+
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
1616

1717
use std::cell::{Cell};
1818
use std::collections::hash_map::Entry;
@@ -240,9 +240,9 @@ struct MovePathDataBuilder<'a, 'tcx: 'a> {
240240
/// Tables mapping from an l-value to its MovePathIndex.
241241
#[derive(Debug)]
242242
pub struct MovePathLookup<'tcx> {
243-
vars: IdxVec<Var, Option<MovePathIndex>>,
244-
temps: IdxVec<Temp, Option<MovePathIndex>>,
245-
args: IdxVec<Arg, Option<MovePathIndex>>,
243+
vars: IndexVec<Var, Option<MovePathIndex>>,
244+
temps: IndexVec<Temp, Option<MovePathIndex>>,
245+
args: IndexVec<Arg, Option<MovePathIndex>>,
246246

247247
/// The move path representing the return value is constructed
248248
/// lazily when we first encounter it in the input MIR.
@@ -297,9 +297,9 @@ impl Lookup<MovePathIndex> {
297297
impl<'tcx> MovePathLookup<'tcx> {
298298
fn new(mir: &Mir) -> Self {
299299
MovePathLookup {
300-
vars: IdxVec::from_elem(None, &mir.var_decls),
301-
temps: IdxVec::from_elem(None, &mir.temp_decls),
302-
args: IdxVec::from_elem(None, &mir.arg_decls),
300+
vars: IndexVec::from_elem(None, &mir.var_decls),
301+
temps: IndexVec::from_elem(None, &mir.temp_decls),
302+
args: IndexVec::from_elem(None, &mir.arg_decls),
303303
statics: None,
304304
return_ptr: None,
305305
projections: vec![],
@@ -313,7 +313,7 @@ impl<'tcx> MovePathLookup<'tcx> {
313313
i
314314
}
315315

316-
fn lookup_or_generate<I: Idx>(vec: &mut IdxVec<I, Option<MovePathIndex>>,
316+
fn lookup_or_generate<I: Idx>(vec: &mut IndexVec<I, Option<MovePathIndex>>,
317317
idx: I,
318318
next_index: &mut MovePathIndex)
319319
-> Lookup<MovePathIndex> {

src/librustc_borrowck/borrowck/mir/patch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
use super::gather_moves::Location;
1212
use rustc::ty::Ty;
1313
use rustc::mir::repr::*;
14-
use rustc_data_structures::indexed_vec::{IdxVec, Idx};
14+
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
1515
use syntax::codemap::Span;
1616

1717
/// This struct represents a patch to MIR, which can add
1818
/// new statements and basic blocks and patch over block
1919
/// terminators.
2020
pub struct MirPatch<'tcx> {
21-
patch_map: IdxVec<BasicBlock, Option<TerminatorKind<'tcx>>>,
21+
patch_map: IndexVec<BasicBlock, Option<TerminatorKind<'tcx>>>,
2222
new_blocks: Vec<BasicBlockData<'tcx>>,
2323
new_statements: Vec<(Location, StatementKind<'tcx>)>,
2424
new_temps: Vec<TempDecl<'tcx>>,
@@ -29,7 +29,7 @@ pub struct MirPatch<'tcx> {
2929
impl<'tcx> MirPatch<'tcx> {
3030
pub fn new(mir: &Mir<'tcx>) -> Self {
3131
let mut result = MirPatch {
32-
patch_map: IdxVec::from_elem(None, mir.basic_blocks()),
32+
patch_map: IndexVec::from_elem(None, mir.basic_blocks()),
3333
new_blocks: vec![],
3434
new_temps: vec![],
3535
new_statements: vec![],

src/librustc_data_structures/indexed_vec.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,49 @@ impl Idx for usize {
3131
}
3232

3333
#[derive(Clone)]
34-
pub struct IdxVec<I: Idx, T> {
34+
pub struct IndexVec<I: Idx, T> {
3535
pub raw: Vec<T>,
3636
_marker: PhantomData<Fn(&I)>
3737
}
3838

39-
impl<I: Idx, T: serialize::Encodable> serialize::Encodable for IdxVec<I, T> {
39+
impl<I: Idx, T: serialize::Encodable> serialize::Encodable for IndexVec<I, T> {
4040
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
4141
serialize::Encodable::encode(&self.raw, s)
4242
}
4343
}
4444

45-
impl<I: Idx, T: serialize::Decodable> serialize::Decodable for IdxVec<I, T> {
45+
impl<I: Idx, T: serialize::Decodable> serialize::Decodable for IndexVec<I, T> {
4646
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
4747
serialize::Decodable::decode(d).map(|v| {
48-
IdxVec { raw: v, _marker: PhantomData }
48+
IndexVec { raw: v, _marker: PhantomData }
4949
})
5050
}
5151
}
5252

53-
impl<I: Idx, T: fmt::Debug> fmt::Debug for IdxVec<I, T> {
53+
impl<I: Idx, T: fmt::Debug> fmt::Debug for IndexVec<I, T> {
5454
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
5555
fmt::Debug::fmt(&self.raw, fmt)
5656
}
5757
}
5858

5959
pub type Enumerated<I, J> = iter::Map<iter::Enumerate<J>, IntoIdx<I>>;
6060

61-
impl<I: Idx, T> IdxVec<I, T> {
61+
impl<I: Idx, T> IndexVec<I, T> {
6262
#[inline]
6363
pub fn new() -> Self {
64-
IdxVec { raw: Vec::new(), _marker: PhantomData }
64+
IndexVec { raw: Vec::new(), _marker: PhantomData }
6565
}
6666

6767
#[inline]
6868
pub fn with_capacity(capacity: usize) -> Self {
69-
IdxVec { raw: Vec::with_capacity(capacity), _marker: PhantomData }
69+
IndexVec { raw: Vec::with_capacity(capacity), _marker: PhantomData }
7070
}
7171

7272
#[inline]
73-
pub fn from_elem<S>(elem: T, universe: &IdxVec<I, S>) -> Self
73+
pub fn from_elem<S>(elem: T, universe: &IndexVec<I, S>) -> Self
7474
where T: Clone
7575
{
76-
IdxVec { raw: vec![elem; universe.len()], _marker: PhantomData }
76+
IndexVec { raw: vec![elem; universe.len()], _marker: PhantomData }
7777
}
7878

7979
#[inline]
@@ -137,7 +137,7 @@ impl<I: Idx, T> IdxVec<I, T> {
137137
}
138138
}
139139

140-
impl<I: Idx, T> Index<I> for IdxVec<I, T> {
140+
impl<I: Idx, T> Index<I> for IndexVec<I, T> {
141141
type Output = T;
142142

143143
#[inline]
@@ -146,28 +146,28 @@ impl<I: Idx, T> Index<I> for IdxVec<I, T> {
146146
}
147147
}
148148

149-
impl<I: Idx, T> IndexMut<I> for IdxVec<I, T> {
149+
impl<I: Idx, T> IndexMut<I> for IndexVec<I, T> {
150150
#[inline]
151151
fn index_mut(&mut self, index: I) -> &mut T {
152152
&mut self.raw[index.index()]
153153
}
154154
}
155155

156-
impl<I: Idx, T> Extend<T> for IdxVec<I, T> {
156+
impl<I: Idx, T> Extend<T> for IndexVec<I, T> {
157157
#[inline]
158158
fn extend<J: IntoIterator<Item = T>>(&mut self, iter: J) {
159159
self.raw.extend(iter);
160160
}
161161
}
162162

163-
impl<I: Idx, T> FromIterator<T> for IdxVec<I, T> {
163+
impl<I: Idx, T> FromIterator<T> for IndexVec<I, T> {
164164
#[inline]
165165
fn from_iter<J>(iter: J) -> Self where J: IntoIterator<Item=T> {
166-
IdxVec { raw: FromIterator::from_iter(iter), _marker: PhantomData }
166+
IndexVec { raw: FromIterator::from_iter(iter), _marker: PhantomData }
167167
}
168168
}
169169

170-
impl<I: Idx, T> IntoIterator for IdxVec<I, T> {
170+
impl<I: Idx, T> IntoIterator for IndexVec<I, T> {
171171
type Item = T;
172172
type IntoIter = vec::IntoIter<T>;
173173

@@ -178,7 +178,7 @@ impl<I: Idx, T> IntoIterator for IdxVec<I, T> {
178178

179179
}
180180

181-
impl<'a, I: Idx, T> IntoIterator for &'a IdxVec<I, T> {
181+
impl<'a, I: Idx, T> IntoIterator for &'a IndexVec<I, T> {
182182
type Item = &'a T;
183183
type IntoIter = slice::Iter<'a, T>;
184184

@@ -188,7 +188,7 @@ impl<'a, I: Idx, T> IntoIterator for &'a IdxVec<I, T> {
188188
}
189189
}
190190

191-
impl<'a, I: Idx, T> IntoIterator for &'a mut IdxVec<I, T> {
191+
impl<'a, I: Idx, T> IntoIterator for &'a mut IndexVec<I, T> {
192192
type Item = &'a mut T;
193193
type IntoIter = slice::IterMut<'a, T>;
194194

0 commit comments

Comments
 (0)