Skip to content

Commit

Permalink
wasmparser: Fix From<wasmparser::StructType> for StructType (byteco…
Browse files Browse the repository at this point in the history
…dealliance#1245)

`Box<[T]>` doesn't implement `into_iter`, it is actually just calling `&[T]`'s
version of `into_iter` which doesn't actually give ownership.

Also, test `wasm-encoder` with this feature enabled in CI.
  • Loading branch information
fitzgen authored Oct 12, 2023
1 parent 9ebd467 commit a1d01ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
shell: bash
- run: cargo test --locked --all
- run: cargo test --locked -p wasmparser --benches
- run: cargo test --locked -p wasm-encoder --all-features
- run: cargo build --manifest-path crates/wast/Cargo.toml --no-default-features
- run: cargo build --manifest-path crates/wast/Cargo.toml --no-default-features --features wasm-module
- run: cmake -S ${{github.workspace}}/examples -B ${{github.workspace}}/examples/build -DCMAKE_BUILD_TYPE=Release
Expand Down
2 changes: 1 addition & 1 deletion crates/wasm-encoder/src/core/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct StructType {
impl From<wasmparser::StructType> for StructType {
fn from(struct_ty: wasmparser::StructType) -> Self {
StructType {
fields: struct_ty.fields.into_iter().map(Into::into).collect(),
fields: struct_ty.fields.iter().cloned().map(Into::into).collect(),
}
}
}
Expand Down

0 comments on commit a1d01ab

Please sign in to comment.