From a2ee7592d6b7c0daa62b7870ade85e0cc0acca05 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Fri, 31 Mar 2023 00:32:44 -0700 Subject: Use `&IndexSlice` instead of `&IndexVec` where possible All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*. --- compiler/rustc_mir_dataflow/src/move_paths/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_mir_dataflow/src/move_paths') diff --git a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs index 5f22a418de8..257a42cddc8 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs @@ -1,6 +1,6 @@ use crate::move_paths::builder::MoveDat; use rustc_data_structures::fx::FxHashMap; -use rustc_index::vec::IndexVec; +use rustc_index::vec::{IndexSlice, IndexVec}; use rustc_middle::mir::*; use rustc_middle::ty::{ParamEnv, Ty, TyCtxt}; use rustc_span::Span; @@ -64,7 +64,7 @@ impl<'tcx> MovePath<'tcx> { /// Returns an iterator over the parents of `self`. pub fn parents<'a>( &self, - move_paths: &'a IndexVec>, + move_paths: &'a IndexSlice>, ) -> impl 'a + Iterator)> { let first = self.parent.map(|mpi| (mpi, &move_paths[mpi])); MovePathLinearIter { @@ -78,7 +78,7 @@ impl<'tcx> MovePath<'tcx> { /// Returns an iterator over the immediate children of `self`. pub fn children<'a>( &self, - move_paths: &'a IndexVec>, + move_paths: &'a IndexSlice>, ) -> impl 'a + Iterator)> { let first = self.first_child.map(|mpi| (mpi, &move_paths[mpi])); MovePathLinearIter { @@ -95,7 +95,7 @@ impl<'tcx> MovePath<'tcx> { /// `f` will **not** be called on `self`. pub fn find_descendant( &self, - move_paths: &IndexVec>, + move_paths: &IndexSlice>, f: impl Fn(MovePathIndex) -> bool, ) -> Option { let mut todo = if let Some(child) = self.first_child { -- cgit 1.4.1-3-g733a5