]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inline-closure.rs
Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=eddyb
[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 // ...
17 // bb0: {
18 //     ...
19 //     _3 = [closure@HirId { owner: DefIndex(13), local_id: 15 }];
20 //     ...
21 //     _4 = &_3;
22 //     ...
23 //     _6 = _2;
24 //     ...
25 //     _7 = _2;
26 //     _5 = (move _6, move _7);
27 //     _8 = move (_5.0: i32);
28 //     _9 = move (_5.1: i32);
29 //     _0 = _8;
30 //     ...
31 //     return;
32 // }
33 // ...
34 // END rustc.foo.Inline.after.mir