Commit 3a531e1
feat(ADR-022 M3): model loan-vs-loan exclusivity in the Polonius extractor
Closes the borrow-vs-borrow divergence class (2 of the 9 allowlisted
extractor↔lexical disagreements). The extractor now emits a conflict for a
direct read of a place while a live `&mut` (exclusive) loan covers it:
* `let b = &mut x` reads x at its creation point while the first `&mut x`
is still live → borrow_mutref_conflict now AGREES;
* `let y = x` (plain read) while `&mut x` is live → borrow_mutref_use_while
now AGREES.
Implementation: add rl_excl to the loan record (threaded from rhs_borrows);
a post-pass scans use_at × loans and, for each read of var v while an
EXCLUSIVE loan rooted at v is live, emits conflict_at — excluding the loan's
own birth point (that read IS the creation) and reads through the borrow
(`*a` has root a, not x, via PlaceDeref). Emission is liveness-gated by the
solver, so NLL last-use shortening keeps valid code accepted; shared `&`
loans never trigger it.
Tests: t_extract_mutref_conflict / _use_while (flagged), t_extract_shared_
read_ok (new fixture — read-while-shared-borrowed accepted, anti-over-reject).
Allowlist 9→7; corpus parallel-run gate green (no new divergence). 528 tests.
Remaining M3 divergences: return-escape/outlives-owner (4, needs escape
analysis), captured-linear (2), call-aliasing mut-param-arg (1).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 2b3f63c commit 3a531e1
3 files changed
Lines changed: 76 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| |||
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
210 | | - | |
| 216 | + | |
211 | 217 | | |
212 | 218 | | |
213 | 219 | | |
214 | | - | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| |||
373 | 379 | | |
374 | 380 | | |
375 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
376 | 404 | | |
377 | 405 | | |
378 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
163 | 184 | | |
164 | 185 | | |
165 | 186 | | |
| |||
288 | 309 | | |
289 | 310 | | |
290 | 311 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
297 | 320 | | |
298 | 321 | | |
299 | 322 | | |
| |||
351 | 374 | | |
352 | 375 | | |
353 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
354 | 380 | | |
355 | 381 | | |
356 | 382 | | |
| |||
0 commit comments