Commit 9af0261
fix(rt): handle zero-sized function types in decode and ZST recognition (#813)
## Summary
Fix two issues preventing correct handling of zero-sized function item
types (e.g., non-capturing closures):
1. **`#zeroSizedType` did not recognize `typeInfoFunType`** (`types.md`)
— Function items are inherently zero-sized (`#elemSize` already returns
0), but `#zeroSizedType` returned `false`, preventing `rvalueRef` from
materializing uninitialized closure locals.
2. **`#decodeConstant` had no rule for `typeInfoFunType`** (`data.md`)
— Zero-sized function constants fell through to the `thunk` wrapper
instead of decoding to `Aggregate(variantIdx(0), .List)`.
## Evidence
`closure-staged.rs` with `terminate-on-thunk`:
| | Steps | Result |
|---|---|---|
| Before | 44 | `thunk(#decodeConstant(constantKindZeroSized, _,
typeInfoFunType(_)))` |
| After | 266 | `#EndProgram` |
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Daniel Cumming <124537596+dkcumming@users.noreply.github.com>1 parent eafe909 commit 9af0261
3 files changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1921 | 1921 | | |
1922 | 1922 | | |
1923 | 1923 | | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1924 | 1927 | | |
1925 | 1928 | | |
1926 | 1929 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
352 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
0 commit comments