Skip to content

fix(rust): box an optional of the struct itself (+3) - #3376

Merged
gHashTag merged 1 commit into
masterfrom
recursive-option-boxed
Sep 6, 2026
Merged

fix(rust): box an optional of the struct itself (+3)#3376
gHashTag merged 1 commit into
masterfrom
recursive-option-boxed

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Closes #3375

A struct holding an OPTIONAL of itself is infinitely sized in Rust:

pub left: Option<KDNode>             error[E0072]
pub children: [Option<OctNode>; 8]   the same, once per element

Zig writes ?KDNode and stores it inline, because its optional of a struct is a tagged union of known size. Rust needs the indirection spelled out, and rustc says so and names the repair.

Only Option<ThisStruct> is rewritten, and only on an exact name match. Vec<ThisStruct> is already indirect and is left alone; a bare ThisStruct would still be infinite but does not occur in the corpus, and guessing at a shape nothing exhibits is how a rule outgrows its evidence.

Measured: 357 → 360, zero regressionskd_tree, octree, quadtree.

Worth naming: octree.t27 was recorded as a regression in #3247, where I wrote that [8]?OctNode is "genuinely infinitely sized". That was true of the emitted Rust and not of the spec. It is no longer a regression, and the note that claimed it is now wrong.

Boundary control, four cases in one probe:

written emitted
?Node inside Node Option<Box<Node>>
?Other Option<Other> — untouched
?NodeExtra Option<NodeExtra> — an exact match does not catch a prefix
[]Node Vec<Node> — untouched

@gHashTag
gHashTag enabled auto-merge (squash) September 6, 2026 07:45
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-06 07:48:16 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 10
PRs with All Checks Green 6
READY 4
FAILING 10
PENDING 0
NO CHECKS YET 0

These columns do not partition: 4 + 10 + 0 + 0 = 14, and there are 16 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b1f4644c92c7 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 7eab199 into master Sep 6, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A struct holding an optional of itself is infinitely sized in Rust

1 participant