]>
Commit | Line | Data |
---|---|---|
1b1a35ee | 1 | // compile-flags: -O |
1b1a35ee XL |
2 | |
3 | #![crate_type = "lib"] | |
4 | ||
5 | // CHECK-LABEL: @trim_in_place | |
6 | #[no_mangle] | |
7 | pub fn trim_in_place(a: &mut &[u8]) { | |
8 | while a.first() == Some(&42) { | |
9 | // CHECK-NOT: slice_index_order_fail | |
10 | *a = &a[1..]; | |
11 | } | |
12 | } | |
13 | ||
14 | // CHECK-LABEL: @trim_in_place2 | |
15 | #[no_mangle] | |
16 | pub fn trim_in_place2(a: &mut &[u8]) { | |
17 | while let Some(&42) = a.first() { | |
18 | // CHECK-NOT: slice_index_order_fail | |
19 | *a = &a[2..]; | |
20 | } | |
21 | } |