blob: fb028627d9d450b37ad45fc19cbc2f14248183f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
#[repr(packed)]
struct S {
field: [u32; 2],
}
#[custom_mir(dialect = "runtime", phase = "optimized")]
fn test() {
mir! {
let s: S;
{
// Store a repeat expression directly into a field of a packed struct.
s.field = [0; 2];
Return()
}
}
}
fn main() {
// Run this a bunch of time to make sure it doesn't pass by chance.
for _ in 0..20 {
test();
}
}
|