Commit bd3a221
committed
Auto merge of rust-lang#118175 - lqd:unify-live-loans, r=matthewjasper
Centralize live loans maintenance to fix scope differences due to liveness
As found in the recent [polonius crater run](rust-lang#117593 (comment)), NLLs and the location-insensitive polonius computed different scopes on some specific CFG shapes, e.g. the following.

I had missed that liveness data was pushed from different sources than just the liveness computation: there are a few places that do this -- and some of them may be unneeded or at the very least untested, as no tests changed when I tried removing some of them.
Here, `_6` is e.g. dead on entry to `bb2[0]` during `liveness::trace`, but its regions will be marked as live later during "constraint generation" (which I plan to refactor away and put in the liveness module soon). This should cause the inflowing loans to be marked live, but they were only computed in `liveness::trace`.
Therefore, this PR moves live loan maintenance to `LivenessValues`, so that the various places pushing liveness data will all also update live loans at the same time -- except for promoteds which I don't believe need them, and their liveness handling is already interesting/peculiar.
All the regressions I saw in the initial crater run were related to this kind of shapes, and this change did fix all of them on the [next run](rust-lang#117593 (comment)).
r? `@matthewjasper`
(This will conflict with rust-lang#117880 but whichever lands first is fine by me, the end goal is the same for both)File tree
7 files changed
+144
-102
lines changed- compiler/rustc_borrowck/src
- region_infer
- type_check
- liveness
- tests/ui/nll/polonius
7 files changed
+144
-102
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
| 436 | + | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
124 | 120 | | |
125 | 121 | | |
126 | 122 | | |
| |||
161 | 157 | | |
162 | 158 | | |
163 | 159 | | |
164 | | - | |
165 | 160 | | |
166 | 161 | | |
167 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
| 33 | + | |
| 34 | + | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 122 | | |
127 | 123 | | |
128 | 124 | | |
| |||
335 | 331 | | |
336 | 332 | | |
337 | 333 | | |
338 | | - | |
339 | 334 | | |
340 | 335 | | |
341 | 336 | | |
| |||
389 | 384 | | |
390 | 385 | | |
391 | 386 | | |
392 | | - | |
393 | 387 | | |
394 | 388 | | |
395 | 389 | | |
| |||
2325 | 2319 | | |
2326 | 2320 | | |
2327 | 2321 | | |
2328 | | - | |
| 2322 | + | |
2329 | 2323 | | |
2330 | 2324 | | |
2331 | 2325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| 125 | + | |
123 | 126 | | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
125 | 154 | | |
126 | 155 | | |
127 | 156 | | |
128 | 157 | | |
129 | 158 | | |
130 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
131 | 164 | | |
132 | 165 | | |
133 | 166 | | |
| |||
140 | 173 | | |
141 | 174 | | |
142 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
143 | 183 | | |
144 | 184 | | |
145 | 185 | | |
146 | 186 | | |
147 | 187 | | |
148 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
149 | 200 | | |
150 | 201 | | |
151 | 202 | | |
| |||
185 | 236 | | |
186 | 237 | | |
187 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
188 | 248 | | |
189 | 249 | | |
190 | 250 | | |
| |||
Lines changed: 15 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | | - | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
52 | | - | |
53 | | - | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | | - | |
59 | 54 | | |
60 | | - | |
| 55 | + | |
61 | 56 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
66 | 60 | | |
67 | | - | |
| 61 | + | |
68 | 62 | | |
69 | 63 | | |
70 | 64 | | |
| |||
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
| 72 | + | |
79 | 73 | | |
80 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
91 | | - | |
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
| |||
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 126 | | |
133 | 127 | | |
134 | 128 | | |
| |||
519 | 513 | | |
520 | 514 | | |
521 | 515 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 516 | + | |
530 | 517 | | |
531 | 518 | | |
532 | 519 | | |
| |||
577 | 564 | | |
578 | 565 | | |
579 | 566 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
| 567 | + | |
588 | 568 | | |
589 | 569 | | |
590 | 570 | | |
| |||
594 | 574 | | |
595 | 575 | | |
596 | 576 | | |
597 | | - | |
598 | 577 | | |
599 | 578 | | |
600 | 579 | | |
601 | 580 | | |
602 | 581 | | |
603 | 582 | | |
604 | 583 | | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | 584 | | |
612 | 585 | | |
613 | 586 | | |
| |||
619 | 592 | | |
620 | 593 | | |
621 | 594 | | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | 595 | | |
629 | 596 | | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | 597 | | |
638 | 598 | | |
639 | 599 | | |
| |||
0 commit comments