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*.
This commit is contained in:
parent
a93bcdc307
commit
a2ee7592d6
42 changed files with 168 additions and 118 deletions
|
@ -21,7 +21,7 @@ use rustc_middle::ty::subst::InternalSubsts;
|
|||
use rustc_middle::ty::{self, List, TyCtxt, TypeVisitableExt};
|
||||
use rustc_span::Span;
|
||||
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::{cmp, iter, mem};
|
||||
|
@ -184,7 +184,7 @@ pub fn collect_temps_and_candidates<'tcx>(
|
|||
/// This wraps an `Item`, and has access to all fields of that `Item` via `Deref` coercion.
|
||||
struct Validator<'a, 'tcx> {
|
||||
ccx: &'a ConstCx<'a, 'tcx>,
|
||||
temps: &'a mut IndexVec<Local, TempState>,
|
||||
temps: &'a mut IndexSlice<Local, TempState>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> std::ops::Deref for Validator<'a, 'tcx> {
|
||||
|
@ -669,7 +669,7 @@ impl<'tcx> Validator<'_, 'tcx> {
|
|||
// FIXME(eddyb) remove the differences for promotability in `static`, `const`, `const fn`.
|
||||
pub fn validate_candidates(
|
||||
ccx: &ConstCx<'_, '_>,
|
||||
temps: &mut IndexVec<Local, TempState>,
|
||||
temps: &mut IndexSlice<Local, TempState>,
|
||||
candidates: &[Candidate],
|
||||
) -> Vec<Candidate> {
|
||||
let mut validator = Validator { ccx, temps };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue