wasm-bindgen
wasm-bindgen copied to clipboard
Error regenerating `web-sys` with current WebGPU IDL
Describe the Bug
Attempting to rebuild web-sys with the current WebGPU IDL produces an error that seems mistargetted.
Steps to Reproduce
- Replace contents of
crates/web-sys/webidls/unstable/WebGPU.webidlwith https://gpuweb.github.io/gpuweb/#idl-index cd crates/web-syscargo run --release --package wasm-bindgen-webidl -- webidls src/features
Expected Behavior
web-sys is successfully regenerated
Actual Behavior
Error: compiling WebIDL into wasm-bindgen bindings in file "webidls/enabled/BatteryManager.webidl", line 13 column 17
Caused by:
failed to parse webidl at byte position 35773
Additional Context
The error points to webidls/enabled/BatteryManager.webidl being the problem, however, running cargo run --release --package wasm-bindgen-webidl -- webidls src/features without first updating webidls/unstable/WebGPU.webidl does not result in an error and successfully regenerates web-sys. webidls/unstable/WebGPU.webidl is the only files that is modified, webidls/enabled/BatteryManager.webidl is untouched, so I would assume the problem is with the current WebGPU IDL. I however am not really sure how to proceed with debugging this error.
This is (partially?) resolved by https://github.com/rustwasm/wasm-bindgen/pull/2907. There is potentially still a remaining issue concerning the code-span targetting of the error message; the problem definitely originated in webidls/unstable/WebGPU.webidl, not in webidls/enabled/BatteryManager.webidl. That is however a comparatively minor issue that may not pop-up again until more new features are added to the WebIDL spec. I'm not quite sure whether to leave this issue open, or whether this isn't worth digging into and closing it here.
If you can still reproduce the error message (in a different manner perhaps) I think it might be good to log an issue about that. I know there's some internal trickery about concatenating sources and dealing with spans and it sounds like the bug is in there. If you can't easily reproduce though I think this is fine to close.