Skip to content

Commit bcfbdb8

Browse files
Rename MIR local iterators to match convention
1 parent 3b0c318 commit bcfbdb8

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/librustc/mir/repr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<'tcx> Mir<'tcx> {
188188

189189
/// Returns an iterator over all temporaries.
190190
#[inline]
191-
pub fn temp_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
191+
pub fn temps_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
192192
(self.arg_count+1..self.local_decls.len()).filter_map(move |index| {
193193
let local = Local::new(index);
194194
if self.local_decls[local].source_info.is_none() {
@@ -201,7 +201,7 @@ impl<'tcx> Mir<'tcx> {
201201

202202
/// Returns an iterator over all user-declared locals.
203203
#[inline]
204-
pub fn var_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
204+
pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
205205
(self.arg_count+1..self.local_decls.len()).filter_map(move |index| {
206206
let local = Local::new(index);
207207
if self.local_decls[local].source_info.is_none() {
@@ -214,14 +214,14 @@ impl<'tcx> Mir<'tcx> {
214214

215215
/// Returns an iterator over all function arguments.
216216
#[inline]
217-
pub fn arg_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
217+
pub fn args_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
218218
(1..self.arg_count+1).map(Local::new)
219219
}
220220

221221
/// Returns an iterator over all user-defined variables and compiler-generated temporaries (all
222222
/// locals that are neither arguments nor the return pointer).
223223
#[inline]
224-
pub fn var_and_temp_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
224+
pub fn vars_and_temps_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a {
225225
(self.arg_count+1..self.local_decls.len()).map(Local::new)
226226
}
227227

src/librustc_borrowck/borrowck/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn drop_flag_effects_for_function_entry<'a, 'tcx, F>(
338338
where F: FnMut(MovePathIndex, DropFlagState)
339339
{
340340
let move_data = &ctxt.move_data;
341-
for arg in mir.arg_iter() {
341+
for arg in mir.args_iter() {
342342
let lvalue = repr::Lvalue::Local(arg);
343343
let lookup_result = move_data.rev_lookup.find(&lvalue);
344344
on_lookup_result_bits(tcx, mir, move_data,

src/librustc_mir/graphviz.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn write_graph_label<'a, 'tcx, W: Write>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
136136
write!(w, " label=<fn {}(", dot::escape_html(&tcx.node_path_str(nid)))?;
137137

138138
// fn argument types.
139-
for (i, arg) in mir.arg_iter().enumerate() {
139+
for (i, arg) in mir.args_iter().enumerate() {
140140
if i > 0 {
141141
write!(w, ", ")?;
142142
}
@@ -146,7 +146,7 @@ fn write_graph_label<'a, 'tcx, W: Write>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
146146
write!(w, ") -&gt; {}", escape(mir.return_ty))?;
147147
write!(w, r#"<br align="left"/>"#)?;
148148

149-
for local in mir.var_and_temp_iter() {
149+
for local in mir.vars_and_temps_iter() {
150150
let decl = &mir.local_decls[local];
151151

152152
write!(w, "let ")?;

src/librustc_mir/pretty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn write_scope_tree(tcx: TyCtxt,
237237
writeln!(w, "{0:1$}scope {2} {{", "", indent, child.index())?;
238238

239239
// User variable types (including the user's name in a comment).
240-
for local in mir.var_iter() {
240+
for local in mir.vars_iter() {
241241
let var = &mir.local_decls[local];
242242
let (name, source_info) = if var.source_info.unwrap().scope == child {
243243
(var.name.unwrap(), var.source_info.unwrap())
@@ -333,7 +333,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write)
333333
write!(w, "(")?;
334334

335335
// fn argument types.
336-
for (i, arg) in mir.arg_iter().enumerate() {
336+
for (i, arg) in mir.args_iter().enumerate() {
337337
if i != 0 {
338338
write!(w, ", ")?;
339339
}
@@ -349,7 +349,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write)
349349

350350
fn write_temp_decls(mir: &Mir, w: &mut Write) -> io::Result<()> {
351351
// Compiler-introduced temporary types.
352-
for temp in mir.temp_iter() {
352+
for temp in mir.temps_iter() {
353353
writeln!(w, "{}let mut {:?}: {};", INDENT, temp, mir.local_decls[temp].ty)?;
354354
}
355355

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
410410
TerminatorKind::Return => {
411411
// Check for unused values. This usually means
412412
// there are extra statements in the AST.
413-
for temp in mir.temp_iter() {
413+
for temp in mir.temps_iter() {
414414
if self.temp_qualif[temp].is_none() {
415415
continue;
416416
}
@@ -435,7 +435,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
435435

436436
// Make sure there are no extra unassigned variables.
437437
self.qualif = Qualif::NOT_CONST;
438-
for index in mir.var_iter() {
438+
for index in mir.vars_iter() {
439439
if !self.const_fn_arg_vars.contains(index.index()) {
440440
debug!("unassigned variable {:?}", index);
441441
self.assign(&Lvalue::Local(index), Location {

src/librustc_trans/debuginfo/create_scope_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn create_mir_scopes(fcx: &FunctionContext) -> IndexVec<VisibilityScope, Mir
6363

6464
// Find all the scopes with variables defined in them.
6565
let mut has_variables = BitVector::new(mir.visibility_scopes.len());
66-
for var in mir.var_iter() {
66+
for var in mir.vars_iter() {
6767
let decl = &mir.local_decls[var];
6868
has_variables.insert(decl.source_info.unwrap().scope.index());
6969
}

src/librustc_trans/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>) {
290290
let retptr = allocate_local(mir::RETURN_POINTER);
291291
iter::once(retptr)
292292
.chain(args.into_iter())
293-
.chain(mir.var_and_temp_iter().map(&mut allocate_local))
293+
.chain(mir.vars_and_temps_iter().map(&mut allocate_local))
294294
.collect()
295295
};
296296

@@ -356,7 +356,7 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>,
356356
None
357357
};
358358

359-
mir.arg_iter().enumerate().map(|(arg_index, local)| {
359+
mir.args_iter().enumerate().map(|(arg_index, local)| {
360360
let arg_decl = &mir.local_decls[local];
361361
let arg_ty = bcx.monomorphize(&arg_decl.ty);
362362

0 commit comments

Comments
 (0)