Skip to content

Stability set to Unknown intially and triggering assert on non-empty value coming in #1666

@vados-cosmonic

Description

@vados-cosmonic

In attempting to implement @since and related feature gates in jco I ran into an issue that may be long here.

First, all the Stability values in functions on the Resolve seem to be Unknown.

Secondly, it seems that there's a panic when running wit-bindgen on newer WITs with @since annotations in them -- in particular the code that panics is the following:

https://github.com/bytecodealliance/wasm-tools/blob/v1.212.0/crates/wit-parser/src/resolve.rs#L2350

I'm not sure exactly why but there is already a value of Unknown in place and when the new value (correct seeming) value comes along, the previous one existing triggers the assertion.

Assuming this case really shouldn't be happening (if the idea is that once the stability is encountered it should never change), it seems that at the very least a more complete error message (perhaps a bail rather than the assert_eq there) should be used at the very least

@cpetig ran into the panic due to that assert_eq:

thread 'main' panicked at …/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wit-parser-0.212.0/src/resolve.rs:2350:21:
assertion `left == right` failed
  left: Interface { id: Id { idx: 1 }, stability: Unknown }
 right: Interface { id: Id { idx: 1 }, stability: Stable { since: Version { major: 0, minor: 2, patch: 0 }, feature: None } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With a pretty basic WIT-only project with the following deps.toml:

cli = "https://github.com/WebAssembly/wasi-cli/archive/main.tar.gz"
clocks = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"

(i.e. you could reproduce it with a folder named wit with only that deps.toml and a call to wit-deps then a recent version of wit-bindgen

Metadata

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