fork/rust

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

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

master
1.5 KiB66 linesraw
1- // MIR for `array_bound` before NormalizeArrayLen
2+ // MIR for `array_bound` after NormalizeArrayLen
3  
4  fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
5      debug index => _1;
6      debug slice => _2;
7      let mut _0: u8;
8      let mut _3: bool;
9      let mut _4: usize;
10      let mut _5: usize;
11      let mut _6: &[u8];
12      let mut _7: &[u8; N];
13      let _8: usize;
14      let mut _9: usize;
15      let mut _10: bool;
16  
17      bb0: {
18          StorageLive(_3);
19          StorageLive(_4);
20          _4 = _1;
21          StorageLive(_5);
22          StorageLive(_6);
23          StorageLive(_7);
24          _7 = &(*_2);
25          _6 = move _7 as &[u8] (PointerCoercion(Unsize));
26          StorageDead(_7);
27-         _5 = Len((*_6));
28+         _5 = const N;
29          goto -> bb1;
30      }
31  
32      bb1: {
33          StorageDead(_6);
34          _3 = Lt(move _4, move _5);
35          switchInt(move _3) -> [0: bb4, otherwise: bb2];
36      }
37  
38      bb2: {
39          StorageDead(_5);
40          StorageDead(_4);
41          StorageLive(_8);
42          _8 = _1;
43          _9 = Len((*_2));
44          _10 = Lt(_8, _9);
45          assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue];
46      }
47  
48      bb3: {
49          _0 = (*_2)[_8];
50          StorageDead(_8);
51          goto -> bb5;
52      }
53  
54      bb4: {
55          StorageDead(_5);
56          StorageDead(_4);
57          _0 = const 42_u8;
58          goto -> bb5;
59      }
60  
61      bb5: {
62          StorageDead(_3);
63          return;
64      }
65  }
66