fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB68 linesraw
1// MIR for `step_forward` after PreCodegen
2
3fn step_forward(_1: u32, _2: usize) -> u32 {
4    debug x => _1;
5    debug n => _2;
6    let mut _0: u32;
7    scope 1 (inlined <u32 as Step>::forward) {
8        debug start => _1;
9        debug n => _2;
10        let _3: std::option::Option<u32>;
11        let mut _6: bool;
12        let mut _7: u32;
13        let mut _8: &std::option::Option<u32>;
14        scope 2 {
15        }
16        scope 3 (inlined Option::<u32>::is_none) {
17            debug self => _8;
18            let mut _5: bool;
19            scope 4 (inlined Option::<u32>::is_some) {
20                debug self => _8;
21                let mut _4: isize;
22            }
23        }
24        scope 5 (inlined core::num::<impl u32>::wrapping_add) {
25            debug self => _1;
26            debug rhs => _7;
27        }
28    }
29
30    bb0: {
31        StorageLive(_6);
32        StorageLive(_8);
33        StorageLive(_3);
34        _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
35    }
36
37    bb1: {
38        StorageLive(_5);
39        StorageLive(_4);
40        _4 = discriminant(_3);
41        _5 = Eq(_4, const 1_isize);
42        StorageDead(_4);
43        _6 = Not(move _5);
44        StorageDead(_5);
45        switchInt(move _6) -> [0: bb2, otherwise: bb3];
46    }
47
48    bb2: {
49        StorageDead(_3);
50        StorageDead(_8);
51        goto -> bb4;
52    }
53
54    bb3: {
55        StorageDead(_3);
56        StorageDead(_8);
57        assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
58    }
59
60    bb4: {
61        StorageDead(_6);
62        StorageLive(_7);
63        _7 = _2 as u32 (IntToInt);
64        _0 = Add(_1, _7);
65        StorageDead(_7);
66        return;
67    }
68}