]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/basic_assignment.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / mir-opt / basic_assignment.rs
CommitLineData
8bb4bdeb
XL
1// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11// this tests move up progration, which is not yet implemented
12// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
13// file at the top-level directory of this distribution and at
14// http://rust-lang.org/COPYRIGHT.
15//
16// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
17// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
18// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
19// option. This file may not be copied, modified, or distributed
20// except according to those terms.
21
22// check that codegen of assignment expressions is sane. Assignments
23// tend to be absent in simple code, so subtle breakage in them can
24// leave a quite hard-to-find trail of destruction.
25
26fn main() {
27 let nodrop_x = false;
28 let nodrop_y;
29
30 nodrop_y = nodrop_x;
31
32 let drop_x : Option<Box<u32>> = None;
33 let drop_y;
34
35 drop_y = drop_x;
36}
37
38// END RUST SOURCE
7cac9316 39// START rustc.node4.SimplifyCfg-initial.after.mir
8bb4bdeb
XL
40// bb0: {
41// StorageLive(_1);
42// _1 = const false;
43// StorageLive(_2);
44// StorageLive(_3);
45// _3 = _1;
46// _2 = _3;
47// StorageDead(_3);
48// StorageLive(_4);
49// _4 = std::option::Option<std::boxed::Box<u32>>::None;
50// StorageLive(_6);
51// StorageLive(_7);
52// _7 = _4;
53// replace(_6 <- _7) -> [return: bb5, unwind: bb4];
54// }
55// bb1: {
56// resume;
57// }
58// bb2: {
59// drop(_4) -> bb1;
60// }
61// bb3: {
62// drop(_6) -> bb2;
63// }
64// bb4: {
65// drop(_7) -> bb3;
66// }
67// bb5: {
68// drop(_7) -> [return: bb6, unwind: bb3];
69// }
70// bb6: {
71// StorageDead(_7);
72// _0 = ();
73// drop(_6) -> [return: bb7, unwind: bb2];
74// }
75// bb7: {
76// StorageDead(_6);
77// drop(_4) -> bb8;
78// }
79// bb8: {
80// StorageDead(_4);
81// StorageDead(_2);
82// StorageDead(_1);
83// return;
84// }
7cac9316 85// END rustc.node4.SimplifyCfg-initial.after.mir