New slice indexing pre-codegen MIR test
This commit is contained in:
parent
aa31bad26b
commit
5800dc1faa
@ -3,6 +3,7 @@
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(slice_ptr_get)]
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
@ -25,3 +26,11 @@ pub fn slice_index_range(slice: &[u32], index: Range<usize>) -> &[u32] {
|
||||
pub unsafe fn slice_get_unchecked_mut_range(slice: &mut [u32], index: Range<usize>) -> &mut [u32] {
|
||||
slice.get_unchecked_mut(index)
|
||||
}
|
||||
|
||||
// EMIT_MIR slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.mir
|
||||
pub unsafe fn slice_ptr_get_unchecked_range(
|
||||
slice: *const [u32],
|
||||
index: Range<usize>,
|
||||
) -> *const [u32] {
|
||||
slice.get_unchecked(index)
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
// MIR for `slice_ptr_get_unchecked_range` after PreCodegen
|
||||
|
||||
fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -> *const [u32] {
|
||||
debug slice => _1;
|
||||
debug index => _2;
|
||||
let mut _0: *const [u32];
|
||||
scope 1 (inlined std::ptr::const_ptr::<impl *const [u32]>::get_unchecked::<std::ops::Range<usize>>) {
|
||||
debug self => _1;
|
||||
debug index => _2;
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked(move _2, move _1) -> [return: bb1, unwind unreachable];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// MIR for `slice_ptr_get_unchecked_range` after PreCodegen
|
||||
|
||||
fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -> *const [u32] {
|
||||
debug slice => _1;
|
||||
debug index => _2;
|
||||
let mut _0: *const [u32];
|
||||
scope 1 (inlined std::ptr::const_ptr::<impl *const [u32]>::get_unchecked::<std::ops::Range<usize>>) {
|
||||
debug self => _1;
|
||||
debug index => _2;
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked(move _2, move _1) -> [return: bb1, unwind continue];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
return;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user