]> git.lizzy.rs Git - rust.git/blob - tests/codegen/issue-27130.rs
Rollup merge of #107700 - jyn514:tools-builder, r=Mark-Simulacrum
[rust.git] / tests / codegen / issue-27130.rs
1 // compile-flags: -O
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 }