1
Fork 0

Use iter::zip in compiler/

This commit is contained in:
Josh Stone 2021-03-08 15:32:41 -08:00
parent 3b1f5e3462
commit 72ebebe474
87 changed files with 213 additions and 204 deletions

View file

@ -40,6 +40,7 @@
use rustc_index::bit_set::BitSet;
use rustc_index::vec::{Idx, IndexVec};
use std::iter;
/// A [partially ordered set][poset] that has a [least upper bound][lub] for any pair of elements
/// in the set.
@ -110,7 +111,7 @@ impl<I: Idx, T: JoinSemiLattice> JoinSemiLattice for IndexVec<I, T> {
assert_eq!(self.len(), other.len());
let mut changed = false;
for (a, b) in self.iter_mut().zip(other.iter()) {
for (a, b) in iter::zip(self, other) {
changed |= a.join(b);
}
changed
@ -122,7 +123,7 @@ impl<I: Idx, T: MeetSemiLattice> MeetSemiLattice for IndexVec<I, T> {
assert_eq!(self.len(), other.len());
let mut changed = false;
for (a, b) in self.iter_mut().zip(other.iter()) {
for (a, b) in iter::zip(self, other) {
changed |= a.meet(b);
}
changed

View file

@ -11,6 +11,7 @@ use crate::borrow_check::{
use crate::dataflow::{self, fmt::DebugWithContext, GenKill};
use std::fmt;
use std::iter;
rustc_index::newtype_index! {
pub struct BorrowIndex {
@ -292,7 +293,7 @@ impl<'tcx> dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
}
mir::StatementKind::LlvmInlineAsm(ref asm) => {
for (output, kind) in asm.outputs.iter().zip(&asm.asm.outputs) {
for (output, kind) in iter::zip(&*asm.outputs, &asm.asm.outputs) {
if !kind.is_indirect && !kind.is_rw {
self.kill_borrows_on_place(trans, *output);
}

View file

@ -4,6 +4,7 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use smallvec::{smallvec, SmallVec};
use std::iter;
use std::mem;
use super::abs_domain::Lift;
@ -296,7 +297,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
self.create_move_path(**place);
}
StatementKind::LlvmInlineAsm(ref asm) => {
for (output, kind) in asm.outputs.iter().zip(&asm.asm.outputs) {
for (output, kind) in iter::zip(&*asm.outputs, &asm.asm.outputs) {
if !kind.is_indirect {
self.gather_init(output.as_ref(), InitKind::Deep);
}