mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Fix ICE in mir interpretation
This commit is contained in:
parent
fc5deca214
commit
056dff5748
@ -530,11 +530,12 @@ where
|
||||
// This can only be reached in ConstProp and non-rustc-MIR.
|
||||
throw_ub!(BoundsCheckFailed { len: min_length as u64, index: n as u64 });
|
||||
}
|
||||
assert!(offset < min_length);
|
||||
|
||||
let index = if from_end {
|
||||
assert!(offset - 1 < min_length);
|
||||
n - u64::from(offset)
|
||||
} else {
|
||||
assert!(offset < min_length);
|
||||
u64::from(offset)
|
||||
};
|
||||
|
||||
|
9
src/test/ui/consts/const_prop_slice_pat_ice.rs
Normal file
9
src/test/ui/consts/const_prop_slice_pat_ice.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// check-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
match &[0, 1] as &[i32] {
|
||||
[a @ .., x] => {}
|
||||
&[] => {}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user