]> git.proxmox.com Git - rustc.git/blob - src/test/mir-opt/basic_assignment.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / mir-opt / basic_assignment.rs
1 // this tests move up progration, which is not yet implemented
2
3 // EMIT_MIR rustc.main.SimplifyCfg-initial.after.mir
4
5 // Check codegen for assignments (`a = b`) where the left-hand-side is
6 // not yet initialized. Assignments tend to be absent in simple code,
7 // so subtle breakage in them can leave a quite hard-to-find trail of
8 // destruction.
9
10 fn main() {
11 let nodrop_x = false;
12 let nodrop_y;
13
14 // Since boolean does not require drop, this can be a simple
15 // assignment:
16 nodrop_y = nodrop_x;
17
18 let drop_x: Option<Box<u32>> = None;
19 let drop_y;
20
21 // Since the type of `drop_y` has drop, we generate a `replace`
22 // terminator:
23 drop_y = drop_x;
24 }