Commit e18539c
review #2: traverse assignment-target reads uniformly in semantic passes
Controlled-assignment targets evaluate subexpressions (a field base, an index
expression) that are genuine reads of bindings. Several use/ident/effect/capture
passes only visited the assigned value, silently dropping those target reads.
Route them all through crate::hir::assign_target_reads / its AST analogue:
local.rs: collect_hir_stmt_idents, collect_hir_stmt_effect_events,
collect_hir_stmt_inline_capture_uses,
collect_closure_local_moved_uses_from_stmt,
collect_retained_closure_captures_from_stmt
body.rs: collect_stmt_uses, collect_spawn_capture_idents_from_stmt,
check_explicit_closure_captures_stmt
analyzer: check_match_exhaustiveness, check_unknown_bindings
This makes use-after-move, unknown-binding, capture, and effect analysis see
reads like obj/idx in 'obj.field[idx] = value' that were previously invisible.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 89674fa commit e18539c
3 files changed
Lines changed: 68 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1996 | 1996 | | |
1997 | 1997 | | |
1998 | 1998 | | |
1999 | | - | |
2000 | | - | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
2001 | 2005 | | |
2002 | 2006 | | |
2003 | 2007 | | |
| |||
3299 | 3303 | | |
3300 | 3304 | | |
3301 | 3305 | | |
3302 | | - | |
3303 | | - | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
3304 | 3312 | | |
3305 | 3313 | | |
3306 | 3314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
| |||
1068 | 1072 | | |
1069 | 1073 | | |
1070 | 1074 | | |
1071 | | - | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1072 | 1082 | | |
1073 | 1083 | | |
1074 | 1084 | | |
| |||
3645 | 3655 | | |
3646 | 3656 | | |
3647 | 3657 | | |
3648 | | - | |
3649 | | - | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
3650 | 3665 | | |
3651 | 3666 | | |
3652 | 3667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1047 | 1050 | | |
1048 | 1051 | | |
1049 | 1052 | | |
| |||
1200 | 1203 | | |
1201 | 1204 | | |
1202 | 1205 | | |
1203 | | - | |
1204 | | - | |
| 1206 | + | |
1205 | 1207 | | |
1206 | 1208 | | |
1207 | 1209 | | |
1208 | 1210 | | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1209 | 1219 | | |
1210 | 1220 | | |
1211 | 1221 | | |
| |||
2050 | 2060 | | |
2051 | 2061 | | |
2052 | 2062 | | |
2053 | | - | |
2054 | | - | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2055 | 2070 | | |
2056 | 2071 | | |
2057 | 2072 | | |
| |||
2084 | 2099 | | |
2085 | 2100 | | |
2086 | 2101 | | |
2087 | | - | |
2088 | | - | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
2089 | 2109 | | |
2090 | 2110 | | |
2091 | 2111 | | |
| |||
2310 | 2330 | | |
2311 | 2331 | | |
2312 | 2332 | | |
2313 | | - | |
2314 | | - | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
2315 | 2340 | | |
2316 | 2341 | | |
2317 | 2342 | | |
| |||
0 commit comments