Commit c73eb19
transpiler: fix let ref mut rvalue binding to emit owned value
When `let ref mut x = rvalue_expr;` binds a mutable reference to an
rvalue (like String::new()), emit `auto x = rvalue_expr;` (owned value)
instead of `auto& x = rvalue_expr;` (dangling reference to temporary).
Add is_rvalue_expr() helper that detects function calls, literals,
struct constructors, and other rvalue expressions. The ref_suffix
is suppressed when by_ref + mut + rvalue init.
Semver parity: 64 → 63 errors (1 fewer). Full matrix: 5/6 pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 6499fe6 commit c73eb19
2 files changed
+64
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2078 | 2078 | | |
2079 | 2079 | | |
2080 | 2080 | | |
2081 | | - | |
| 2081 | + | |
2082 | 2082 | | |
2083 | 2083 | | |
2084 | 2084 | | |
| |||
2500 | 2500 | | |
2501 | 2501 | | |
2502 | 2502 | | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
2503 | 2507 | | |
2504 | 2508 | | |
2505 | 2509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8497 | 8497 | | |
8498 | 8498 | | |
8499 | 8499 | | |
8500 | | - | |
8501 | | - | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + | |
8502 | 8515 | | |
8503 | 8516 | | |
8504 | 8517 | | |
| |||
18354 | 18367 | | |
18355 | 18368 | | |
18356 | 18369 | | |
| 18370 | + | |
| 18371 | + | |
| 18372 | + | |
| 18373 | + | |
| 18374 | + | |
| 18375 | + | |
| 18376 | + | |
| 18377 | + | |
| 18378 | + | |
| 18379 | + | |
| 18380 | + | |
| 18381 | + | |
| 18382 | + | |
| 18383 | + | |
| 18384 | + | |
| 18385 | + | |
| 18386 | + | |
| 18387 | + | |
| 18388 | + | |
| 18389 | + | |
18357 | 18390 | | |
18358 | 18391 | | |
18359 | 18392 | | |
| |||
32495 | 32528 | | |
32496 | 32529 | | |
32497 | 32530 | | |
| 32531 | + | |
| 32532 | + | |
| 32533 | + | |
| 32534 | + | |
| 32535 | + | |
| 32536 | + | |
| 32537 | + | |
| 32538 | + | |
| 32539 | + | |
| 32540 | + | |
| 32541 | + | |
| 32542 | + | |
| 32543 | + | |
| 32544 | + | |
| 32545 | + | |
| 32546 | + | |
| 32547 | + | |
| 32548 | + | |
| 32549 | + | |
| 32550 | + | |
| 32551 | + | |
| 32552 | + | |
| 32553 | + | |
| 32554 | + | |
32498 | 32555 | | |
0 commit comments