2022-11-27 20:48:04 -06:00
|
|
|
#![feature(custom_mir, core_intrinsics, inline_const)]
|
|
|
|
|
|
|
|
extern crate core;
|
|
|
|
use core::intrinsics::mir::*;
|
|
|
|
|
|
|
|
const D: i32 = 5;
|
|
|
|
|
|
|
|
// EMIT_MIR consts.consts.built.after.mir
|
|
|
|
#[custom_mir(dialect = "built")]
|
|
|
|
fn consts<const C: u32>() {
|
|
|
|
mir!({
|
|
|
|
let _a = 5_u8;
|
|
|
|
let _b = const { 5_i8 };
|
|
|
|
let _c = C;
|
|
|
|
let _d = D;
|
|
|
|
let _e = consts::<10>;
|
|
|
|
Return()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-12-22 09:33:12 -06:00
|
|
|
static S: i32 = 0x05050505;
|
|
|
|
static mut T: i32 = 0x0a0a0a0a;
|
2022-11-27 21:25:55 -06:00
|
|
|
// EMIT_MIR consts.statics.built.after.mir
|
|
|
|
#[custom_mir(dialect = "built")]
|
|
|
|
fn statics() {
|
|
|
|
mir!({
|
|
|
|
let _a: &i32 = Static(S);
|
|
|
|
let _b: *mut i32 = StaticMut(T);
|
|
|
|
Return()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-11-27 20:48:04 -06:00
|
|
|
fn main() {
|
|
|
|
consts::<5>();
|
2022-11-27 21:25:55 -06:00
|
|
|
statics();
|
2022-11-27 20:48:04 -06:00
|
|
|
}
|