summaryrefslogtreecommitdiffstats
path: root/tests/run-make/const_fn_mir/dump.mir
blob: 9cc70d3b0e6ba121dd674bfd82fa8a7d7411ec5a (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn foo() -> i32 {
    let mut _0: i32;                     // return place in scope 0 at main.rs:4:19: 4:22
    let mut _1: (i32, bool);             // in scope 0 at main.rs:5:5: 5:10

    bb0: {
        _1 = CheckedAdd(const 5_i32, const 6_i32); // scope 0 at main.rs:5:5: 5:10
        assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> bb1; // scope 0 at main.rs:5:5: 5:10
    }

    bb1: {
        _0 = move (_1.0: i32);           // scope 0 at main.rs:5:5: 5:10
        return;                          // scope 0 at main.rs:6:2: 6:2
    }
}

// MIR FOR CTFE
fn foo() -> i32 {
    let mut _0: i32;                     // return place in scope 0 at main.rs:4:19: 4:22
    let mut _1: (i32, bool);             // in scope 0 at main.rs:5:5: 5:10

    bb0: {
        _1 = CheckedAdd(const 5_i32, const 6_i32); // scope 0 at main.rs:5:5: 5:10
        assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> bb1; // scope 0 at main.rs:5:5: 5:10
    }

    bb1: {
        _0 = move (_1.0: i32);           // scope 0 at main.rs:5:5: 5:10
        return;                          // scope 0 at main.rs:6:2: 6:2
    }
}

fn main() -> () {
    let mut _0: ();                      // return place in scope 0 at main.rs:8:11: 8:11
    let _1: i32;                         // in scope 0 at main.rs:9:5: 9:10

    bb0: {
        _1 = foo() -> bb1;               // scope 0 at main.rs:9:5: 9:10
                                         // mir::Constant
                                         // + span: main.rs:9:5: 9:8
                                         // + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
    }

    bb1: {
        return;                          // scope 0 at main.rs:10:2: 10:2
    }
}