#[inline]
fn index(&self, index: I) -> &UserRef<I::Output> {
unsafe {
- UserRef::from_ptr(index.index(&*self.as_raw_ptr()))
+ if let Some(slice) = index.get(&*self.as_raw_ptr()) {
+ UserRef::from_ptr(slice)
+ } else {
+ rtabort!("index out of range for user slice");
+ }
}
}
}
#[inline]
fn index_mut(&mut self, index: I) -> &mut UserRef<I::Output> {
unsafe {
- UserRef::from_mut_ptr(index.index_mut(&mut*self.as_raw_mut_ptr()))
+ if let Some(slice) = index.get_mut(&mut*self.as_raw_mut_ptr()) {
+ UserRef::from_mut_ptr(slice)
+ } else {
+ rtabort!("index out of range for user slice");
+ }
}
}
}