Follow-up to #1 / #12.
PR #12 added MAX_EXPR_DEPTH = 256 in crates/my-lang/src/checker.rs so that pathological inputs now produce a clean ExpressionTooDeep diagnostic instead of OOM-aborting. That fixes the symptom.
The root cause is still unknown:
- The checker's
check_expr and is_assignable_from are structurally linear in AST size on the inputs I tested on Linux.
- I could not reproduce a 16–32 GiB allocation locally on Linux even with the issue's exact
str_concat / format shape, depth, and function count.
- The original report is
stable-x86_64-pc-windows-msvc, rustc 1.95.0 on Windows 11 Pro for Workstations 26300, against a ~330 LOC scaffold tool.
What this issue tracks
- Obtain a copy of the actual ~330 LOC repro that triggered the OOM (the issue describes the shape but the file itself was not attached).
- Reproduce on Windows with the same toolchain, ideally with
heaptrack / dhat / Windows ETW + -Z time-passes to localise the allocator hotspot.
- Confirm whether the cause is in the checker, in HIR/MIR lowering (only on
my run), or elsewhere (e.g. a Windows allocator interaction or a debug-info / span-table blow-up). The issue title says "type-checker" but my check is only parse + check, so it's confirmed pre-lowering.
- If a real superlinear hotspot exists, replace the depth guard's role-of-last-resort with a targeted fix (memoisation of
str_concat/format subexpressions, or a structural rewrite).
Why this matters
The depth guard prevents OOM but at the cost of rejecting deep-but-otherwise-legal programs at 256 nesting levels. If the real cost is exponential in the number of templating sites (as the original report suggests with "aggregate complexity of nested string-building constructs"), then files well under the depth limit could still hit it. We need to know.
Out of scope
- Parser-side depth guard (tracked separately).
- Memoisation refactor as a speculative fix without first having a real measurement.
Follow-up to #1 / #12.
PR #12 added
MAX_EXPR_DEPTH = 256incrates/my-lang/src/checker.rsso that pathological inputs now produce a cleanExpressionTooDeepdiagnostic instead of OOM-aborting. That fixes the symptom.The root cause is still unknown:
check_exprandis_assignable_fromare structurally linear in AST size on the inputs I tested on Linux.str_concat/formatshape, depth, and function count.stable-x86_64-pc-windows-msvc, rustc 1.95.0on Windows 11 Pro for Workstations 26300, against a ~330 LOC scaffold tool.What this issue tracks
heaptrack/dhat/ Windows ETW +-Z time-passesto localise the allocator hotspot.my run), or elsewhere (e.g. a Windows allocator interaction or a debug-info / span-table blow-up). The issue title says "type-checker" butmy checkis onlyparse+check, so it's confirmed pre-lowering.str_concat/formatsubexpressions, or a structural rewrite).Why this matters
The depth guard prevents OOM but at the cost of rejecting deep-but-otherwise-legal programs at 256 nesting levels. If the real cost is exponential in the number of templating sites (as the original report suggests with "aggregate complexity of nested string-building constructs"), then files well under the depth limit could still hit it. We need to know.
Out of scope