summary refs log tree commit diff
path: root/tests/mir-opt/building/custom/arrays.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/building/custom/arrays.rs')
-rw-r--r--tests/mir-opt/building/custom/arrays.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/mir-opt/building/custom/arrays.rs b/tests/mir-opt/building/custom/arrays.rs
new file mode 100644
index 00000000000..4bd6f93e113
--- /dev/null
+++ b/tests/mir-opt/building/custom/arrays.rs
@@ -0,0 +1,22 @@
+// skip-filecheck
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR arrays.arrays.built.after.mir
+#[custom_mir(dialect = "built")]
+fn arrays<const C: usize>() -> usize {
+    mir! {
+        {
+            let x = [5_i32; C];
+            let c = Len(x);
+            RET = c;
+            Return()
+        }
+    }
+}
+
+fn main() {
+    assert_eq!(arrays::<20>(), 20);
+}