wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

enum cases size is out of bounds

Open MatthiasGrandl opened this issue 1 year ago • 3 comments

I generated a very large enum (it's the icon set https://lucide.dev/icons/) . So I have 1424 cases, but sadly it breaks with wit-bindgen with the following error:

Caused by:
    enum cases size is out of bounds (at offset 0xdd)

I tried using a variant instead, but same error. So is this expected or a bug? Is there a suggested alternative for my usecase of exposing a typesafe icon set to my webassembly components?

MatthiasGrandl avatar Aug 06 '24 09:08 MatthiasGrandl

PS: the wit works as expected on the host side.

MatthiasGrandl avatar Aug 06 '24 09:08 MatthiasGrandl

Thanks for the report! The limit here should be fixed in https://github.com/bytecodealliance/wasm-tools/pull/1713

alexcrichton avatar Aug 06 '24 13:08 alexcrichton

@alexcrichton good stuff, thanks for hopping on this so quick! I just got started with the wasmtime environment and it's been lovely!

MatthiasGrandl avatar Aug 06 '24 13:08 MatthiasGrandl

any idea when this is making it in a release? I tried pulling in the git version of wit-bindgen, but limits are still there.

MatthiasGrandl avatar Sep 05 '24 14:09 MatthiasGrandl

The validation error was fixed in a relatively deep portion of the stack but that was awhile ago and so the update should have percolated by now.

@MatthiasGrandl could you detail a bit more how you're seeing this error? That'll help pinpoint what missed the update and what should get updated.

alexcrichton avatar Sep 05 '24 19:09 alexcrichton

It happens during compilation of a rust wasm component with cargo component build —release. It is using wit-bindgen and it uses the following enum in wit (attached as file).

icons.wit.txt

MatthiasGrandl avatar Sep 05 '24 23:09 MatthiasGrandl

Ah I think you're running into cargo component being on 215 which doesn't have this fix. In trying to update that locally that also needs a publish of wit-bindgen. I'll work on getting these updates out today.

alexcrichton avatar Sep 06 '24 14:09 alexcrichton

Ok a new wit-bindgen is released and https://github.com/bytecodealliance/cargo-component/pull/335 should update cargo-component. Mind trying again with a git version of cargo-component to confirm the issue is resolved once that merges?

alexcrichton avatar Sep 09 '24 20:09 alexcrichton