diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-03-31 00:32:44 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-04-02 17:35:37 -0700 |
| commit | a2ee7592d6b7c0daa62b7870ade85e0cc0acca05 (patch) | |
| tree | 4ab6bedbd53989ea3c1b556e4d61c33f469c536b /compiler/rustc_mir_transform/src/const_prop.rs | |
| parent | a93bcdc30771340dfff914a1cf48556886ad33a6 (diff) | |
| download | rust-a2ee7592d6b7c0daa62b7870ade85e0cc0acca05.tar.gz rust-a2ee7592d6b7c0daa62b7870ade85e0cc0acca05.zip | |
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*.
Diffstat (limited to 'compiler/rustc_mir_transform/src/const_prop.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index e7075d5e791..ac55948e61b 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -7,7 +7,7 @@ use rustc_const_eval::const_eval::CheckAlignment; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::DefKind; use rustc_index::bit_set::BitSet; -use rustc_index::vec::IndexVec; +use rustc_index::vec::{IndexSlice, IndexVec}; use rustc_middle::mir::visit::{ MutVisitor, MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor, }; @@ -127,7 +127,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp { let dummy_body = &Body::new( body.source, - (*body.basic_blocks).clone(), + (*body.basic_blocks).to_owned(), body.source_scopes.clone(), body.local_decls.clone(), Default::default(), @@ -319,7 +319,7 @@ struct ConstPropagator<'mir, 'tcx> { ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, - local_decls: &'mir IndexVec<Local, LocalDecl<'tcx>>, + local_decls: &'mir IndexSlice<Local, LocalDecl<'tcx>>, } impl<'tcx> LayoutOfHelpers<'tcx> for ConstPropagator<'_, 'tcx> { |
