]>
Commit | Line | Data |
---|---|---|
abe05a73 XL |
1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // compile-flags: -Z span_free_formats | |
12 | ||
13 | // Tests that MIR inliner can handle closure arguments. (#45894) | |
14 | ||
15 | fn main() { | |
16 | println!("{}", foo(0, 14)); | |
17 | } | |
18 | ||
19 | fn foo<T: Copy>(_t: T, q: i32) -> i32 { | |
20 | let x = |_t, _q| _t; | |
21 | x(q, q) | |
22 | } | |
23 | ||
24 | // END RUST SOURCE | |
25 | // START rustc.foo.Inline.after.mir | |
26 | // ... | |
27 | // bb0: { | |
28 | // ... | |
29 | // _3 = [closure@NodeId(28)]; | |
30 | // ... | |
31 | // _4 = &_3; | |
32 | // ... | |
33 | // _6 = _2; | |
34 | // ... | |
35 | // _7 = _2; | |
36 | // _5 = (_6, _7); | |
37 | // _0 = (_5.0: i32); | |
38 | // ... | |
39 | // return; | |
40 | // } | |
41 | // ... | |
42 | // END rustc.foo.Inline.after.mir |