rust/tests/mir-opt/inline/inline_closure_captures.rs
2023-10-19 15:51:52 +00:00

15 lines
300 B
Rust

// skip-filecheck
// compile-flags: -Z span_free_formats
// Tests that MIR inliner can handle closure captures.
fn main() {
println!("{:?}", foo(0, 14));
}
// EMIT_MIR inline_closure_captures.foo.Inline.after.mir
fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
let x = |_q| (q, t);
x(q)
}