Repository: bytecodealliance/wasm-tools
Pull request #1183 (2023-08-25 17:10:34)

Bump crate versions
This is intended to be the final bump of breaking/major changes before WasmCon on Sep 6-7


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index c50afeb0..9047ce01 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1707,7 +1707,7 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
 
 [[package]]
 name = "wasm-compose"
-version = "0.4.1"
+version = "0.4.2"
 dependencies = [
  "anyhow",
  "glob",
@@ -1719,9 +1719,9 @@ dependencies = [
  "serde",
  "serde_yaml",
  "smallvec",
- "wasm-encoder 0.31.1",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasm-encoder 0.32.0",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wat",
  "wit-component",
 ]
@@ -1729,25 +1729,25 @@ dependencies = [
 [[package]]
 name = "wasm-encoder"
 version = "0.31.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16"
 dependencies = [
- "anyhow",
  "leb128",
- "tempfile",
- "wasmparser 0.111.0",
 ]
 
 [[package]]
 name = "wasm-encoder"
-version = "0.31.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16"
+version = "0.32.0"
 dependencies = [
+ "anyhow",
  "leb128",
+ "tempfile",
+ "wasmparser 0.112.0",
 ]
 
 [[package]]
 name = "wasm-metadata"
-version = "0.10.2"
+version = "0.10.3"
 dependencies = [
  "anyhow",
  "clap 4.3.22",
@@ -1755,14 +1755,14 @@ dependencies = [
  "serde",
  "serde_json",
  "spdx",
- "wasm-encoder 0.31.1",
- "wasmparser 0.111.0",
+ "wasm-encoder 0.32.0",
+ "wasmparser 0.112.0",
  "wat",
 ]
 
 [[package]]
 name = "wasm-mutate"
-version = "0.2.31"
+version = "0.2.32"
 dependencies = [
  "anyhow",
  "clap 4.3.22",
@@ -1771,9 +1771,9 @@ dependencies = [
  "log",
  "rand",
  "thiserror",
- "wasm-encoder 0.31.1",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasm-encoder 0.32.0",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wat",
 ]
 
@@ -1790,14 +1790,14 @@ dependencies = [
  "num_cpus",
  "rand",
  "wasm-mutate",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wasmtime",
 ]
 
 [[package]]
 name = "wasm-shrink"
-version = "0.1.32"
+version = "0.1.33"
 dependencies = [
  "anyhow",
  "blake3",
@@ -1806,14 +1806,14 @@ dependencies = [
  "log",
  "rand",
  "wasm-mutate",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wat",
 ]
 
 [[package]]
 name = "wasm-smith"
-version = "0.12.14"
+version = "0.12.15"
 dependencies = [
  "arbitrary",
  "criterion",
@@ -1823,15 +1823,15 @@ dependencies = [
  "libfuzzer-sys",
  "rand",
  "serde",
- "wasm-encoder 0.31.1",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasm-encoder 0.32.0",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wat",
 ]
 
 [[package]]
 name = "wasm-tools"
-version = "1.0.39"
+version = "1.0.40"
 dependencies = [
  "addr2line",
  "anyhow",
@@ -1852,17 +1852,17 @@ dependencies = [
  "tempfile",
  "termcolor",
  "wasm-compose",
- "wasm-encoder 0.31.1",
+ "wasm-encoder 0.32.0",
  "wasm-metadata",
  "wasm-mutate",
  "wasm-shrink",
  "wasm-smith",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wast",
  "wat",
  "wit-component",
- "wit-parser 0.10.0",
+ "wit-parser 0.11.0",
  "wit-smith",
 ]
 
@@ -1874,8 +1874,8 @@ dependencies = [
  "wasm-mutate",
  "wasm-shrink",
  "wasm-smith",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wast",
  "wat",
 ]
@@ -1890,16 +1890,16 @@ dependencies = [
  "libfuzzer-sys",
  "log",
  "tempfile",
- "wasm-encoder 0.31.1",
+ "wasm-encoder 0.32.0",
  "wasm-mutate",
  "wasm-smith",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wasmtime",
  "wast",
  "wat",
  "wit-component",
- "wit-parser 0.10.0",
+ "wit-parser 0.11.0",
  "wit-smith",
 ]
 
@@ -1915,7 +1915,7 @@ dependencies = [
 
 [[package]]
 name = "wasmparser"
-version = "0.111.0"
+version = "0.112.0"
 dependencies = [
  "anyhow",
  "criterion",
@@ -1923,7 +1923,7 @@ dependencies = [
  "once_cell",
  "rayon",
  "semver",
- "wasm-encoder 0.31.1",
+ "wasm-encoder 0.32.0",
  "wast",
  "wat",
 ]
@@ -1940,13 +1940,13 @@ dependencies = [
 
 [[package]]
 name = "wasmprinter"
-version = "0.2.63"
+version = "0.2.64"
 dependencies = [
  "anyhow",
  "diff",
  "rayon",
  "tempfile",
- "wasmparser 0.111.0",
+ "wasmparser 0.112.0",
  "wast",
  "wat",
 ]
@@ -1973,7 +1973,7 @@ dependencies = [
  "serde",
  "serde_json",
  "target-lexicon",
- "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasm-encoder 0.31.1",
  "wasmparser 0.110.0",
  "wasmtime-component-macro",
  "wasmtime-component-util",
@@ -2070,7 +2070,7 @@ dependencies = [
  "serde",
  "target-lexicon",
  "thiserror",
- "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasm-encoder 0.31.1",
  "wasmparser 0.110.0",
  "wasmprinter 0.2.62",
  "wasmtime-component-util",
@@ -2142,7 +2142,7 @@ dependencies = [
  "rand",
  "rustix 0.38.8",
  "sptr",
- "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasm-encoder 0.31.1",
  "wasmtime-asm-macros",
  "wasmtime-environ",
  "wasmtime-jit-debug",
@@ -2204,21 +2204,21 @@ dependencies = [
 
 [[package]]
 name = "wast"
-version = "63.0.0"
+version = "64.0.0"
 dependencies = [
  "anyhow",
  "leb128",
  "memchr",
  "rayon",
  "unicode-width",
- "wasm-encoder 0.31.1",
- "wasmparser 0.111.0",
+ "wasm-encoder 0.32.0",
+ "wasmparser 0.112.0",
  "wat",
 ]
 
 [[package]]
 name = "wat"
-version = "1.0.70"
+version = "1.0.71"
 dependencies = [
  "wast",
 ]
@@ -2348,7 +2348,7 @@ checksum = "bd1df36d9fd0bbe4849461de9b969f765170f4e0f90497d580a235d515722b10"
 
 [[package]]
 name = "wit-component"
-version = "0.13.2"
+version = "0.14.0"
 dependencies = [
  "anyhow",
  "bitflags 2.4.0",
@@ -2359,13 +2359,13 @@ dependencies = [
  "pretty_assertions",
  "serde",
  "serde_json",
- "wasm-encoder 0.31.1",
+ "wasm-encoder 0.32.0",
  "wasm-metadata",
- "wasmparser 0.111.0",
- "wasmprinter 0.2.63",
+ "wasmparser 0.112.0",
+ "wasmprinter 0.2.64",
  "wasmtime",
  "wat",
- "wit-parser 0.10.0",
+ "wit-parser 0.11.0",
 ]
 
 [[package]]
@@ -2386,7 +2386,7 @@ dependencies = [
 
 [[package]]
 name = "wit-parser"
-version = "0.10.0"
+version = "0.11.0"
 dependencies = [
  "anyhow",
  "env_logger",
@@ -2409,13 +2409,13 @@ dependencies = [
  "env_logger",
  "libfuzzer-sys",
  "log",
- "wasmprinter 0.2.63",
- "wit-parser 0.10.0",
+ "wasmprinter 0.2.64",
+ "wit-parser 0.11.0",
 ]
 
 [[package]]
 name = "wit-smith"
-version = "0.1.9"
+version = "0.1.10"
 dependencies = [
  "arbitrary",
  "clap 4.3.22",
@@ -2423,7 +2423,7 @@ dependencies = [
  "log",
  "semver",
  "wit-component",
- "wit-parser 0.10.0",
+ "wit-parser 0.11.0",
 ]
 
 [[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 75290192..90738fed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-tools"
-version = "1.0.39"
+version = "1.0.40"
 authors = ["The Wasmtime Project Developers"]
 edition.workspace = true
 description = "CLI tools for interoperating with WebAssembly files"
@@ -44,19 +44,19 @@ url = "2.0.0"
 pretty_assertions = "1.3.0"
 semver = "1.0.0"
 
-wasm-encoder = { version = "0.31.1", path = "crates/wasm-encoder" }
-wasm-compose = { version = "0.4.1", path = "crates/wasm-compose" }
-wasm-metadata = { version = "0.10.2", path = "crates/wasm-metadata" }
-wasm-mutate = { version = "0.2.31", path = "crates/wasm-mutate" }
-wasm-shrink = { version = "0.1.32", path = "crates/wasm-shrink" }
-wasm-smith = { version = "0.12.14", path = "crates/wasm-smith" }
-wasmparser = { version = "0.111.0", path = "crates/wasmparser" }
-wasmprinter = { version = "0.2.63", path = "crates/wasmprinter" }
-wast = { version = "63.0.0", path = "crates/wast" }
-wat = { version = "1.0.70", path = "crates/wat" }
-wit-component = { version = "0.13.2", path = "crates/wit-component" }
-wit-parser = { version = "0.10.0", path = "crates/wit-parser" }
-wit-smith = { version = "0.1.9", path = "crates/wit-smith" }
+wasm-encoder = { version = "0.32.0", path = "crates/wasm-encoder" }
+wasm-compose = { version = "0.4.2", path = "crates/wasm-compose" }
+wasm-metadata = { version = "0.10.3", path = "crates/wasm-metadata" }
+wasm-mutate = { version = "0.2.32", path = "crates/wasm-mutate" }
+wasm-shrink = { version = "0.1.33", path = "crates/wasm-shrink" }
+wasm-smith = { version = "0.12.15", path = "crates/wasm-smith" }
+wasmparser = { version = "0.112.0", path = "crates/wasmparser" }
+wasmprinter = { version = "0.2.64", path = "crates/wasmprinter" }
+wast = { version = "64.0.0", path = "crates/wast" }
+wat = { version = "1.0.71", path = "crates/wat" }
+wit-component = { version = "0.14.0", path = "crates/wit-component" }
+wit-parser = { version = "0.11.0", path = "crates/wit-parser" }
+wit-smith = { version = "0.1.10", path = "crates/wit-smith" }
 
 [dependencies]
 anyhow = { workspace = true }
diff --git a/crates/wasm-compose/Cargo.toml b/crates/wasm-compose/Cargo.toml
index 2446ede6..75bdcb13 100644
--- a/crates/wasm-compose/Cargo.toml
+++ b/crates/wasm-compose/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-compose"
-version = "0.4.1"
+version = "0.4.2"
 edition.workspace = true
 authors = ["Peter Huene <peter@huene.dev>"]
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wasm-encoder/Cargo.toml b/crates/wasm-encoder/Cargo.toml
index eb771f87..a20a70bb 100644
--- a/crates/wasm-encoder/Cargo.toml
+++ b/crates/wasm-encoder/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-encoder"
-version = "0.31.1"
+version = "0.32.0"
 authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wasm-metadata/Cargo.toml b/crates/wasm-metadata/Cargo.toml
index f01563e0..3bb2b5e9 100644
--- a/crates/wasm-metadata/Cargo.toml
+++ b/crates/wasm-metadata/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-metadata"
-version = "0.10.2"
+version = "0.10.3"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-metadata"
diff --git a/crates/wasm-mutate/Cargo.toml b/crates/wasm-mutate/Cargo.toml
index 057b0434..3d0e2528 100644
--- a/crates/wasm-mutate/Cargo.toml
+++ b/crates/wasm-mutate/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-mutate"
-version = "0.2.31"
+version = "0.2.32"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-mutate"
diff --git a/crates/wasm-mutate/src/info.rs b/crates/wasm-mutate/src/info.rs
index 3d2415ee..3e2bf0b6 100644
--- a/crates/wasm-mutate/src/info.rs
+++ b/crates/wasm-mutate/src/info.rs
@@ -1,6 +1,6 @@
 use crate::{
     module::{PrimitiveTypeInfo, TypeInfo},
-    Error, Result,
+    Result,
 };
 use std::collections::HashSet;
 use std::convert::TryFrom;
@@ -92,20 +92,8 @@ impl<'a> ModuleInfo<'a> {
                     info.section(SectionId::Type.into(), reader.range(), input_wasm);
 
                     // Save function types
-                    for rec_group in reader {
-                        if let Ok(rg) = rec_group {
-                            if rg.types().len() != 1 {
-                                return Err(Error::unsupported("GC types not supported yet"));
-                            }
-                            for st in rg.types() {
-                                if st.is_final || st.supertype_idx.is_some() {
-                                    return Err(Error::unsupported("GC types not supported yet"));
-                                }
-                                let typeinfo =
-                                    TypeInfo::try_from(st.clone().structural_type).unwrap();
-                                info.types_map.push(typeinfo);
-                            }
-                        }
+                    for ty in reader.into_iter_err_on_gc_types() {
+                        info.types_map.push(ty?.into());
                     }
                 }
                 Payload::ImportSection(reader) => {
diff --git a/crates/wasm-mutate/src/module.rs b/crates/wasm-mutate/src/module.rs
index 4b997df2..4431a14f 100644
--- a/crates/wasm-mutate/src/module.rs
+++ b/crates/wasm-mutate/src/module.rs
@@ -1,5 +1,4 @@
-use crate::{Error, Result};
-use std::convert::TryFrom;
+use crate::Result;
 use wasm_encoder::{BlockType, HeapType, RefType, ValType};
 
 #[derive(Debug, Copy, Clone, PartialEq)]
@@ -49,30 +48,20 @@ impl From<wasmparser::RefType> for PrimitiveTypeInfo {
     }
 }
 
-impl TryFrom<wasmparser::StructuralType> for TypeInfo {
-    type Error = Error;
-
-    fn try_from(value: wasmparser::StructuralType) -> Result<Self> {
-        match value {
-            wasmparser::StructuralType::Func(ft) => Ok(TypeInfo::Func(FuncInfo {
-                params: ft
-                    .params()
-                    .iter()
-                    .map(|&t| PrimitiveTypeInfo::from(t))
-                    .collect(),
-                returns: ft
-                    .results()
-                    .iter()
-                    .map(|&t| PrimitiveTypeInfo::from(t))
-                    .collect(),
-            })),
-            wasmparser::StructuralType::Array(_) => {
-                Err(Error::unsupported("Array types are not supported yet."))
-            }
-            wasmparser::StructuralType::Struct(_) => {
-                Err(Error::unsupported("Struct types are not supported yet."))
-            }
-        }
+impl From<wasmparser::FuncType> for TypeInfo {
+    fn from(ft: wasmparser::FuncType) -> Self {
+        TypeInfo::Func(FuncInfo {
+            params: ft
+                .params()
+                .iter()
+                .map(|&t| PrimitiveTypeInfo::from(t))
+                .collect(),
+            returns: ft
+                .results()
+                .iter()
+                .map(|&t| PrimitiveTypeInfo::from(t))
+                .collect(),
+        })
     }
 }
 
diff --git a/crates/wasm-mutate/src/mutators/add_type.rs b/crates/wasm-mutate/src/mutators/add_type.rs
index ce289412..f2fe0c3e 100644
--- a/crates/wasm-mutate/src/mutators/add_type.rs
+++ b/crates/wasm-mutate/src/mutators/add_type.rs
@@ -2,7 +2,7 @@
 
 use super::Mutator;
 use crate::module::map_type;
-use crate::{Error, Result};
+use crate::Result;
 use rand::Rng;
 use std::iter;
 
@@ -55,32 +55,21 @@ impl Mutator for AddTypeMutator {
         if let Some(old_types) = config.info().get_type_section() {
             // Copy the existing types section over into the encoder.
             let reader = wasmparser::TypeSectionReader::new(old_types.data, 0)?;
-            for rec_group in reader {
-                for ty in rec_group?.types() {
-                    match ty.clone().structural_type {
-                        wasmparser::StructuralType::Func(ty) => {
-                            let params = ty
-                                .params()
-                                .iter()
-                                .copied()
-                                .map(map_type)
-                                .collect::<Result<Vec<_>, _>>()?;
-                            let results = ty
-                                .results()
-                                .iter()
-                                .copied()
-                                .map(map_type)
-                                .collect::<Result<Vec<_>, _>>()?;
-                            types.function(params, results);
-                        }
-                        wasmparser::StructuralType::Array(_) => {
-                            return Err(Error::unsupported("Array types are not supported yet."));
-                        }
-                        wasmparser::StructuralType::Struct(_) => {
-                            return Err(Error::unsupported("Struct types are not supported yet."));
-                        }
-                    }
-                }
+            for ty in reader.into_iter_err_on_gc_types() {
+                let ty = ty?;
+                let params = ty
+                    .params()
+                    .iter()
+                    .copied()
+                    .map(map_type)
+                    .collect::<Result<Vec<_>, _>>()?;
+                let results = ty
+                    .results()
+                    .iter()
+                    .copied()
+                    .map(map_type)
+                    .collect::<Result<Vec<_>, _>>()?;
+                types.function(params, results);
             }
             // And then add our new type.
             types.function(params, results);
diff --git a/crates/wasm-mutate/src/mutators/remove_item.rs b/crates/wasm-mutate/src/mutators/remove_item.rs
index b6e84851..b3283326 100644
--- a/crates/wasm-mutate/src/mutators/remove_item.rs
+++ b/crates/wasm-mutate/src/mutators/remove_item.rs
@@ -17,7 +17,7 @@ use wasm_encoder::*;
 use wasmparser::{
     BinaryReader, CodeSectionReader, DataSectionReader, ElementSectionReader, ExportSectionReader,
     ExternalKind, FromReader, FunctionSectionReader, GlobalSectionReader, ImportSectionReader,
-    MemorySectionReader, Operator, SectionLimited, TableInit, TableSectionReader, TagSectionReader,
+    MemorySectionReader, Operator, TableInit, TableSectionReader, TagSectionReader,
     TypeSectionReader,
 };
 
@@ -134,12 +134,10 @@ impl RemoveItem {
                     self.filter_out(
                         &mut module,
                         0,
-                        TypeSectionReader::new(section.data, 0)?,
+                        TypeSectionReader::new(section.data, 0)?.into_iter_err_on_gc_types(),
                         Item::Type,
-                        |me, rec_group, section| {
-                            for ty in rec_group.types() {
-                                me.translate_type_def(ty.clone().structural_type, section)?;
-                            }
+                        |me, ty, section| {
+                            me.translate_func_type(ty,section)?;
                             Ok(())
                         },
                     )?;
@@ -378,7 +376,7 @@ impl RemoveItem {
         &mut self,
         module: &mut Module,
         offset: u32,
-        section: SectionLimited<'a, S>,
+        section: impl IntoIterator<Item = wasmparser::Result<S>>,
         section_item: Item,
         encode: impl Fn(&mut Self, S, &mut T) -> Result<()>,
     ) -> Result<()>
diff --git a/crates/wasm-mutate/src/mutators/translate.rs b/crates/wasm-mutate/src/mutators/translate.rs
index 6e6c2d28..f3044817 100644
--- a/crates/wasm-mutate/src/mutators/translate.rs
+++ b/crates/wasm-mutate/src/mutators/translate.rs
@@ -1,6 +1,6 @@
 use crate::{Error, Result};
 use wasm_encoder::*;
-use wasmparser::{DataKind, ElementKind, FunctionBody, Global, Operator, StructuralType};
+use wasmparser::{DataKind, ElementKind, FunctionBody, Global, Operator};
 
 #[derive(Debug, Hash, Eq, PartialEq, Copy, Clone)]
 pub enum Item {
@@ -26,8 +26,8 @@ pub enum ConstExprKind {
 pub trait Translator {
     fn as_obj(&mut self) -> &mut dyn Translator;
 
-    fn translate_type_def(&mut self, ty: StructuralType, s: &mut TypeSection) -> Result<()> {
-        type_def(self.as_obj(), ty, s)
+    fn translate_func_type(&mut self, ty: wasmparser::FuncType, s: &mut TypeSection) -> Result<()> {
+        func_type(self.as_obj(), ty, s)
     }
 
     fn translate_table_type(
@@ -122,24 +122,22 @@ impl Translator for DefaultTranslator {
     }
 }
 
-pub fn type_def(t: &mut dyn Translator, ty: StructuralType, s: &mut TypeSection) -> Result<()> {
-    match ty {
-        StructuralType::Func(f) => {
-            s.function(
-                f.params()
-                    .iter()
-                    .map(|ty| t.translate_ty(ty))
-                    .collect::<Result<Vec<_>>>()?,
-                f.results()
-                    .iter()
-                    .map(|ty| t.translate_ty(ty))
-                    .collect::<Result<Vec<_>>>()?,
-            );
-            Ok(())
-        }
-        StructuralType::Array(_) => Err(Error::unsupported("Array types are not supported yet.")),
-        StructuralType::Struct(_) => Err(Error::unsupported("Struct types are not supported yet.")),
-    }
+pub fn func_type(
+    t: &mut dyn Translator,
+    ty: wasmparser::FuncType,
+    s: &mut TypeSection,
+) -> Result<()> {
+    s.function(
+        ty.params()
+            .iter()
+            .map(|ty| t.translate_ty(ty))
+            .collect::<Result<Vec<_>>>()?,
+        ty.results()
+            .iter()
+            .map(|ty| t.translate_ty(ty))
+            .collect::<Result<Vec<_>>>()?,
+    );
+    Ok(())
 }
 
 pub fn table_type(
diff --git a/crates/wasm-shrink/Cargo.toml b/crates/wasm-shrink/Cargo.toml
index 48265540..9fe8d490 100644
--- a/crates/wasm-shrink/Cargo.toml
+++ b/crates/wasm-shrink/Cargo.toml
@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 readme = "./README.md"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-shrink"
 name = "wasm-shrink"
-version = "0.1.32"
+version = "0.1.33"
 
 [dependencies]
 anyhow = { workspace = true }
diff --git a/crates/wasm-smith/Cargo.toml b/crates/wasm-smith/Cargo.toml
index 8a6ae1ad..10ea1d18 100644
--- a/crates/wasm-smith/Cargo.toml
+++ b/crates/wasm-smith/Cargo.toml
@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 name = "wasm-smith"
 readme = "./README.md"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-smith"
-version = "0.12.14"
+version = "0.12.15"
 exclude = ["/benches/corpus"]
 
 [[bench]]
diff --git a/crates/wasm-smith/src/core.rs b/crates/wasm-smith/src/core.rs
index 6943f8b8..1eea3170 100644
--- a/crates/wasm-smith/src/core.rs
+++ b/crates/wasm-smith/src/core.rs
@@ -547,16 +547,14 @@ impl Module {
         // index in our newly generated module. Initially the option is `None` and will become a
         // `Some` when we encounter an import that uses this signature in the next portion of this
         // function. See also the `make_func_type` closure below.
-        let mut available_types = Vec::<(wasmparser::StructuralType, Option<u32>)>::new();
+        let mut available_types = Vec::new();
         let mut available_imports = Vec::<wasmparser::Import>::new();
         for payload in wasmparser::Parser::new(0).parse_all(&example_module) {
             match payload.expect("could not parse the available import payload") {
                 wasmparser::Payload::TypeSection(type_reader) => {
-                    for ty in type_reader {
-                        let rec_group = ty.expect("could not parse type section");
-                        for ty in rec_group.types() {
-                            available_types.push((ty.clone().structural_type, None));
-                        }
+                    for ty in type_reader.into_iter_err_on_gc_types() {
+                        let ty = ty.expect("could not parse type section");
+                        available_types.push((ty, None));
                     }
                 }
                 wasmparser::Payload::ImportSection(import_reader) => {
@@ -589,7 +587,7 @@ impl Module {
             let serialized_sig_idx = match available_types.get_mut(parsed_sig_idx as usize) {
                 None => panic!("signature index refers to a type out of bounds"),
                 Some((_, Some(idx))) => *idx as usize,
-                Some((wasmparser::StructuralType::Func(func_type), index_store)) => {
+                Some((func_type, index_store)) => {
                     let multi_value_required = func_type.results().len() > 1;
                     let new_index = first_type_index + new_types.len();
                     if new_index >= max_types || (multi_value_required && !multi_value_enabled) {
@@ -611,12 +609,6 @@ impl Module {
                     new_types.push(Type::Func(Rc::clone(&func_type)));
                     new_index
                 }
-                Some((wasmparser::StructuralType::Array(_array_type), _index_store)) => {
-                    unimplemented!("Array types are not supported yet.");
-                }
-                Some((wasmparser::StructuralType::Struct(_struct_type), _index_store)) => {
-                    unimplemented!("Struct types are not supported yet.");
-                }
             };
             match &new_types[serialized_sig_idx - first_type_index] {
                 Type::Func(f) => Some((serialized_sig_idx as u32, Rc::clone(f))),
diff --git a/crates/wasmparser/Cargo.toml b/crates/wasmparser/Cargo.toml
index 2a418fbc..fd9265d2 100644
--- a/crates/wasmparser/Cargo.toml
+++ b/crates/wasmparser/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmparser"
-version = "0.111.0"
+version = "0.112.0"
 authors = ["Yury Delendik <ydelendik@mozilla.com>"]
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser"
diff --git a/crates/wasmparser/src/readers/core/types.rs b/crates/wasmparser/src/readers/core/types.rs
index 45f59af2..fad9d426 100644
--- a/crates/wasmparser/src/readers/core/types.rs
+++ b/crates/wasmparser/src/readers/core/types.rs
@@ -1171,6 +1171,30 @@ pub struct TagType {
 /// A reader for the type section of a WebAssembly module.
 pub type TypeSectionReader<'a> = SectionLimited<'a, RecGroup>;
 
+impl<'a> TypeSectionReader<'a> {
+    /// Returns an iterator over this type section which will only yield
+    /// function types and any usage of GC types from the GC proposal will
+    /// be translated into an error.
+    pub fn into_iter_err_on_gc_types(self) -> impl Iterator<Item = Result<FuncType>> + 'a {
+        self.into_iter_with_offsets().map(|item| {
+            let (offset, group) = item?;
+            let ty = match group {
+                RecGroup::Single(ty) => ty,
+                RecGroup::Many(_) => bail!(offset, "gc proposal not supported"),
+            };
+            if ty.is_final || ty.supertype_idx.is_some() {
+                bail!(offset, "gc proposal not supported");
+            }
+            match ty.structural_type {
+                StructuralType::Func(f) => Ok(f),
+                StructuralType::Array(_) | StructuralType::Struct(_) => {
+                    bail!(offset, "gc proposal not supported");
+                }
+            }
+        })
+    }
+}
+
 impl<'a> FromReader<'a> for StructuralType {
     fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> {
         read_structural_type(reader.read_u8()?, reader)
diff --git a/crates/wasmprinter/Cargo.toml b/crates/wasmprinter/Cargo.toml
index 07afe926..d8f8c834 100644
--- a/crates/wasmprinter/Cargo.toml
+++ b/crates/wasmprinter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmprinter"
-version = "0.2.63"
+version = "0.2.64"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml
index 3626c157..0c8b5cc7 100644
--- a/crates/wast/Cargo.toml
+++ b/crates/wast/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wast"
-version = "63.0.0"
+version = "64.0.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wat/Cargo.toml b/crates/wat/Cargo.toml
index a7a0455d..7638bbc9 100644
--- a/crates/wat/Cargo.toml
+++ b/crates/wat/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wat"
-version = "1.0.70"
+version = "1.0.71"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wit-component/Cargo.toml b/crates/wit-component/Cargo.toml
index 92790acc..af1d36c4 100644
--- a/crates/wit-component/Cargo.toml
+++ b/crates/wit-component/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "wit-component"
 authors = ["Peter Huene <peter@huene.dev>"]
-version = "0.13.2"
+version = "0.14.0"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 readme = "README.md"
diff --git a/crates/wit-component/src/gc.rs b/crates/wit-component/src/gc.rs
index 49a01471..c4e1dff6 100644
--- a/crates/wit-component/src/gc.rs
+++ b/crates/wit-component/src/gc.rs
@@ -178,7 +178,7 @@ type WorklistFunc<'a> = fn(&mut Module<'a>, u32) -> Result<()>;
 #[derive(Default)]
 struct Module<'a> {
     // Definitions found when parsing a module
-    types: Vec<SubType>,
+    types: Vec<FuncType>,
     tables: Vec<Table<'a>>,
     globals: Vec<Global<'a>>,
     memories: Vec<Memory<'a>>,
@@ -245,10 +245,8 @@ impl<'a> Module<'a> {
                 }
                 Payload::End(_) => {}
                 Payload::TypeSection(s) => {
-                    for rec_group in s {
-                        for ty in rec_group?.types() {
-                            self.types.push(ty.clone());
-                        }
+                    for ty in s.into_iter_err_on_gc_types() {
+                        self.types.push(ty?);
                     }
                 }
                 Payload::ImportSection(s) => {
@@ -482,13 +480,6 @@ impl<'a> Module<'a> {
         }
     }
 
-    fn storagety(&mut self, ty: StorageType) {
-        match ty {
-            StorageType::I8 | StorageType::I16 => {}
-            StorageType::Val(ty) => self.valty(ty),
-        }
-    }
-
     fn heapty(&mut self, ty: HeapType) {
         match ty {
             HeapType::Func
@@ -510,21 +501,10 @@ impl<'a> Module<'a> {
             return;
         }
         self.worklist.push((ty, |me, ty| {
-            match me.types[ty as usize].clone().structural_type {
-                StructuralType::Func(ty) => {
-                    for param in ty.params().iter().chain(ty.results()) {
-                        me.valty(*param);
-                    }
-                }
-                StructuralType::Array(ArrayType(ty)) => {
-                    me.storagety(ty.element_type);
-                }
-                StructuralType::Struct(ty) => {
-                    for field in ty.fields.iter() {
-                        me.storagety(field.element_type);
-                    }
-                }
-            };
+            let ty = me.types[ty as usize].clone();
+            for param in ty.params().iter().chain(ty.results()) {
+                me.valty(*param);
+            }
             Ok(())
         }));
     }
@@ -536,7 +516,7 @@ impl<'a> Module<'a> {
         Ok(())
     }
 
-    fn live_types(&self) -> impl Iterator<Item = (u32, &SubType)> + '_ {
+    fn live_types(&self) -> impl Iterator<Item = (u32, &FuncType)> + '_ {
         live_iter(&self.live_types, self.types.iter())
     }
 
@@ -576,15 +556,17 @@ impl<'a> Module<'a> {
         let mut empty_type = None;
         for (i, ty) in self.live_types() {
             map.types.push(i);
-            types.subtype(&map.subtype(ty));
+
+            types.function(
+                ty.params().iter().map(|t| map.valty(*t)),
+                ty.results().iter().map(|t| map.valty(*t)),
+            );
 
             // Keep track of the "empty type" to see if we can reuse an
             // existing one or one needs to be injected if a `start`
             // function is calculated at the end.
-            if let StructuralType::Func(ty) = &ty.structural_type {
-                if ty.params().is_empty() && ty.results().is_empty() {
-                    empty_type = Some(map.types.remap(i));
-                }
+            if ty.params().is_empty() && ty.results().is_empty() {
+                empty_type = Some(map.types.remap(i));
             }
         }
 
@@ -1113,14 +1095,6 @@ impl Encoder {
         }
     }
 
-    fn storagety(&self, ty: StorageType) -> wasm_encoder::StorageType {
-        match ty {
-            StorageType::I8 => wasm_encoder::StorageType::I8,
-            StorageType::I16 => wasm_encoder::StorageType::I16,
-            StorageType::Val(ty) => wasm_encoder::StorageType::Val(self.valty(ty)),
-        }
-    }
-
     fn refty(&self, rt: wasmparser::RefType) -> wasm_encoder::RefType {
         wasm_encoder::RefType {
             nullable: rt.is_nullable(),
@@ -1143,44 +1117,6 @@ impl Encoder {
             HeapType::Indexed(idx) => wasm_encoder::HeapType::Indexed(self.types.remap(idx)),
         }
     }
-
-    fn subtype(&self, ty: &SubType) -> wasm_encoder::SubType {
-        wasm_encoder::SubType {
-            is_final: ty.is_final,
-            supertype_idx: ty.supertype_idx,
-            structural_type: self.structural_type(&ty.structural_type),
-        }
-    }
-
-    fn structural_type(&self, ty: &StructuralType) -> wasm_encoder::StructuralType {
-        match ty {
-            StructuralType::Func(ty) => {
-                wasm_encoder::StructuralType::Func(wasm_encoder::FuncType::new(
-                    ty.params().iter().map(|t| self.valty(*t)),
-                    ty.results().iter().map(|t| self.valty(*t)),
-                ))
-            }
-
-            StructuralType::Struct(ty) => {
-                wasm_encoder::StructuralType::Struct(wasm_encoder::StructType {
-                    fields: ty
-                        .fields
-                        .iter()
-                        .map(|f| wasm_encoder::FieldType {
-                            element_type: self.storagety(f.element_type),
-                            mutable: f.mutable,
-                        })
-                        .collect(),
-                })
-            }
-            StructuralType::Array(ty) => wasm_encoder::StructuralType::Array(
-                wasm_encoder::ArrayType(wasm_encoder::FieldType {
-                    element_type: self.storagety(ty.0.element_type),
-                    mutable: ty.0.mutable,
-                }),
-            ),
-        }
-    }
 }
 
 // This is a helper macro to translate all `wasmparser` instructions to
diff --git a/crates/wit-component/src/linking/metadata.rs b/crates/wit-component/src/linking/metadata.rs
index 63a487f8..6893199f 100644
--- a/crates/wit-component/src/linking/metadata.rs
+++ b/crates/wit-component/src/linking/metadata.rs
@@ -9,7 +9,7 @@ use {
     },
     wasmparser::{
         BinaryReader, BinaryReaderError, ExternalKind, FuncType, Parser, Payload, RefType,
-        StructuralType, Subsection, Subsections, TableType, TypeRef, ValType,
+        Subsection, Subsections, TableType, TypeRef, ValType,
     },
 };
 
@@ -343,22 +343,7 @@ impl<'a> Metadata<'a> {
 
                 Payload::TypeSection(reader) => {
                     types = reader
-                        .into_iter()
-                        .flat_map(|r| match r {
-                            Err(e) => vec![Err(e)],
-                            Ok(rg) => rg
-                                .types()
-                                .iter()
-                                .map(|st| Ok(st.clone()))
-                                .collect::<Vec<_>>(),
-                        })
-                        .filter_map(|r| {
-                            r.map(|ty| match ty.clone().structural_type {
-                                StructuralType::Func(ty) => Some(ty),
-                                StructuralType::Array(_) | StructuralType::Struct(_) => None,
-                            })
-                            .transpose()
-                        })
+                        .into_iter_err_on_gc_types()
                         .collect::<Result<Vec<_>, _>>()?;
                 }
 
diff --git a/crates/wit-parser/Cargo.toml b/crates/wit-parser/Cargo.toml
index f2621560..f426267f 100644
--- a/crates/wit-parser/Cargo.toml
+++ b/crates/wit-parser/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "wit-parser"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
-version = "0.10.0"
+version = "0.11.0"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 readme = "README.md"
diff --git a/crates/wit-smith/Cargo.toml b/crates/wit-smith/Cargo.toml
index 6aff32ef..badfc4c0 100644
--- a/crates/wit-smith/Cargo.toml
+++ b/crates/wit-smith/Cargo.toml
@@ -5,7 +5,7 @@ edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 name = "wit-smith"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-smith"
-version = "0.1.9"
+version = "0.1.10"
 
 [dependencies]
 arbitrary = { workspace = true, features = ["derive"] }


Test patch:
diff --git a/crates/wasm-smith/tests/core.rs b/crates/wasm-smith/tests/core.rs
index ada3efab..4a563566 100644
--- a/crates/wasm-smith/tests/core.rs
+++ b/crates/wasm-smith/tests/core.rs
@@ -129,18 +129,8 @@ fn smoke_test_imports_config() {
                 let payload = payload.unwrap();
                 if let wasmparser::Payload::TypeSection(rdr) = payload {
                     // Gather the signature types to later check function types against.
-                    for rec_group in rdr {
-                        for ty in rec_group.unwrap().types() {
-                            match ty.clone().structural_type {
-                                wasmparser::StructuralType::Func(ft) => sig_types.push(ft),
-                                wasmparser::StructuralType::Array(_) => {
-                                    unimplemented!("Array types are not supported yet.")
-                                }
-                                wasmparser::StructuralType::Struct(_) => {
-                                    unimplemented!("Struct types are not supported yet.")
-                                }
-                            }
-                        }
+                    for ty in rdr.into_iter_err_on_gc_types() {
+                        sig_types.push(ty.unwrap());
                     }
                 } else if let wasmparser::Payload::ImportSection(rdr) = payload {
                     // Read out imports, checking that they all are within the list of expected