2022-11-09 11:21:42 -06:00
|
|
|
// unit-test: DataflowConstProp
|
2023-09-09 11:47:17 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
2022-11-09 11:21:42 -06:00
|
|
|
|
2023-05-13 09:19:31 -05:00
|
|
|
#[derive(Copy, Clone)]
|
2022-11-09 11:21:42 -06:00
|
|
|
struct S(i32);
|
|
|
|
|
2023-05-13 09:19:31 -05:00
|
|
|
#[derive(Copy, Clone)]
|
2023-05-13 07:30:40 -05:00
|
|
|
struct BigStruct(S, u8, f32, S);
|
|
|
|
|
2022-11-09 11:21:42 -06:00
|
|
|
// EMIT_MIR struct.main.DataflowConstProp.diff
|
|
|
|
fn main() {
|
|
|
|
let mut s = S(1);
|
|
|
|
let a = s.0 + 2;
|
|
|
|
s.0 = 3;
|
|
|
|
let b = a + s.0;
|
2023-05-13 07:30:40 -05:00
|
|
|
|
|
|
|
const VAL: BigStruct = BigStruct(S(1), 5, 7., S(13));
|
|
|
|
let BigStruct(a, b, c, d) = VAL;
|
2023-05-13 09:19:31 -05:00
|
|
|
|
|
|
|
static STAT: &BigStruct = &BigStruct(S(1), 5, 7., S(13));
|
|
|
|
let BigStruct(a, b, c, d) = *STAT;
|
2022-11-09 11:21:42 -06:00
|
|
|
}
|