Skip to content

Allow specifying wasm features to be enabled (or enable all features) in wac #145

@tanishiking

Description

@tanishiking

Currently, wac uses a predefined set of Wasm features when creating a Validator.
Specifically, it enables the component_model feature alongside the defaults,

let mut validator = Validator::new_with_features(WasmFeatures {
component_model: true,
..Default::default()
});

Validator::new_with_features(WasmFeatures {
component_model: true,
..Default::default()
})

When this configuration doesn't contain, for example gc, wac fails to validate when it runs against the Wasm components that depend on gc.

(Context: I'm trying to support Wasm Component in Scala (using WasmGC), and struggled to use wac with it)

proposal

  • (1) Allow to specify which wasm features to be enabled (using --features flag as wasm-tools does), or
  • (2) Enable all features as I do in the workaround below

Workaround

A workaround involves modifying the Validator to use WasmFeatures::all():

- Validator::new_with_features(WasmFeatures {
-     component_model: true,
-     ..Default::default()
- })
+ Validator::new_with_features(WasmFeatures::all())

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