]>
Commit | Line | Data |
---|---|---|
f9f354fc XL |
1 | // no-system-llvm |
2 | // compile-flags: -O -C overflow-checks=on | |
3 | ||
4 | #![crate_type = "lib"] | |
5 | ||
6 | ||
7 | pub struct S1<'a> { | |
8 | data: &'a [u8], | |
9 | position: usize, | |
10 | } | |
11 | ||
12 | // CHECK-LABEL: @slice_no_index_order | |
13 | #[no_mangle] | |
14 | pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { | |
15 | // CHECK-NOT: slice_index_order_fail | |
16 | let d = &s.data[s.position..s.position+n]; | |
17 | s.position += n; | |
18 | return d; | |
19 | } | |
20 | ||
21 | // CHECK-LABEL: @test_check | |
22 | #[no_mangle] | |
23 | pub fn test_check<'a>(s: &'a mut S1, x: usize, y: usize) -> &'a [u8] { | |
24 | // CHECK: slice_index_order_fail | |
25 | &s.data[x..y] | |
26 | } |