]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inline-closure.rs
Simplify Cache wrapper to single type, impl Deref on it, fix all compilation errors...
[rust.git] / src / test / mir-opt / inline-closure.rs
1 // compile-flags: -Z span_free_formats
2
3 // Tests that MIR inliner can handle closure arguments. (#45894)
4
5 fn main() {
6     println!("{}", foo(0, 14));
7 }
8
9 fn foo<T: Copy>(_t: T, q: i32) -> i32 {
10     let x = |_t, _q| _t;
11     x(q, q)
12 }
13
14 // END RUST SOURCE
15 // START rustc.foo.Inline.after.mir
16 // fn foo(_1: T, _2: i32) -> i32{
17 //     debug _t => _1;
18 //     debug q => _2;
19 //     let mut _0: i32;
20 //     let _3: [closure@foo<T>::{{closure}}#0];
21 //     let mut _4: &[closure@foo<T>::{{closure}}#0];
22 //     let mut _5: (i32, i32);
23 //     let mut _6: i32;
24 //     let mut _7: i32;
25 //     let mut _8: i32;
26 //     let mut _9: i32;
27 //     scope 1 {
28 //         debug x => _3;
29 //         scope 2 {
30 //             debug _t => _8;
31 //             debug _q => _9;
32 //         }
33 //     }
34 //     bb0: {
35 //         ...
36 //         _3 = [closure@foo::<T>::{{closure}}#0];
37 //         ...
38 //         _4 = &_3;
39 //         ...
40 //         _6 = _2;
41 //         ...
42 //         _7 = _2;
43 //         _5 = (move _6, move _7);
44 //         _8 = move (_5.0: i32);
45 //         _9 = move (_5.1: i32);
46 //         _0 = _8;
47 //         ...
48 //         return;
49 //     }
50 // END rustc.foo.Inline.after.mir