summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building/custom/arrays.rs
blob: 8e0a1fd7a4390bf87fb2fa38303088c080f83d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}