summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/inline/inline-closure-captures.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/mir-opt/inline/inline-closure-captures.rs')
-rw-r--r--src/test/mir-opt/inline/inline-closure-captures.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/mir-opt/inline/inline-closure-captures.rs b/src/test/mir-opt/inline/inline-closure-captures.rs
new file mode 100644
index 000000000..52b6817e4
--- /dev/null
+++ b/src/test/mir-opt/inline/inline-closure-captures.rs
@@ -0,0 +1,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)
+}