diff options
Diffstat (limited to 'compiler/rustc_index/src/slice.rs')
| -rw-r--r-- | compiler/rustc_index/src/slice.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_index/src/slice.rs b/compiler/rustc_index/src/slice.rs index 67ac805c2bf..d2702bdb057 100644 --- a/compiler/rustc_index/src/slice.rs +++ b/compiler/rustc_index/src/slice.rs @@ -1,6 +1,6 @@ use std::fmt; use std::marker::PhantomData; -use std::ops::{Index, IndexMut}; +use std::ops::{Index, IndexMut, RangeBounds}; use std::slice::GetDisjointMutError::*; use std::slice::{self, SliceIndex}; @@ -105,6 +105,17 @@ impl<I: Idx, T> IndexSlice<I, T> { } #[inline] + pub fn copy_within( + &mut self, + src: impl IntoSliceIdx<I, [T], Output: RangeBounds<usize>>, + dest: I, + ) where + T: Copy, + { + self.raw.copy_within(src.into_slice_idx(), dest.index()); + } + + #[inline] pub fn get<R: IntoSliceIdx<I, [T]>>( &self, index: R, |
