]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/basic_assignment.rs
Auto merge of #45035 - alexcrichton:no-empty, r=michaelwoerister
[rust.git] / src / test / mir-opt / basic_assignment.rs
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
26 fn 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
39 // START rustc.node4.SimplifyCfg-initial.after.mir
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(_5);
51 //         StorageLive(_6);
52 //         _6 = _4;
53 //         replace(_5 <- _6) -> [return: bb1, unwind: bb5];
54 //     }
55 //     bb1: {
56 //         drop(_6) -> [return: bb6, unwind: bb4];
57 //     }
58 //     bb2: {
59 //         resume;
60 //     }
61 //     bb3: {
62 //         drop(_4) -> bb2;
63 //     }
64 //     bb4: {
65 //         drop(_5) -> bb3;
66 //     }
67 //     bb5: {
68 //         drop(_6) -> bb4;
69 //     }
70 //     bb6: {
71 //         StorageDead(_6);
72 //         _0 = ();
73 //         drop(_5) -> [return: bb7, unwind: bb3];
74 //     }
75 //     bb7: {
76 //         StorageDead(_5);
77 //         drop(_4) -> bb8;
78 //     }
79 //     bb8: {
80 //         StorageDead(_4);
81 //         StorageDead(_2);
82 //         StorageDead(_1);
83 //         return;
84 //     }
85 // END rustc.node4.SimplifyCfg-initial.after.mir