2018-05-16 18:58:54 +03:00
|
|
|
// compile-flags: -Z span_free_formats
|
|
|
|
|
|
|
|
// Tests that MIR inliner can handle closure captures.
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{:?}", foo(0, 14));
|
|
|
|
}
|
|
|
|
|
2020-07-27 21:22:43 +02:00
|
|
|
// EMIT_MIR inline_closure_captures.foo.Inline.after.mir
|
2018-05-16 18:58:54 +03:00
|
|
|
fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
|
|
|
|
let x = |_q| (q, t);
|
2023-10-20 11:30:04 -07:00
|
|
|
|
|
|
|
// CHECK-LABEL: fn foo(
|
|
|
|
// CHECK: (inlined foo::<T>::{closure#0})
|
2018-05-16 18:58:54 +03:00
|
|
|
x(q)
|
|
|
|
}
|