fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.2 KiB123 linesraw
1- // MIR for `main` before ConstProp
2+ // MIR for `main` after ConstProp
3  
4  fn main() -> () {
5      let mut _0: ();
6      let _1: A;
7      let mut _2: std::boxed::Box<[bool]>;
8      scope 1 {
9          debug a => _1;
10      }
11      scope 2 (inlined <Box<[bool]> as Default>::default) {
12          let _3: std::ptr::Unique<[bool]>;
13          let mut _4: std::ptr::Unique<[bool; 0]>;
14          scope 3 {
15              debug ptr => _3;
16          }
17          scope 4 (inlined Unique::<[bool; 0]>::dangling) {
18              let mut _5: std::ptr::NonNull<[bool; 0]>;
19              scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
20                  let mut _7: usize;
21                  scope 6 {
22                      let _6: *mut [bool; 0];
23                      scope 7 {
24                          debug ptr => _6;
25                          scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
26                              debug ptr => _6;
27                              let mut _8: *const [bool; 0];
28                              scope 12 {
29                                  scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
30                                      debug ptr => _6;
31                                      scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
32                                          debug self => _6;
33                                          let mut _9: *mut u8;
34                                          scope 15 {
35                                              scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
36                                                  debug ptr => _9;
37                                                  scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
38                                                      debug self => _9;
39                                                      scope 18 {
40                                                          scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
41                                                              debug self => _9;
42                                                          }
43                                                      }
44                                                  }
45                                              }
46                                          }
47                                      }
48                                  }
49                              }
50                          }
51                      }
52                      scope 8 (inlined align_of::<[bool; 0]>) {
53                      }
54                      scope 9 (inlined invalid_mut::<[bool; 0]>) {
55                          debug addr => _7;
56                          scope 10 {
57                          }
58                      }
59                  }
60              }
61          }
62      }
63  
64      bb0: {
65          StorageLive(_1);
66          StorageLive(_2);
67          StorageLive(_3);
68          StorageLive(_4);
69          StorageLive(_5);
70          StorageLive(_6);
71          StorageLive(_7);
72-         _7 = AlignOf([bool; 0]);
73-         _6 = _7 as *mut [bool; 0] (Transmute);
74+         _7 = const 1_usize;
75+         _6 = const {0x1 as *mut [bool; 0]};
76          StorageDead(_7);
77          StorageLive(_8);
78          StorageLive(_9);
79-         _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
80-         _5 = NonNull::<[bool; 0]> { pointer: _8 };
81+         _8 = const {0x1 as *const [bool; 0]};
82+         _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
83          StorageDead(_9);
84          StorageDead(_8);
85          StorageDead(_6);
86-         _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
87+         _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
88          StorageDead(_5);
89-         _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
90+         _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
91          StorageDead(_4);
92-         _2 = Box::<[bool]>(_3, const std::alloc::Global);
93+         _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
94          StorageDead(_3);
95-         _1 = A { foo: move _2 };
96+         _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
97          StorageDead(_2);
98          _0 = const ();
99          drop(_1) -> [return: bb1, unwind: bb2];
100      }
101  
102      bb1: {
103          StorageDead(_1);
104          return;
105      }
106  
107      bb2 (cleanup): {
108          resume;
109      }
110+ }
111+ 
112+ alloc11 (size: 8, align: 4) {
113+     01 00 00 00 00 00 00 00                         │ ........
114+ }
115+ 
116+ alloc10 (size: 8, align: 4) {
117+     01 00 00 00 00 00 00 00                         │ ........
118+ }
119+ 
120+ alloc7 (size: 8, align: 4) {
121+     01 00 00 00 00 00 00 00                         │ ........
122  }
123