Skip to content

Commit bf41e75

Browse files
committed
Auto merge of #109819 - scottmcm:index-slice, r=WaffleLapkin
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*. r? `@ghost`
2 parents 1767585 + a2ee759 commit bf41e75

File tree

42 files changed

+168
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+168
-118
lines changed

compiler/rustc_abi/src/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub trait LayoutCalculator {
289289
fn layout_of_struct_or_enum(
290290
&self,
291291
repr: &ReprOptions,
292-
variants: &IndexVec<VariantIdx, Vec<Layout<'_>>>,
292+
variants: &IndexSlice<VariantIdx, Vec<Layout<'_>>>,
293293
is_enum: bool,
294294
is_unsafe_cell: bool,
295295
scalar_valid_range: (Bound<u128>, Bound<u128>),
@@ -883,7 +883,7 @@ pub trait LayoutCalculator {
883883
fn layout_of_union(
884884
&self,
885885
repr: &ReprOptions,
886-
variants: &IndexVec<VariantIdx, Vec<Layout<'_>>>,
886+
variants: &IndexSlice<VariantIdx, Vec<Layout<'_>>>,
887887
) -> Option<LayoutS> {
888888
let dl = self.current_data_layout();
889889
let dl = dl.borrow();

compiler/rustc_abi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use bitflags::bitflags;
1111
use rustc_data_structures::intern::Interned;
1212
#[cfg(feature = "nightly")]
1313
use rustc_data_structures::stable_hasher::StableOrd;
14-
use rustc_index::vec::{Idx, IndexVec};
14+
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
1515
#[cfg(feature = "nightly")]
1616
use rustc_macros::HashStable_Generic;
1717
#[cfg(feature = "nightly")]

compiler/rustc_ast_lowering/src/item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_hir as hir;
1212
use rustc_hir::def::{DefKind, Res};
1313
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
1414
use rustc_hir::PredicateOrigin;
15-
use rustc_index::vec::{Idx, IndexVec};
15+
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
1616
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
1717
use rustc_span::edit_distance::find_best_match_for_name;
1818
use rustc_span::source_map::DesugaringKind;
@@ -25,7 +25,7 @@ use thin_vec::ThinVec;
2525
pub(super) struct ItemLowerer<'a, 'hir> {
2626
pub(super) tcx: TyCtxt<'hir>,
2727
pub(super) resolver: &'a mut ResolverAstLowering,
28-
pub(super) ast_index: &'a IndexVec<LocalDefId, AstOwner<'a>>,
28+
pub(super) ast_index: &'a IndexSlice<LocalDefId, AstOwner<'a>>,
2929
pub(super) owners: &'a mut IndexVec<LocalDefId, hir::MaybeOwner<&'hir hir::OwnerInfo<'hir>>>,
3030
}
3131

compiler/rustc_ast_lowering/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
6060
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
6161
use rustc_hir::definitions::DefPathData;
6262
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
63-
use rustc_index::vec::{Idx, IndexVec};
63+
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
6464
use rustc_macros::fluent_messages;
6565
use rustc_middle::{
6666
span_bug,
@@ -414,7 +414,7 @@ fn index_crate<'a>(
414414
/// This hash will then be part of the crate_hash which is stored in the metadata.
415415
fn compute_hir_hash(
416416
tcx: TyCtxt<'_>,
417-
owners: &IndexVec<LocalDefId, hir::MaybeOwner<&hir::OwnerInfo<'_>>>,
417+
owners: &IndexSlice<LocalDefId, hir::MaybeOwner<&hir::OwnerInfo<'_>>>,
418418
) -> Fingerprint {
419419
let mut hir_body_nodes: Vec<_> = owners
420420
.iter_enumerated()

compiler/rustc_borrowck/src/constraints/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![deny(rustc::diagnostic_outside_of_impl)]
33

44
use rustc_data_structures::graph::scc::Sccs;
5-
use rustc_index::vec::IndexVec;
5+
use rustc_index::vec::{IndexSlice, IndexVec};
66
use rustc_middle::mir::ConstraintCategory;
77
use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
88
use rustc_span::Span;
@@ -60,7 +60,9 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
6060
Sccs::new(region_graph)
6161
}
6262

63-
pub(crate) fn outlives(&self) -> &IndexVec<OutlivesConstraintIndex, OutlivesConstraint<'tcx>> {
63+
pub(crate) fn outlives(
64+
&self,
65+
) -> &IndexSlice<OutlivesConstraintIndex, OutlivesConstraint<'tcx>> {
6466
&self.outlives
6567
}
6668
}

compiler/rustc_borrowck/src/consumers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This file provides API for compiler consumers.
44
55
use rustc_hir::def_id::LocalDefId;
6-
use rustc_index::vec::IndexVec;
6+
use rustc_index::vec::IndexSlice;
77
use rustc_infer::infer::{DefiningAnchor, TyCtxtInferExt};
88
use rustc_middle::mir::Body;
99
use rustc_middle::ty::{self, TyCtxt};
@@ -35,6 +35,6 @@ pub fn get_body_with_borrowck_facts(
3535
let (input_body, promoted) = tcx.mir_promoted(def);
3636
let infcx = tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(def.did)).build();
3737
let input_body: &Body<'_> = &input_body.borrow();
38-
let promoted: &IndexVec<_, _> = &promoted.borrow();
38+
let promoted: &IndexSlice<_, _> = &promoted.borrow();
3939
*super::do_mir_borrowck(&infcx, input_body, promoted, true).1.unwrap()
4040
}

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use rustc_errors::{Applicability, Diagnostic};
44
use rustc_hir as hir;
55
use rustc_hir::intravisit::Visitor;
6-
use rustc_index::vec::IndexVec;
6+
use rustc_index::vec::IndexSlice;
77
use rustc_infer::infer::NllRegionVariableOrigin;
88
use rustc_middle::mir::{
99
Body, CastKind, ConstraintCategory, FakeReadCause, Local, LocalInfo, Location, Operand, Place,
@@ -60,7 +60,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
6060
&self,
6161
tcx: TyCtxt<'tcx>,
6262
body: &Body<'tcx>,
63-
local_names: &IndexVec<Local, Option<Symbol>>,
63+
local_names: &IndexSlice<Local, Option<Symbol>>,
6464
err: &mut Diagnostic,
6565
borrow_desc: &str,
6666
borrow_span: Option<Span>,

compiler/rustc_borrowck/src/diagnostics/var_name.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use crate::Upvar;
55
use crate::{nll::ToRegionVid, region_infer::RegionInferenceContext};
6-
use rustc_index::vec::{Idx, IndexVec};
6+
use rustc_index::vec::{Idx, IndexSlice};
77
use rustc_middle::mir::{Body, Local};
88
use rustc_middle::ty::{RegionVid, TyCtxt};
99
use rustc_span::source_map::Span;
@@ -14,7 +14,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1414
&self,
1515
tcx: TyCtxt<'tcx>,
1616
body: &Body<'tcx>,
17-
local_names: &IndexVec<Local, Option<Symbol>>,
17+
local_names: &IndexSlice<Local, Option<Symbol>>,
1818
upvars: &[Upvar<'tcx>],
1919
fr: RegionVid,
2020
) -> Option<(Option<Symbol>, Span)> {
@@ -113,7 +113,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
113113
pub(crate) fn get_argument_name_and_span_for_region(
114114
&self,
115115
body: &Body<'tcx>,
116-
local_names: &IndexVec<Local, Option<Symbol>>,
116+
local_names: &IndexSlice<Local, Option<Symbol>>,
117117
argument_index: usize,
118118
) -> (Option<Symbol>, Span) {
119119
let implicit_inputs = self.universal_regions().defining_ty.implicit_inputs();

compiler/rustc_borrowck/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, Subdiagnost
2323
use rustc_hir as hir;
2424
use rustc_hir::def_id::LocalDefId;
2525
use rustc_index::bit_set::ChunkedBitSet;
26-
use rustc_index::vec::IndexVec;
26+
use rustc_index::vec::{IndexSlice, IndexVec};
2727
use rustc_infer::infer::{
2828
DefiningAnchor, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin, TyCtxtInferExt,
2929
};
@@ -154,7 +154,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &Bor
154154
let infcx =
155155
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(hir_owner.def_id)).build();
156156
let input_body: &Body<'_> = &input_body.borrow();
157-
let promoted: &IndexVec<_, _> = &promoted.borrow();
157+
let promoted: &IndexSlice<_, _> = &promoted.borrow();
158158
let opt_closure_req = do_mir_borrowck(&infcx, input_body, promoted, false).0;
159159
debug!("mir_borrowck done");
160160

@@ -170,7 +170,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &Bor
170170
fn do_mir_borrowck<'tcx>(
171171
infcx: &InferCtxt<'tcx>,
172172
input_body: &Body<'tcx>,
173-
input_promoted: &IndexVec<Promoted, Body<'tcx>>,
173+
input_promoted: &IndexSlice<Promoted, Body<'tcx>>,
174174
return_body_with_facts: bool,
175175
) -> (BorrowCheckResult<'tcx>, Option<Box<BodyWithBorrowckFacts<'tcx>>>) {
176176
let def = input_body.source.with_opt_param().as_local().unwrap();
@@ -223,7 +223,7 @@ fn do_mir_borrowck<'tcx>(
223223
// be modified (in place) to contain non-lexical lifetimes. It
224224
// will have a lifetime tied to the inference context.
225225
let mut body_owned = input_body.clone();
226-
let mut promoted = input_promoted.clone();
226+
let mut promoted = input_promoted.to_owned();
227227
let free_regions =
228228
nll::replace_regions_in_mir(&infcx, param_env, &mut body_owned, &mut promoted);
229229
let body = &body_owned; // no further changes

compiler/rustc_borrowck/src/member_constraints.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![deny(rustc::diagnostic_outside_of_impl)]
33
use rustc_data_structures::captures::Captures;
44
use rustc_data_structures::fx::FxIndexMap;
5-
use rustc_index::vec::IndexVec;
5+
use rustc_index::vec::{IndexSlice, IndexVec};
66
use rustc_middle::infer::MemberConstraint;
77
use rustc_middle::ty::{self, Ty};
88
use rustc_span::Span;
@@ -215,7 +215,7 @@ where
215215
/// target_list: A -> B -> C -> D -> E -> F -> (None)
216216
/// ```
217217
fn append_list(
218-
constraints: &mut IndexVec<NllMemberConstraintIndex, NllMemberConstraint<'_>>,
218+
constraints: &mut IndexSlice<NllMemberConstraintIndex, NllMemberConstraint<'_>>,
219219
target_list: NllMemberConstraintIndex,
220220
source_list: NllMemberConstraintIndex,
221221
) {

compiler/rustc_borrowck/src/nll.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use rustc_data_structures::fx::FxIndexMap;
66
use rustc_hir::def_id::LocalDefId;
7-
use rustc_index::vec::IndexVec;
7+
use rustc_index::vec::IndexSlice;
88
use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere};
99
use rustc_middle::mir::{
1010
BasicBlock, Body, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind, Location,
@@ -59,7 +59,7 @@ pub(crate) fn replace_regions_in_mir<'tcx>(
5959
infcx: &BorrowckInferCtxt<'_, 'tcx>,
6060
param_env: ty::ParamEnv<'tcx>,
6161
body: &mut Body<'tcx>,
62-
promoted: &mut IndexVec<Promoted, Body<'tcx>>,
62+
promoted: &mut IndexSlice<Promoted, Body<'tcx>>,
6363
) -> UniversalRegions<'tcx> {
6464
let def = body.source.with_opt_param().as_local().unwrap();
6565

@@ -158,7 +158,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
158158
infcx: &BorrowckInferCtxt<'_, 'tcx>,
159159
universal_regions: UniversalRegions<'tcx>,
160160
body: &Body<'tcx>,
161-
promoted: &IndexVec<Promoted, Body<'tcx>>,
161+
promoted: &IndexSlice<Promoted, Body<'tcx>>,
162162
location_table: &LocationTable,
163163
param_env: ty::ParamEnv<'tcx>,
164164
flow_inits: &mut ResultsCursor<'cx, 'tcx, MaybeInitializedPlaces<'cx, 'tcx>>,

compiler/rustc_borrowck/src/region_infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
77
use rustc_data_structures::graph::scc::Sccs;
88
use rustc_errors::Diagnostic;
99
use rustc_hir::def_id::CRATE_DEF_ID;
10-
use rustc_index::vec::IndexVec;
10+
use rustc_index::vec::{IndexSlice, IndexVec};
1111
use rustc_infer::infer::outlives::test_type_match;
1212
use rustc_infer::infer::region_constraints::{GenericKind, VarInfos, VerifyBound, VerifyIfEq};
1313
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin};
@@ -399,7 +399,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
399399
/// the minimum, or narrowest, universe.
400400
fn compute_scc_universes(
401401
constraint_sccs: &Sccs<RegionVid, ConstraintSccIndex>,
402-
definitions: &IndexVec<RegionVid, RegionDefinition<'tcx>>,
402+
definitions: &IndexSlice<RegionVid, RegionDefinition<'tcx>>,
403403
) -> IndexVec<ConstraintSccIndex, ty::UniverseIndex> {
404404
let num_sccs = constraint_sccs.num_sccs();
405405
let mut scc_universes = IndexVec::from_elem_n(ty::UniverseIndex::MAX, num_sccs);
@@ -486,7 +486,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
486486
/// more details.
487487
fn compute_scc_representatives(
488488
constraints_scc: &Sccs<RegionVid, ConstraintSccIndex>,
489-
definitions: &IndexVec<RegionVid, RegionDefinition<'tcx>>,
489+
definitions: &IndexSlice<RegionVid, RegionDefinition<'tcx>>,
490490
) -> IndexVec<ConstraintSccIndex, ty::RegionVid> {
491491
let num_sccs = constraints_scc.num_sccs();
492492
let next_region_vid = definitions.next_index();

compiler/rustc_borrowck/src/renumber.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![deny(rustc::untranslatable_diagnostic)]
22
#![deny(rustc::diagnostic_outside_of_impl)]
33
use crate::BorrowckInferCtxt;
4-
use rustc_index::vec::IndexVec;
4+
use rustc_index::vec::IndexSlice;
55
use rustc_infer::infer::NllRegionVariableOrigin;
66
use rustc_middle::mir::visit::{MutVisitor, TyContext};
77
use rustc_middle::mir::Constant;
@@ -16,7 +16,7 @@ use rustc_span::{Span, Symbol};
1616
pub fn renumber_mir<'tcx>(
1717
infcx: &BorrowckInferCtxt<'_, 'tcx>,
1818
body: &mut Body<'tcx>,
19-
promoted: &mut IndexVec<Promoted, Body<'tcx>>,
19+
promoted: &mut IndexSlice<Promoted, Body<'tcx>>,
2020
) {
2121
debug!(?body.arg_count);
2222

compiler/rustc_borrowck/src/type_check/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
125125
infcx: &BorrowckInferCtxt<'_, 'tcx>,
126126
param_env: ty::ParamEnv<'tcx>,
127127
body: &Body<'tcx>,
128-
promoted: &IndexVec<Promoted, Body<'tcx>>,
128+
promoted: &IndexSlice<Promoted, Body<'tcx>>,
129129
universal_regions: &Rc<UniversalRegions<'tcx>>,
130130
location_table: &LocationTable,
131131
borrow_set: &BorrowSet<'tcx>,
@@ -292,7 +292,7 @@ enum FieldAccessError {
292292
/// is a problem.
293293
struct TypeVerifier<'a, 'b, 'tcx> {
294294
cx: &'a mut TypeChecker<'b, 'tcx>,
295-
promoted: &'b IndexVec<Promoted, Body<'tcx>>,
295+
promoted: &'b IndexSlice<Promoted, Body<'tcx>>,
296296
last_span: Span,
297297
errors_reported: bool,
298298
}
@@ -493,7 +493,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
493493
impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
494494
fn new(
495495
cx: &'a mut TypeChecker<'b, 'tcx>,
496-
promoted: &'b IndexVec<Promoted, Body<'tcx>>,
496+
promoted: &'b IndexSlice<Promoted, Body<'tcx>>,
497497
) -> Self {
498498
TypeVerifier { promoted, last_span: cx.body.span, cx, errors_reported: false }
499499
}

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_codegen_ssa::debuginfo::{
33
wants_c_like_enum_debuginfo,
44
};
55
use rustc_hir::def::CtorKind;
6-
use rustc_index::vec::IndexVec;
6+
use rustc_index::vec::IndexSlice;
77
use rustc_middle::{
88
bug,
99
mir::{GeneratorLayout, GeneratorSavedLocal},
@@ -323,7 +323,7 @@ pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
323323
generator_type_and_layout: TyAndLayout<'tcx>,
324324
generator_type_di_node: &'ll DIType,
325325
generator_layout: &GeneratorLayout<'tcx>,
326-
state_specific_upvar_names: &IndexVec<GeneratorSavedLocal, Option<Symbol>>,
326+
state_specific_upvar_names: &IndexSlice<GeneratorSavedLocal, Option<Symbol>>,
327327
common_upvar_names: &[String],
328328
) -> &'ll DIType {
329329
let variant_name = GeneratorSubsts::variant_name(variant_index);

compiler/rustc_codegen_ssa/src/coverageinfo/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub use super::ffi::*;
22

3-
use rustc_index::vec::IndexVec;
3+
use rustc_index::vec::{IndexSlice, IndexVec};
44
use rustc_middle::mir::coverage::{
55
CodeRegion, CounterValueReference, ExpressionOperandId, InjectedExpressionId,
66
InjectedExpressionIndex, MappedExpressionIndex, Op,
@@ -205,7 +205,7 @@ impl<'tcx> FunctionCoverage<'tcx> {
205205
// `expression_index`s lower than the referencing `Expression`. Therefore, it is
206206
// reasonable to look up the new index of an expression operand while the `new_indexes`
207207
// vector is only complete up to the current `ExpressionIndex`.
208-
let id_to_counter = |new_indexes: &IndexVec<
208+
let id_to_counter = |new_indexes: &IndexSlice<
209209
InjectedExpressionIndex,
210210
Option<MappedExpressionIndex>,
211211
>,

compiler/rustc_codegen_ssa/src/mir/analyze.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::FunctionCx;
55
use crate::traits::*;
66
use rustc_data_structures::graph::dominators::Dominators;
77
use rustc_index::bit_set::BitSet;
8-
use rustc_index::vec::IndexVec;
8+
use rustc_index::vec::{IndexSlice, IndexVec};
99
use rustc_middle::mir::traversal;
1010
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
1111
use rustc_middle::mir::{self, Location, TerminatorKind};
@@ -277,7 +277,7 @@ impl CleanupKind {
277277
/// Recover that structure in an analyze pass.
278278
pub fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKind> {
279279
fn discover_masters<'tcx>(
280-
result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
280+
result: &mut IndexSlice<mir::BasicBlock, CleanupKind>,
281281
mir: &mir::Body<'tcx>,
282282
) {
283283
for (bb, data) in mir.basic_blocks.iter_enumerated() {
@@ -308,7 +308,10 @@ pub fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKi
308308
}
309309
}
310310

311-
fn propagate<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>, mir: &mir::Body<'tcx>) {
311+
fn propagate<'tcx>(
312+
result: &mut IndexSlice<mir::BasicBlock, CleanupKind>,
313+
mir: &mir::Body<'tcx>,
314+
) {
312315
let mut funclet_succs = IndexVec::from_elem(None, &mir.basic_blocks);
313316

314317
let mut set_successor = |funclet: mir::BasicBlock, succ| match funclet_succs[funclet] {

compiler/rustc_const_eval/src/transform/promote_consts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_middle::ty::subst::InternalSubsts;
2121
use rustc_middle::ty::{self, List, TyCtxt, TypeVisitableExt};
2222
use rustc_span::Span;
2323

24-
use rustc_index::vec::{Idx, IndexVec};
24+
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
2525

2626
use std::cell::Cell;
2727
use std::{cmp, iter, mem};
@@ -184,7 +184,7 @@ pub fn collect_temps_and_candidates<'tcx>(
184184
/// This wraps an `Item`, and has access to all fields of that `Item` via `Deref` coercion.
185185
struct Validator<'a, 'tcx> {
186186
ccx: &'a ConstCx<'a, 'tcx>,
187-
temps: &'a mut IndexVec<Local, TempState>,
187+
temps: &'a mut IndexSlice<Local, TempState>,
188188
}
189189

190190
impl<'a, 'tcx> std::ops::Deref for Validator<'a, 'tcx> {
@@ -669,7 +669,7 @@ impl<'tcx> Validator<'_, 'tcx> {
669669
// FIXME(eddyb) remove the differences for promotability in `static`, `const`, `const fn`.
670670
pub fn validate_candidates(
671671
ccx: &ConstCx<'_, '_>,
672-
temps: &mut IndexVec<Local, TempState>,
672+
temps: &mut IndexSlice<Local, TempState>,
673673
candidates: &[Candidate],
674674
) -> Vec<Candidate> {
675675
let mut validator = Validator { ccx, temps };

0 commit comments

Comments
 (0)