]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/const_fn_mir/dump.mir
Rollup merge of #100255 - thedanvail:issue-98861-fix, r=joshtriplett
[rust.git] / src / test / run-make / const_fn_mir / dump.mir
1 // WARNING: This output format is intended for human consumers only
2 // and is subject to change without notice. Knock yourself out.
3 fn foo() -> i32 {
4     let mut _0: i32;                     // return place in scope 0 at main.rs:4:19: 4:22
5
6     bb0: {
7         _0 = const 11_i32;               // scope 0 at main.rs:5:5: 5:10
8         return;                          // scope 0 at main.rs:6:2: 6:2
9     }
10 }
11
12 // MIR FOR CTFE
13 fn foo() -> i32 {
14     let mut _0: i32;                     // return place in scope 0 at main.rs:4:19: 4:22
15     let mut _1: (i32, bool);             // in scope 0 at main.rs:5:5: 5:10
16
17     bb0: {
18         _1 = CheckedAdd(const 5_i32, const 6_i32); // scope 0 at main.rs:5:5: 5:10
19         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
20     }
21
22     bb1: {
23         _0 = move (_1.0: i32);           // scope 0 at main.rs:5:5: 5:10
24         return;                          // scope 0 at main.rs:6:2: 6:2
25     }
26 }
27
28 fn main() -> () {
29     let mut _0: ();                      // return place in scope 0 at main.rs:8:11: 8:11
30     let _1: i32;                         // in scope 0 at main.rs:9:5: 9:10
31
32     bb0: {
33         _1 = foo() -> bb1;               // scope 0 at main.rs:9:5: 9:10
34                                          // mir::Constant
35                                          // + span: main.rs:9:5: 9:8
36                                          // + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
37     }
38
39     bb1: {
40         return;                          // scope 0 at main.rs:10:2: 10:2
41     }
42 }