Skip to content

Commit

Permalink
Merge with upstream (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil authored Aug 2, 2024
2 parents 9872d3f + 4a9da20 commit d387cba
Show file tree
Hide file tree
Showing 14 changed files with 803 additions and 129 deletions.
179 changes: 84 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ ahash = { version = "0.8.11", default-features = false }
termcolor = "1.2.0"
indoc = "2.0.5"
gimli = "0.30.0"
id-arena = "2"

wasm-compose = { version = "0.215.0", path = "crates/wasm-compose" }
wasm-encoder = { version = "0.215.0", path = "crates/wasm-encoder" }
Expand Down
21 changes: 21 additions & 0 deletions crates/wasmparser/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ define_wasm_features! {
}
}

impl WasmFeatures {
/// Returns the feature set associated with the 1.0 version of the
/// WebAssembly specification or the "MVP" feature set.
pub fn wasm1() -> WasmFeatures {
WasmFeatures::FLOATS
}

/// Returns the feature set associated with the 2.0 version of the
/// WebAssembly specification.
pub fn wasm2() -> WasmFeatures {
WasmFeatures::wasm1()
| WasmFeatures::BULK_MEMORY
| WasmFeatures::REFERENCE_TYPES
| WasmFeatures::SIGN_EXTENSION
| WasmFeatures::MUTABLE_GLOBAL
| WasmFeatures::SATURATING_FLOAT_TO_INT
| WasmFeatures::MULTI_VALUE
| WasmFeatures::SIMD
}
}

impl From<WasmFeaturesInflated> for WasmFeatures {
#[inline]
fn from(inflated: WasmFeaturesInflated) -> Self {
Expand Down
5 changes: 4 additions & 1 deletion crates/wit-encoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version.workspace = true
workspace = true

[features]
default = ["serde"]
default = ["serde", "from-parser"]

# Enables JSON serialization/deserialization of the wit-encoder structures.

Expand All @@ -23,11 +23,14 @@ default = ["serde"]
# *Note*: The exact structure of the JSON is likely not going to be very stable over time,
# so slight tweaks and variants should be expected as this crate evolves.
serde = ["dep:serde", "semver/serde"]
from-parser = ["wit-parser", "id-arena"]

[dependencies]
semver = { workspace = true }
pretty_assertions = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
wit-parser = { workspace = true, optional = true }
id-arena = { workspace = true, optional = true }

[dev-dependencies]
indoc = { workspace = true }
Loading

0 comments on commit d387cba

Please sign in to comment.