Skip to content

instance type declaration size is out of bounds #1104

Open
@MangoPeachGrape

Description

Apologies if this isn't the correct place to report this.

I'm running into linking issues in rust after increasing the number of functions in the wit file.

I run wit-bindgen rust . to generate rust bindings from a wit file. That is then compiled in a static lib crate, which succeeds, but linking fails for a binary that is linked against the static library. Compiling the whole workspace with cargo b -r --target wasm32-wasip2.

error: linking with `wasm-component-ld` failed: exit code: 1
note: error: failed to parse core wasm for componentization
          Caused by:
              0: decoding custom section component-type:wit-bindgen:0.36.0:x:xx:xxx:encoded world
              1: instance type declaration size is out of bounds (at offset 0x8b)

The issue seems to start happening when there is around 45k functions. 44k functions worked fine, 45.5k didn't work, with everything else being the same.

Additional information that might matter:

  • The wit file currently has <20k types (resources, records, enums combined)
  • The produced .rs from wit-bindgen is ~60mb
  • The produced .rlib with the output of wit-bindgen is ~200mb
  • rustc 1.85.0-nightly (4d669fb34 2024-12-08)

Let me know if anything else is needed to identify the issue.
Thanks in advance!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions