diff options
Diffstat (limited to '')
-rw-r--r-- | tests/mir-opt/building/custom/arrays.rs | 19 |
1 files changed, 19 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 000000000..8e0a1fd7a --- /dev/null +++ b/tests/mir-opt/building/custom/arrays.rs @@ -0,0 +1,19 @@ +#![feature(custom_mir, core_intrinsics, inline_const)] + +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); +} |