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
|
@ -289,7 +289,7 @@ pub trait LayoutCalculator {
|
|||
fn layout_of_struct_or_enum(
|
||||
&self,
|
||||
repr: &ReprOptions,
|
||||
variants: &IndexVec<VariantIdx, Vec<Layout<'_>>>,
|
||||
variants: &IndexSlice<VariantIdx, Vec<Layout<'_>>>,
|
||||
is_enum: bool,
|
||||
is_unsafe_cell: bool,
|
||||
scalar_valid_range: (Bound<u128>, Bound<u128>),
|
||||
|
@ -883,7 +883,7 @@ pub trait LayoutCalculator {
|
|||
fn layout_of_union(
|
||||
&self,
|
||||
repr: &ReprOptions,
|
||||
variants: &IndexVec<VariantIdx, Vec<Layout<'_>>>,
|
||||
variants: &IndexSlice<VariantIdx, Vec<Layout<'_>>>,
|
||||
) -> Option<LayoutS> {
|
||||
let dl = self.current_data_layout();
|
||||
let dl = dl.borrow();
|
||||
|
|
|
@ -11,7 +11,7 @@ use bitflags::bitflags;
|
|||
use rustc_data_structures::intern::Interned;
|
||||
#[cfg(feature = "nightly")]
|
||||
use rustc_data_structures::stable_hasher::StableOrd;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
|
||||
#[cfg(feature = "nightly")]
|
||||
use rustc_macros::HashStable_Generic;
|
||||
#[cfg(feature = "nightly")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue