From bcfbdb871fa1cf1083687ac4b5e57acc8039f637 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 26 Sep 2016 22:50:03 +0200 Subject: [PATCH] Rename MIR local iterators to match convention --- src/librustc/mir/repr.rs | 8 ++++---- src/librustc_borrowck/borrowck/mir/mod.rs | 2 +- src/librustc_mir/graphviz.rs | 4 ++-- src/librustc_mir/pretty.rs | 6 +++--- src/librustc_mir/transform/qualify_consts.rs | 4 ++-- src/librustc_trans/debuginfo/create_scope_map.rs | 2 +- src/librustc_trans/mir/mod.rs | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 128d0d21da597..24224edf7be06 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -188,7 +188,7 @@ impl<'tcx> Mir<'tcx> { /// Returns an iterator over all temporaries. #[inline] - pub fn temp_iter<'a>(&'a self) -> impl Iterator + 'a { + pub fn temps_iter<'a>(&'a self) -> impl Iterator + 'a { (self.arg_count+1..self.local_decls.len()).filter_map(move |index| { let local = Local::new(index); if self.local_decls[local].source_info.is_none() { @@ -201,7 +201,7 @@ impl<'tcx> Mir<'tcx> { /// Returns an iterator over all user-declared locals. #[inline] - pub fn var_iter<'a>(&'a self) -> impl Iterator + 'a { + pub fn vars_iter<'a>(&'a self) -> impl Iterator + 'a { (self.arg_count+1..self.local_decls.len()).filter_map(move |index| { let local = Local::new(index); if self.local_decls[local].source_info.is_none() { @@ -214,14 +214,14 @@ impl<'tcx> Mir<'tcx> { /// Returns an iterator over all function arguments. #[inline] - pub fn arg_iter<'a>(&'a self) -> impl Iterator + 'a { + pub fn args_iter<'a>(&'a self) -> impl Iterator + 'a { (1..self.arg_count+1).map(Local::new) } /// Returns an iterator over all user-defined variables and compiler-generated temporaries (all /// locals that are neither arguments nor the return pointer). #[inline] - pub fn var_and_temp_iter<'a>(&'a self) -> impl Iterator + 'a { + pub fn vars_and_temps_iter<'a>(&'a self) -> impl Iterator + 'a { (self.arg_count+1..self.local_decls.len()).map(Local::new) } diff --git a/src/librustc_borrowck/borrowck/mir/mod.rs b/src/librustc_borrowck/borrowck/mir/mod.rs index 450d29696e77d..2a3c602b134e7 100644 --- a/src/librustc_borrowck/borrowck/mir/mod.rs +++ b/src/librustc_borrowck/borrowck/mir/mod.rs @@ -338,7 +338,7 @@ fn drop_flag_effects_for_function_entry<'a, 'tcx, F>( where F: FnMut(MovePathIndex, DropFlagState) { let move_data = &ctxt.move_data; - for arg in mir.arg_iter() { + for arg in mir.args_iter() { let lvalue = repr::Lvalue::Local(arg); let lookup_result = move_data.rev_lookup.find(&lvalue); on_lookup_result_bits(tcx, mir, move_data, diff --git a/src/librustc_mir/graphviz.rs b/src/librustc_mir/graphviz.rs index 5d91f63ef52aa..1c1f0ca790267 100644 --- a/src/librustc_mir/graphviz.rs +++ b/src/librustc_mir/graphviz.rs @@ -136,7 +136,7 @@ fn write_graph_label<'a, 'tcx, W: Write>(tcx: TyCtxt<'a, 'tcx, 'tcx>, write!(w, " label= 0 { write!(w, ", ")?; } @@ -146,7 +146,7 @@ fn write_graph_label<'a, 'tcx, W: Write>(tcx: TyCtxt<'a, 'tcx, 'tcx>, write!(w, ") -> {}", escape(mir.return_ty))?; write!(w, r#"
"#)?; - for local in mir.var_and_temp_iter() { + for local in mir.vars_and_temps_iter() { let decl = &mir.local_decls[local]; write!(w, "let ")?; diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs index 7b5dbe72c513a..5c88c89862126 100644 --- a/src/librustc_mir/pretty.rs +++ b/src/librustc_mir/pretty.rs @@ -237,7 +237,7 @@ fn write_scope_tree(tcx: TyCtxt, writeln!(w, "{0:1$}scope {2} {{", "", indent, child.index())?; // User variable types (including the user's name in a comment). - for local in mir.var_iter() { + for local in mir.vars_iter() { let var = &mir.local_decls[local]; let (name, source_info) = if var.source_info.unwrap().scope == child { (var.name.unwrap(), var.source_info.unwrap()) @@ -333,7 +333,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write) write!(w, "(")?; // fn argument types. - for (i, arg) in mir.arg_iter().enumerate() { + for (i, arg) in mir.args_iter().enumerate() { if i != 0 { write!(w, ", ")?; } @@ -349,7 +349,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write) fn write_temp_decls(mir: &Mir, w: &mut Write) -> io::Result<()> { // Compiler-introduced temporary types. - for temp in mir.temp_iter() { + for temp in mir.temps_iter() { writeln!(w, "{}let mut {:?}: {};", INDENT, temp, mir.local_decls[temp].ty)?; } diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index acc3084c906dc..b00a88093d726 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -410,7 +410,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { TerminatorKind::Return => { // Check for unused values. This usually means // there are extra statements in the AST. - for temp in mir.temp_iter() { + for temp in mir.temps_iter() { if self.temp_qualif[temp].is_none() { continue; } @@ -435,7 +435,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { // Make sure there are no extra unassigned variables. self.qualif = Qualif::NOT_CONST; - for index in mir.var_iter() { + for index in mir.vars_iter() { if !self.const_fn_arg_vars.contains(index.index()) { debug!("unassigned variable {:?}", index); self.assign(&Lvalue::Local(index), Location { diff --git a/src/librustc_trans/debuginfo/create_scope_map.rs b/src/librustc_trans/debuginfo/create_scope_map.rs index f453b27f9b97a..1d7e4991aa847 100644 --- a/src/librustc_trans/debuginfo/create_scope_map.rs +++ b/src/librustc_trans/debuginfo/create_scope_map.rs @@ -63,7 +63,7 @@ pub fn create_mir_scopes(fcx: &FunctionContext) -> IndexVec(fcx: &'blk FunctionContext<'blk, 'tcx>) { let retptr = allocate_local(mir::RETURN_POINTER); iter::once(retptr) .chain(args.into_iter()) - .chain(mir.var_and_temp_iter().map(&mut allocate_local)) + .chain(mir.vars_and_temps_iter().map(&mut allocate_local)) .collect() }; @@ -356,7 +356,7 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, None }; - mir.arg_iter().enumerate().map(|(arg_index, local)| { + mir.args_iter().enumerate().map(|(arg_index, local)| { let arg_decl = &mir.local_decls[local]; let arg_ty = bcx.monomorphize(&arg_decl.ty);