about summary refs log tree commit diff
path: root/tests/mir-opt/building/index_array_and_slice.index_slice.built.after.mir
blob: 0911df590497cf3e573dd79d23f7ae54c18bbeb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// MIR for `index_slice` after built

fn index_slice(_1: &[i32], _2: usize) -> &i32 {
    debug slice => _1;
    debug index => _2;
    let mut _0: &i32;
    let _3: &i32;
    let _4: usize;
    let mut _5: usize;
    let mut _6: bool;

    bb0: {
        StorageLive(_3);
        StorageLive(_4);
        _4 = copy _2;
        _5 = PtrMetadata(copy _1);
        _6 = Lt(copy _4, copy _5);
        assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind: bb2];
    }

    bb1: {
        _3 = &(*_1)[_4];
        _0 = &(*_3);
        StorageDead(_4);
        StorageDead(_3);
        return;
    }

    bb2 (cleanup): {
        resume;
    }
}