summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/inline/inline_closure_captures.rs
blob: 52b6817e401c1b354bd3e2388045d841bb24ddc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// 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)
}