From f91faeee3528a4a6ce010ee2aa69d84dd4c5da79 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Tue, 20 Jan 2026 13:33:42 +0100 Subject: [PATCH 1/5] rename fixed size to fixed-length --- crates/wasm-compose/src/encoding.rs | 10 +++--- crates/wasm-encoder/src/component/types.rs | 4 +-- crates/wasm-encoder/src/reencode/component.rs | 4 +-- crates/wasm-wave/src/value/ty.rs | 8 ++--- crates/wasm-wave/src/value/wit.rs | 8 ++--- crates/wasm-wave/src/wasm/ty.rs | 4 +-- crates/wasm-wave/src/writer.rs | 2 +- crates/wasmparser/src/features.rs | 4 +-- .../wasmparser/src/readers/component/types.rs | 6 ++-- crates/wasmparser/src/validator/component.rs | 10 +++--- .../src/validator/component_types.rs | 26 +++++++------- crates/wasmprinter/src/component.rs | 6 ++-- crates/wast/src/component/binary.rs | 4 +-- crates/wast/src/component/expand.rs | 2 +- crates/wast/src/component/resolve.rs | 2 +- crates/wast/src/component/types.rs | 8 ++--- crates/wit-component/src/encoding.rs | 2 +- crates/wit-component/src/encoding/types.rs | 4 +-- crates/wit-component/src/printing.rs | 8 ++--- crates/wit-dylib/ffi/src/ffi.rs | 10 +++--- crates/wit-dylib/ffi/src/types.rs | 36 +++++++++---------- crates/wit-dylib/src/bindgen.rs | 8 ++--- crates/wit-dylib/src/lib.rs | 10 +++--- crates/wit-dylib/src/metadata.rs | 18 +++++----- .../test-programs/src/bin/smoke_caller.rs | 2 +- .../wit-dylib/test-programs/src/generate.rs | 2 +- crates/wit-dylib/tests/roundtrip.rs | 2 +- crates/wit-dylib/wit_dylib.h | 10 +++--- crates/wit-encoder/src/from_parser.rs | 8 ++--- crates/wit-encoder/src/ty.rs | 8 ++--- crates/wit-parser/src/abi.rs | 2 +- crates/wit-parser/src/ast.rs | 10 +++--- crates/wit-parser/src/ast/resolve.rs | 12 +++---- crates/wit-parser/src/decoding.rs | 12 +++---- crates/wit-parser/src/lib.rs | 6 ++-- crates/wit-parser/src/live.rs | 2 +- crates/wit-parser/src/resolve/clone.rs | 2 +- crates/wit-parser/src/resolve/mod.rs | 14 +++++--- crates/wit-parser/src/sizealign.rs | 2 +- .../tests/ui/parse-fail/bad-list2.wit.result | 2 +- .../tests/ui/parse-fail/bad-list3.wit.result | 2 +- .../tests/ui/parse-fail/bad-list4.wit.result | 2 +- crates/wit-parser/tests/ui/types.wit.json | 6 ++-- crates/wit-smith/src/config.rs | 8 ++--- crates/wit-smith/src/generate.rs | 6 ++-- tests/cli/component-model/async/abi.wast | 2 +- tests/cli/component-model/async/stackful.wast | 2 +- ...-size-list.wast => fixed-length-list.wast} | 2 +- ...-size-list.wast => fixed-length-list.wast} | 4 +-- .../cli/validate-unknown-features.wat.stderr | 2 +- tests/cli/wit-deep-list.wit | 4 +-- ....wast.json => fixed-length-list.wast.json} | 14 ++++---- .../0.print | 0 .../1.print | 0 ....wast.json => fixed-length-list.wast.json} | 10 +++--- 55 files changed, 184 insertions(+), 180 deletions(-) rename tests/cli/component-model/{fixed-size-list.wast => fixed-length-list.wast} (98%) rename tests/cli/missing-features/component-model/{fixed-size-list.wast => fixed-length-list.wast} (79%) rename tests/snapshots/cli/component-model/{fixed-size-list.wast.json => fixed-length-list.wast.json} (69%) rename tests/snapshots/cli/component-model/{fixed-size-list.wast => fixed-length-list.wast}/0.print (100%) rename tests/snapshots/cli/component-model/{fixed-size-list.wast => fixed-length-list.wast}/1.print (100%) rename tests/snapshots/cli/missing-features/component-model/{fixed-size-list.wast.json => fixed-length-list.wast.json} (68%) diff --git a/crates/wasm-compose/src/encoding.rs b/crates/wasm-compose/src/encoding.rs index fd7efad3dc..c1361f30eb 100644 --- a/crates/wasm-compose/src/encoding.rs +++ b/crates/wasm-compose/src/encoding.rs @@ -657,8 +657,8 @@ impl<'a> TypeEncoder<'a> { ComponentDefinedType::Variant(v) => self.variant(state, v), ComponentDefinedType::List(ty) => self.list(state, *ty), ComponentDefinedType::Map(key, value) => self.map(state, *key, *value), - ComponentDefinedType::FixedSizeList(ty, elements) => { - self.fixed_size_list(state, *ty, *elements) + ComponentDefinedType::FixedLengthList(ty, elements) => { + self.fixed_length_list(state, *ty, *elements) } ComponentDefinedType::Tuple(t) => self.tuple(state, t), ComponentDefinedType::Flags(names) => Self::flags(&mut state.cur.encodable, names), @@ -733,7 +733,7 @@ impl<'a> TypeEncoder<'a> { index } - fn fixed_size_list( + fn fixed_length_list( &self, state: &mut TypeState<'a>, ty: ct::ComponentValType, @@ -746,7 +746,7 @@ impl<'a> TypeEncoder<'a> { .encodable .ty() .defined_type() - .fixed_size_list(ty, elements); + .fixed_length_list(ty, elements); index } @@ -1271,7 +1271,7 @@ impl DependencyRegistrar<'_, '_> { | ComponentDefinedType::Enum(_) | ComponentDefinedType::Flags(_) => {} ComponentDefinedType::List(t) - | ComponentDefinedType::FixedSizeList(t, _) + | ComponentDefinedType::FixedLengthList(t, _) | ComponentDefinedType::Option(t) => self.val_type(*t), ComponentDefinedType::Map(k, v) => { self.val_type(*k); diff --git a/crates/wasm-encoder/src/component/types.rs b/crates/wasm-encoder/src/component/types.rs index d44f812aa4..993a508663 100644 --- a/crates/wasm-encoder/src/component/types.rs +++ b/crates/wasm-encoder/src/component/types.rs @@ -627,8 +627,8 @@ impl ComponentDefinedTypeEncoder<'_> { value.into().encode(self.0); } - /// Define a fixed size list type. - pub fn fixed_size_list(self, ty: impl Into, elements: u32) { + /// Define a fixed-length list type. + pub fn fixed_length_list(self, ty: impl Into, elements: u32) { self.0.push(0x67); ty.into().encode(self.0); elements.encode(self.0); diff --git a/crates/wasm-encoder/src/reencode/component.rs b/crates/wasm-encoder/src/reencode/component.rs index 8c2cd60665..33737f019d 100644 --- a/crates/wasm-encoder/src/reencode/component.rs +++ b/crates/wasm-encoder/src/reencode/component.rs @@ -775,8 +775,8 @@ pub mod component_utils { reencoder.component_val_type(v), ); } - wasmparser::ComponentDefinedType::FixedSizeList(t, elements) => { - defined.fixed_size_list(reencoder.component_val_type(t), elements); + wasmparser::ComponentDefinedType::FixedLengthList(t, elements) => { + defined.fixed_length_list(reencoder.component_val_type(t), elements); } wasmparser::ComponentDefinedType::Tuple(t) => { defined.tuple(t.iter().map(|t| reencoder.component_val_type(*t))); diff --git a/crates/wasm-wave/src/value/ty.rs b/crates/wasm-wave/src/value/ty.rs index 8d87273ff0..ba4e4b6712 100644 --- a/crates/wasm-wave/src/value/ty.rs +++ b/crates/wasm-wave/src/value/ty.rs @@ -10,7 +10,7 @@ pub struct Type(pub(super) TypeEnum); pub(super) enum TypeEnum { Simple(SimpleType), List(Arc), - FixedSizeList(Arc, u32), + FixedLengthList(Arc, u32), Record(Arc), Tuple(Arc), Variant(Arc), @@ -57,9 +57,9 @@ impl Type { } /// Returns a list type with the given element type. - pub fn fixed_size_list(element_type: impl Into, elements: u32) -> Self { + pub fn fixed_length_list(element_type: impl Into, elements: u32) -> Self { let element = element_type.into(); - Self(TypeEnum::FixedSizeList( + Self(TypeEnum::FixedLengthList( Arc::new(ListType { element }), elements, )) @@ -199,7 +199,7 @@ impl WasmType for Type { match self.0 { TypeEnum::Simple(simple) => simple.0, TypeEnum::List(_) => WasmTypeKind::List, - TypeEnum::FixedSizeList(_, _) => WasmTypeKind::FixedSizeList, + TypeEnum::FixedLengthList(_, _) => WasmTypeKind::FixedLengthList, TypeEnum::Record(_) => WasmTypeKind::Record, TypeEnum::Tuple(_) => WasmTypeKind::Tuple, TypeEnum::Variant(_) => WasmTypeKind::Variant, diff --git a/crates/wasm-wave/src/value/wit.rs b/crates/wasm-wave/src/value/wit.rs index 75d48d8220..7a497210dc 100644 --- a/crates/wasm-wave/src/value/wit.rs +++ b/crates/wasm-wave/src/value/wit.rs @@ -71,8 +71,8 @@ impl<'a> TypeResolver<'a> { TypeDefKind::Option(some_type) => self.resolve_option(some_type), TypeDefKind::Result(result) => self.resolve_result(result), TypeDefKind::List(element_type) => self.resolve_list(element_type), - TypeDefKind::FixedSizeList(element_type, elements) => { - self.resolve_fixed_size_list(element_type, *elements) + TypeDefKind::FixedLengthList(element_type, elements) => { + self.resolve_fixed_length_list(element_type, *elements) } TypeDefKind::Type(Type::Bool) => Ok(value::Type::BOOL), TypeDefKind::Type(Type::U8) => Ok(value::Type::U8), @@ -150,9 +150,9 @@ impl<'a> TypeResolver<'a> { Ok(value::Type::list(element_type)) } - fn resolve_fixed_size_list(&self, element_type: &Type, elements: u32) -> ValueResult { + fn resolve_fixed_length_list(&self, element_type: &Type, elements: u32) -> ValueResult { let element_type = self.resolve_type(*element_type)?; - Ok(value::Type::fixed_size_list(element_type, elements)) + Ok(value::Type::fixed_length_list(element_type, elements)) } } diff --git a/crates/wasm-wave/src/wasm/ty.rs b/crates/wasm-wave/src/wasm/ty.rs index ea9f66e6e4..d0bdc0562d 100644 --- a/crates/wasm-wave/src/wasm/ty.rs +++ b/crates/wasm-wave/src/wasm/ty.rs @@ -20,7 +20,7 @@ pub enum WasmTypeKind { Char, String, List, - FixedSizeList, + FixedLengthList, Record, Tuple, Variant, @@ -49,7 +49,7 @@ impl core::fmt::Display for WasmTypeKind { WasmTypeKind::Char => "char", WasmTypeKind::String => "string", WasmTypeKind::List => "list", - WasmTypeKind::FixedSizeList => "list<_,N>", + WasmTypeKind::FixedLengthList => "list<_,N>", WasmTypeKind::Record => "record", WasmTypeKind::Tuple => "tuple", WasmTypeKind::Variant => "variant", diff --git a/crates/wasm-wave/src/writer.rs b/crates/wasm-wave/src/writer.rs index 63ecf9dd0e..920e7b9f9e 100644 --- a/crates/wasm-wave/src/writer.rs +++ b/crates/wasm-wave/src/writer.rs @@ -75,7 +75,7 @@ impl Writer { } self.write_str("]") } - WasmTypeKind::FixedSizeList => { + WasmTypeKind::FixedLengthList => { self.write_str("[")?; for (idx, val) in val.unwrap_list().enumerate() { if idx != 0 { diff --git a/crates/wasmparser/src/features.rs b/crates/wasmparser/src/features.rs index 70fe3c8f7b..62ea6eeee8 100644 --- a/crates/wasmparser/src/features.rs +++ b/crates/wasmparser/src/features.rs @@ -276,11 +276,11 @@ define_wasm_features! { /// Corresponds to the 📝 character in /// . pub cm_error_context: CM_ERROR_CONTEXT(1 << 31) = false; - /// Support for fixed size lists + /// Support for fixed-length lists /// /// Corresponds to the 🔧 character in /// . - pub cm_fixed_size_list: CM_FIXED_SIZE_LIST(1 << 32) = false; + pub cm_fixed_length_lists: CM_FIXED_LENGTH_LISTS(1 << 32) = false; /// Support for Wasm GC in the component model proposal. /// /// Corresponds to the 🛸 character in diff --git a/crates/wasmparser/src/readers/component/types.rs b/crates/wasmparser/src/readers/component/types.rs index 629b76c873..ab760cd877 100644 --- a/crates/wasmparser/src/readers/component/types.rs +++ b/crates/wasmparser/src/readers/component/types.rs @@ -448,8 +448,8 @@ pub enum ComponentDefinedType<'a> { List(ComponentValType), /// The type is a map of the given key and value types. Map(ComponentValType, ComponentValType), - /// The type is a fixed size list of the given value type. - FixedSizeList(ComponentValType, u32), + /// The type is a fixed-length list of the given value type. + FixedLengthList(ComponentValType, u32), /// The type is a tuple of the given value types. Tuple(Box<[ComponentValType]>), /// The type is flags with the given names. @@ -513,7 +513,7 @@ impl<'a> ComponentDefinedType<'a> { }, 0x69 => ComponentDefinedType::Own(reader.read()?), 0x68 => ComponentDefinedType::Borrow(reader.read()?), - 0x67 => ComponentDefinedType::FixedSizeList(reader.read()?, reader.read_var_u32()?), + 0x67 => ComponentDefinedType::FixedLengthList(reader.read()?, reader.read_var_u32()?), 0x66 => ComponentDefinedType::Stream(reader.read()?), 0x65 => ComponentDefinedType::Future(reader.read()?), x => return reader.invalid_leading_byte(x, "component defined type"), diff --git a/crates/wasmparser/src/validator/component.rs b/crates/wasmparser/src/validator/component.rs index f65db8c3f9..05b12ed2be 100644 --- a/crates/wasmparser/src/validator/component.rs +++ b/crates/wasmparser/src/validator/component.rs @@ -949,7 +949,7 @@ impl ComponentState { .unwrap_or(true) } ComponentDefinedType::List(ty) - | ComponentDefinedType::FixedSizeList(ty, _) + | ComponentDefinedType::FixedLengthList(ty, _) | ComponentDefinedType::Option(ty) => types.type_named_valtype(ty, set), ComponentDefinedType::Map(k, v) => { types.type_named_valtype(k, set) && types.type_named_valtype(v, set) @@ -3929,17 +3929,17 @@ impl ComponentState { self.create_component_val_type(value, offset)?, )) } - crate::ComponentDefinedType::FixedSizeList(ty, elements) => { - if !self.features.cm_fixed_size_list() { + crate::ComponentDefinedType::FixedLengthList(ty, elements) => { + if !self.features.cm_fixed_length_lists() { bail!( offset, - "Fixed size lists require the component model fixed size list feature" + "Fixed size lists require the component model fixed-length list feature" ) } if elements < 1 { bail!(offset, "Fixed size lists must have more than zero elements") } - Ok(ComponentDefinedType::FixedSizeList( + Ok(ComponentDefinedType::FixedLengthList( self.create_component_val_type(ty, offset)?, elements, )) diff --git a/crates/wasmparser/src/validator/component_types.rs b/crates/wasmparser/src/validator/component_types.rs index a5c67a2086..7769655877 100644 --- a/crates/wasmparser/src/validator/component_types.rs +++ b/crates/wasmparser/src/validator/component_types.rs @@ -1470,8 +1470,8 @@ pub enum ComponentDefinedType { List(ComponentValType), /// The type is a map. Map(ComponentValType, ComponentValType), - /// The type is a fixed size list. - FixedSizeList(ComponentValType, u32), + /// The type is a fixed-length list. + FixedLengthList(ComponentValType, u32), /// The type is a tuple. Tuple(TupleType), /// The type is a set of flags. @@ -1512,7 +1512,7 @@ impl TypeData for ComponentDefinedType { Self::Record(r) => r.info, Self::Variant(v) => v.info, Self::Tuple(t) => t.info, - Self::List(ty) | Self::FixedSizeList(ty, _) | Self::Option(ty) => ty.info(types), + Self::List(ty) | Self::FixedLengthList(ty, _) | Self::Option(ty) => ty.info(types), Self::Map(k, v) => { let mut info = k.info(types); info.combine(v.info(types), 0).unwrap(); @@ -1546,7 +1546,7 @@ impl ComponentDefinedType { | Self::Borrow(_) | Self::Future(_) | Self::Stream(_) => false, - Self::Option(ty) | Self::FixedSizeList(ty, _) => ty.contains_ptr(types), + Self::Option(ty) | Self::FixedLengthList(ty, _) => ty.contains_ptr(types), Self::Result { ok, err } => { ok.map(|ty| ty.contains_ptr(types)).unwrap_or(false) || err.map(|ty| ty.contains_ptr(types)).unwrap_or(false) @@ -1569,7 +1569,7 @@ impl ComponentDefinedType { Self::List(_) | Self::Map(_, _) => { lowered_types.try_push(ValType::I32) && lowered_types.try_push(ValType::I32) } - Self::FixedSizeList(ty, length) => { + Self::FixedLengthList(ty, length) => { (0..*length).all(|_n| ty.push_wasm_types(types, lowered_types)) } Self::Tuple(t) => t @@ -1647,7 +1647,7 @@ impl ComponentDefinedType { ComponentDefinedType::Option(_) => "option", ComponentDefinedType::List(_) => "list", ComponentDefinedType::Map(_, _) => "map", - ComponentDefinedType::FixedSizeList(_, _) => "fixed size list", + ComponentDefinedType::FixedLengthList(_, _) => "fixed-length list", ComponentDefinedType::Result { .. } => "result", ComponentDefinedType::Own(_) => "own", ComponentDefinedType::Borrow(_) => "borrow", @@ -1671,7 +1671,7 @@ impl ComponentDefinedType { ComponentDefinedType::Variant(ty) => ty.lower_gc(types, abi, options, offset, core), - ComponentDefinedType::List(ty) | ComponentDefinedType::FixedSizeList(ty, _) => { + ComponentDefinedType::List(ty) | ComponentDefinedType::FixedLengthList(ty, _) => { let id = match core.as_concrete_ref() { Some(id) => id, None => bail!( @@ -2524,7 +2524,7 @@ impl TypeAlloc { } } ComponentDefinedType::List(ty) - | ComponentDefinedType::FixedSizeList(ty, _) + | ComponentDefinedType::FixedLengthList(ty, _) | ComponentDefinedType::Option(ty) => { self.free_variables_valtype(ty, set); } @@ -2672,7 +2672,7 @@ impl TypeAlloc { .unwrap_or(true) } ComponentDefinedType::List(ty) - | ComponentDefinedType::FixedSizeList(ty, _) + | ComponentDefinedType::FixedLengthList(ty, _) | ComponentDefinedType::Option(ty) => self.type_named_valtype(ty, set), ComponentDefinedType::Map(k, v) => { self.type_named_valtype(k, set) && self.type_named_valtype(v, set) @@ -2865,7 +2865,7 @@ where } } ComponentDefinedType::List(ty) - | ComponentDefinedType::FixedSizeList(ty, _) + | ComponentDefinedType::FixedLengthList(ty, _) | ComponentDefinedType::Option(ty) => { any_changed |= self.remap_valtype(ty, map); } @@ -3791,14 +3791,14 @@ impl<'a> SubtypeCx<'a> { .with_context(|| "type mismatch in map value") } (Map(_, _), b) => bail!(offset, "expected {}, found map", b.desc()), - (FixedSizeList(a, asize), FixedSizeList(b, bsize)) => { + (FixedLengthList(a, asize), FixedLengthList(b, bsize)) => { if asize != bsize { - bail!(offset, "expected fixed size {bsize}, found size {asize}") + bail!(offset, "expected fixed-length {bsize}, found size {asize}") } else { self.component_val_type(a, b, offset) } } - (FixedSizeList(_, _), b) => bail!(offset, "expected {}, found list", b.desc()), + (FixedLengthList(_, _), b) => bail!(offset, "expected {}, found list", b.desc()), (Option(_), b) => bail!(offset, "expected {}, found option", b.desc()), (Tuple(a), Tuple(b)) => { if a.types.len() != b.types.len() { diff --git a/crates/wasmprinter/src/component.rs b/crates/wasmprinter/src/component.rs index 1be065fd6b..f17262840f 100644 --- a/crates/wasmprinter/src/component.rs +++ b/crates/wasmprinter/src/component.rs @@ -183,7 +183,7 @@ impl Printer<'_, '_> { Ok(()) } - pub(crate) fn print_fixed_size_list_type( + pub(crate) fn print_fixed_length_list_type( &mut self, state: &State, element_ty: &ComponentValType, @@ -293,8 +293,8 @@ impl Printer<'_, '_> { ComponentDefinedType::Variant(cases) => self.print_variant_type(state, cases)?, ComponentDefinedType::List(ty) => self.print_list_type(state, ty)?, ComponentDefinedType::Map(key, value) => self.print_map_type(state, key, value)?, - ComponentDefinedType::FixedSizeList(ty, elements) => { - self.print_fixed_size_list_type(state, ty, *elements)? + ComponentDefinedType::FixedLengthList(ty, elements) => { + self.print_fixed_length_list_type(state, ty, *elements)? } ComponentDefinedType::Tuple(tys) => self.print_tuple_type(state, tys)?, ComponentDefinedType::Flags(names) => self.print_flag_or_enum_type("flags", names)?, diff --git a/crates/wast/src/component/binary.rs b/crates/wast/src/component/binary.rs index 02427e33a3..90783505fd 100644 --- a/crates/wast/src/component/binary.rs +++ b/crates/wast/src/component/binary.rs @@ -112,8 +112,8 @@ fn encode_defined_type(encoder: ComponentDefinedTypeEncoder, ty: &ComponentDefin ComponentDefinedType::Map(m) => { encoder.map(m.key.as_ref(), m.value.as_ref()); } - ComponentDefinedType::FixedSizeList(l) => { - encoder.fixed_size_list(l.element.as_ref(), l.elements); + ComponentDefinedType::FixedLengthList(l) => { + encoder.fixed_length_list(l.element.as_ref(), l.elements); } ComponentDefinedType::Tuple(t) => { encoder.tuple(t.fields.iter()); diff --git a/crates/wast/src/component/expand.rs b/crates/wast/src/component/expand.rs index 5c8b68e64b..74b25767c0 100644 --- a/crates/wast/src/component/expand.rs +++ b/crates/wast/src/component/expand.rs @@ -553,7 +553,7 @@ impl<'a> Expander<'a> { } } ComponentDefinedType::List(List { element: t }) - | ComponentDefinedType::FixedSizeList(FixedSizeList { + | ComponentDefinedType::FixedLengthList(FixedLengthList { element: t, elements: _, }) => { diff --git a/crates/wast/src/component/resolve.rs b/crates/wast/src/component/resolve.rs index 9855493094..e7d5316c1b 100644 --- a/crates/wast/src/component/resolve.rs +++ b/crates/wast/src/component/resolve.rs @@ -560,7 +560,7 @@ impl<'a> Resolver<'a> { } } ComponentDefinedType::List(List { element: t }) - | ComponentDefinedType::FixedSizeList(FixedSizeList { + | ComponentDefinedType::FixedLengthList(FixedLengthList { element: t, elements: _, }) => { diff --git a/crates/wast/src/component/types.rs b/crates/wast/src/component/types.rs index 1771044f6c..9886614c76 100644 --- a/crates/wast/src/component/types.rs +++ b/crates/wast/src/component/types.rs @@ -387,7 +387,7 @@ pub enum ComponentDefinedType<'a> { Variant(Variant<'a>), List(List<'a>), Map(Map<'a>), - FixedSizeList(FixedSizeList<'a>), + FixedLengthList(FixedLengthList<'a>), Tuple(Tuple<'a>), Flags(Flags<'a>), Enum(Enum<'a>), @@ -600,9 +600,9 @@ pub struct Map<'a> { pub value: Box>, } -/// A fixed size list type. +/// A fixed-length list type. #[derive(Debug)] -pub struct FixedSizeList<'a> { +pub struct FixedLengthList<'a> { /// The element type of the array. pub element: Box>, /// Number of Elements @@ -614,7 +614,7 @@ fn parse_list<'a>(parser: Parser<'a>) -> Result> { let tp = parser.parse()?; let elements = parser.parse::>()?; if let Some(elements) = elements { - Ok(ComponentDefinedType::FixedSizeList(FixedSizeList { + Ok(ComponentDefinedType::FixedLengthList(FixedLengthList { element: Box::new(tp), elements, })) diff --git a/crates/wit-component/src/encoding.rs b/crates/wit-component/src/encoding.rs index 330c0f66e6..cc5b084cba 100644 --- a/crates/wit-component/src/encoding.rs +++ b/crates/wit-component/src/encoding.rs @@ -356,7 +356,7 @@ impl TypeContents { TypeDefKind::Map(k, v) => { Self::for_type(resolve, k) | Self::for_type(resolve, v) | Self::NEEDS_MEMORY } - TypeDefKind::FixedSizeList(t, _elements) => Self::for_type(resolve, t), + TypeDefKind::FixedLengthList(t, _elements) => Self::for_type(resolve, t), TypeDefKind::Type(t) => Self::for_type(resolve, t), TypeDefKind::Future(_) => Self::empty(), TypeDefKind::Stream(_) => Self::empty(), diff --git a/crates/wit-component/src/encoding/types.rs b/crates/wit-component/src/encoding/types.rs index 7dc16911c6..92bcc0cca6 100644 --- a/crates/wit-component/src/encoding/types.rs +++ b/crates/wit-component/src/encoding/types.rs @@ -196,10 +196,10 @@ pub trait ValtypeEncoder<'a> { encoder.map(key, value); ComponentValType::Type(index) } - TypeDefKind::FixedSizeList(ty, elements) => { + TypeDefKind::FixedLengthList(ty, elements) => { let ty = self.encode_valtype(resolve, ty)?; let (index, encoder) = self.defined_type(); - encoder.fixed_size_list(ty, *elements); + encoder.fixed_length_list(ty, *elements); ComponentValType::Type(index) } TypeDefKind::Type(ty) => self.encode_valtype(resolve, ty)?, diff --git a/crates/wit-component/src/printing.rs b/crates/wit-component/src/printing.rs index 4a260fc00e..e87ef8b135 100644 --- a/crates/wit-component/src/printing.rs +++ b/crates/wit-component/src/printing.rs @@ -610,7 +610,7 @@ impl WitPrinter { self.print_type_name(resolve, value_ty)?; self.output.generic_args_end(); } - TypeDefKind::FixedSizeList(ty, size) => { + TypeDefKind::FixedLengthList(ty, size) => { self.output.ty("list", TypeKind::BuiltIn); self.output.generic_args_start(); self.print_type_name(resolve, ty)?; @@ -794,8 +794,8 @@ impl WitPrinter { TypeDefKind::Map(key, value) => { self.declare_map(resolve, ty.name.as_deref(), key, value)? } - TypeDefKind::FixedSizeList(inner, size) => { - self.declare_fixed_size_list(resolve, ty.name.as_deref(), inner, *size)? + TypeDefKind::FixedLengthList(inner, size) => { + self.declare_fixed_length_list(resolve, ty.name.as_deref(), inner, *size)? } TypeDefKind::Type(inner) => match ty.name.as_deref() { Some(name) => { @@ -1035,7 +1035,7 @@ impl WitPrinter { Ok(()) } - fn declare_fixed_size_list( + fn declare_fixed_length_list( &mut self, resolve: &Resolve, name: Option<&str>, diff --git a/crates/wit-dylib/ffi/src/ffi.rs b/crates/wit-dylib/ffi/src/ffi.rs index 9ba95428be..28e23bdf71 100644 --- a/crates/wit-dylib/ffi/src/ffi.rs +++ b/crates/wit-dylib/ffi/src/ffi.rs @@ -24,7 +24,7 @@ pub const WIT_TYPE_ENUM: u32 = 20; pub const WIT_TYPE_OPTION: u32 = 21; pub const WIT_TYPE_RESULT: u32 = 22; pub const WIT_TYPE_LIST: u32 = 23; -pub const WIT_TYPE_FIXED_SIZE_LIST: u32 = 24; +pub const WIT_TYPE_FIXED_LENGTH_LIST: u32 = 24; pub const WIT_TYPE_FUTURE: u32 = 25; pub const WIT_TYPE_STREAM: u32 = 26; pub const WIT_TYPE_ALIAS: u32 = 27; @@ -169,13 +169,13 @@ pub struct wit_list { pub type wit_list_t = wit_list; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct wit_fixed_size_list { +pub struct wit_fixed_length_list { pub interface: *const ::std::os::raw::c_char, pub name: *const ::std::os::raw::c_char, pub size: usize, pub ty: wit_type_t, } -pub type wit_fixed_size_list_t = wit_fixed_size_list; +pub type wit_fixed_length_list_t = wit_fixed_length_list; pub type wit_lift_fn_t = ::std::option::Option< unsafe extern "C" fn(cx: *mut ::std::os::raw::c_void, buffer: *const ::std::os::raw::c_void), >; @@ -280,8 +280,8 @@ pub struct wit { pub results: *const wit_result_t, pub num_lists: usize, pub lists: *const wit_list_t, - pub num_fixed_size_lists: usize, - pub fixed_size_lists: *const wit_fixed_size_list_t, + pub num_fixed_length_lists: usize, + pub fixed_length_lists: *const wit_fixed_length_list_t, pub num_futures: usize, pub futures: *const wit_future_t, pub num_streams: usize, diff --git a/crates/wit-dylib/ffi/src/types.rs b/crates/wit-dylib/ffi/src/types.rs index 1b337d9e55..5899925a1c 100644 --- a/crates/wit-dylib/ffi/src/types.rs +++ b/crates/wit-dylib/ffi/src/types.rs @@ -250,23 +250,23 @@ impl Wit { self.raw_lists().iter().map(|e| List { wit: *self, ptr: e }) } - fn raw_fixed_size_lists(&self) -> &'static [ffi::wit_fixed_size_list_t] { - unsafe { slice(self.ptr.fixed_size_lists, self.ptr.num_fixed_size_lists) } + fn raw_fixed_length_lists(&self) -> &'static [ffi::wit_fixed_length_list_t] { + unsafe { slice(self.ptr.fixed_length_lists, self.ptr.num_fixed_length_lists) } } - pub fn fixed_size_list(&self, index: usize) -> FixedSizeList { - FixedSizeList { + pub fn fixed_length_list(&self, index: usize) -> FixedLengthList { + FixedLengthList { wit: *self, - ptr: &self.raw_fixed_size_lists()[index], + ptr: &self.raw_fixed_length_lists()[index], } } - pub fn iter_fixed_size_lists( + pub fn iter_fixed_length_lists( &self, - ) -> impl ExactSizeIterator + Clone + '_ { - self.raw_fixed_size_lists() + ) -> impl ExactSizeIterator + Clone + '_ { + self.raw_fixed_length_lists() .iter() - .map(|e| FixedSizeList { wit: *self, ptr: e }) + .map(|e| FixedLengthList { wit: *self, ptr: e }) } fn raw_futures(&self) -> &'static [ffi::wit_future_t] { @@ -582,7 +582,7 @@ pub enum Type { Option(WitOption), Result(WitResult), List(List), - FixedSizeList(FixedSizeList), + FixedLengthList(FixedLengthList), Future(Future), Stream(Stream), Alias(Alias), @@ -616,7 +616,7 @@ impl Type { ffi::WIT_TYPE_OPTION => Self::Option(wit.option(index)), ffi::WIT_TYPE_RESULT => Self::Result(wit.result(index)), ffi::WIT_TYPE_LIST => Self::List(wit.list(index)), - ffi::WIT_TYPE_FIXED_SIZE_LIST => Self::FixedSizeList(wit.fixed_size_list(index)), + ffi::WIT_TYPE_FIXED_LENGTH_LIST => Self::FixedLengthList(wit.fixed_length_list(index)), ffi::WIT_TYPE_FUTURE => Self::Future(wit.future(index)), ffi::WIT_TYPE_STREAM => Self::Stream(wit.stream(index)), ffi::WIT_TYPE_ALIAS => Self::Alias(wit.alias(index)), @@ -1000,16 +1000,16 @@ impl fmt::Debug for List { } #[derive(Copy, Clone)] -pub struct FixedSizeList { +pub struct FixedLengthList { wit: Wit, - ptr: &'static ffi::wit_fixed_size_list_t, + ptr: &'static ffi::wit_fixed_length_list_t, } -impl_extra_traits!(FixedSizeList); +impl_extra_traits!(FixedLengthList); -impl FixedSizeList { +impl FixedLengthList { pub fn index(&self) -> usize { - unsafe { (&raw const *self.ptr).offset_from_unsigned(self.wit.ptr.fixed_size_lists) } + unsafe { (&raw const *self.ptr).offset_from_unsigned(self.wit.ptr.fixed_length_lists) } } pub fn interface(&self) -> Option<&'static str> { @@ -1029,9 +1029,9 @@ impl FixedSizeList { } } -impl fmt::Debug for FixedSizeList { +impl fmt::Debug for FixedLengthList { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("FixedSizeList") + f.debug_struct("FixedLengthList") .field("interface", &self.interface()) .field("name", &self.name()) .field("ty", &self.ty()) diff --git a/crates/wit-dylib/src/bindgen.rs b/crates/wit-dylib/src/bindgen.rs index b88a55cd47..09640516b0 100644 --- a/crates/wit-dylib/src/bindgen.rs +++ b/crates/wit-dylib/src/bindgen.rs @@ -1110,9 +1110,9 @@ impl<'a> FunctionCompiler<'a> { // TODO: expand inline? Use a loop if `len` is too big? How much to // share with lowering a list above? Deal with it later. - TypeDefKind::FixedSizeList(t, len) => { + TypeDefKind::FixedLengthList(t, len) => { let _ = (t, len); - todo!("fixed-size-list") + todo!("fixed-length-list") } TypeDefKind::Map(k, v) => { @@ -1453,9 +1453,9 @@ impl<'a> FunctionCompiler<'a> { // TODO: expand inline? Use a loop if `len` is too big? How much to // share with lowering a list above? Deal with it later. - TypeDefKind::FixedSizeList(t, len) => { + TypeDefKind::FixedLengthList(t, len) => { let _ = (t, len); - todo!("fixed-size-list") + todo!("fixed-length-list") } // Variant-like items all go through the `lift_variant` helper. diff --git a/crates/wit-dylib/src/lib.rs b/crates/wit-dylib/src/lib.rs index 96e5784565..77aa764338 100644 --- a/crates/wit-dylib/src/lib.rs +++ b/crates/wit-dylib/src/lib.rs @@ -768,18 +768,18 @@ impl Adapter { }); metadata::Type::List(index) } - TypeDefKind::FixedSizeList(t, len) => { - let index = self.metadata.fixed_size_lists.len(); + TypeDefKind::FixedLengthList(t, len) => { + let index = self.metadata.fixed_length_lists.len(); self.metadata - .fixed_size_lists - .push(metadata::FixedSizeList { + .fixed_length_lists + .push(metadata::FixedLengthList { id, interface, name, len: *len, ty: self.lookup_ty(t), }); - metadata::Type::FixedSizeList(index) + metadata::Type::FixedLengthList(index) } TypeDefKind::Future(t) => { let index = self.metadata.futures.len(); diff --git a/crates/wit-dylib/src/metadata.rs b/crates/wit-dylib/src/metadata.rs index 00a8e59785..f9c8f58d77 100644 --- a/crates/wit-dylib/src/metadata.rs +++ b/crates/wit-dylib/src/metadata.rs @@ -18,7 +18,7 @@ pub struct Metadata { pub options: Vec, pub results: Vec, pub lists: Vec, - pub fixed_size_lists: Vec, + pub fixed_length_lists: Vec, pub futures: Vec, pub streams: Vec, pub aliases: Vec, @@ -109,7 +109,7 @@ pub struct List { pub ty: Type, } -pub struct FixedSizeList { +pub struct FixedLengthList { pub id: TypeId, pub interface: Option, pub name: Option, @@ -186,7 +186,7 @@ pub enum Type { Option(usize), Result(usize), List(usize), - FixedSizeList(usize), + FixedLengthList(usize), Future(usize), Stream(usize), Alias(usize), @@ -242,8 +242,8 @@ impl Metadata { let options = encoder.encode_list(&self.options, Encoder::encode_options); let results = encoder.encode_list(&self.results, Encoder::encode_results); let lists = encoder.encode_list(&self.lists, Encoder::encode_lists); - let fixed_size_lists = - encoder.encode_list(&self.fixed_size_lists, Encoder::encode_fixed_size_lists); + let fixed_length_lists = + encoder.encode_list(&self.fixed_length_lists, Encoder::encode_fixed_length_lists); let futures = encoder.encode_list(&self.futures, Encoder::encode_futures); let streams = encoder.encode_list(&self.streams, Encoder::encode_streams); let aliases = encoder.encode_list(&self.aliases, Encoder::encode_aliases); @@ -263,7 +263,7 @@ impl Metadata { options, results, lists, - fixed_size_lists, + fixed_length_lists, futures, streams, aliases, @@ -538,9 +538,9 @@ impl Encoder { } } - fn encode_fixed_size_lists(&mut self, lists: &[FixedSizeList]) { + fn encode_fixed_length_lists(&mut self, lists: &[FixedLengthList]) { for list in lists { - let FixedSizeList { + let FixedLengthList { id: _, interface, name, @@ -758,7 +758,7 @@ impl Encoder { Type::Option(i) => index(21, i), Type::Result(i) => index(22, i), Type::List(i) => index(23, i), - Type::FixedSizeList(i) => index(24, i), + Type::FixedLengthList(i) => index(24, i), Type::Future(i) => index(25, i), Type::Stream(i) => index(26, i), Type::Alias(i) => index(27, i), diff --git a/crates/wit-dylib/test-programs/src/bin/smoke_caller.rs b/crates/wit-dylib/test-programs/src/bin/smoke_caller.rs index 9c2a2ea2c1..0533d106f0 100644 --- a/crates/wit-dylib/test-programs/src/bin/smoke_caller.rs +++ b/crates/wit-dylib/test-programs/src/bin/smoke_caller.rs @@ -30,7 +30,7 @@ impl TestCase for MyInterpreter { assert_eq!(wit.iter_lists().len(), 0); assert_eq!(wit.iter_options().len(), 0); assert_eq!(wit.iter_results().len(), 0); - assert_eq!(wit.iter_fixed_size_lists().len(), 0); + assert_eq!(wit.iter_fixed_length_lists().len(), 0); assert_eq!(wit.iter_variants().len(), 0); assert_eq!(wit.iter_flags().len(), 0); assert_eq!(wit.iter_enums().len(), 0); diff --git a/crates/wit-dylib/test-programs/src/generate.rs b/crates/wit-dylib/test-programs/src/generate.rs index 697f0ef8af..3539e57a98 100644 --- a/crates/wit-dylib/test-programs/src/generate.rs +++ b/crates/wit-dylib/test-programs/src/generate.rs @@ -77,7 +77,7 @@ impl Generator { Type::ErrorContext => todo!(), Type::Stream(_) => todo!(), Type::Future(_) => todo!(), - Type::FixedSizeList(_) => todo!(), + Type::FixedLengthList(_) => todo!(), } } diff --git a/crates/wit-dylib/tests/roundtrip.rs b/crates/wit-dylib/tests/roundtrip.rs index 3cebbd2706..af03d09d72 100644 --- a/crates/wit-dylib/tests/roundtrip.rs +++ b/crates/wit-dylib/tests/roundtrip.rs @@ -62,7 +62,7 @@ fn run_one(u: &mut Unstructured<'_>) -> Result<()> { let iters = 200; let mut config = u.arbitrary::()?; config.error_context = false; - config.fixed_size_list = false; + config.fixed_length_list = false; config.futures = false; // TODO config.streams = false; // TODO config.async_ = false; diff --git a/crates/wit-dylib/wit_dylib.h b/crates/wit-dylib/wit_dylib.h index 25b2b66e5e..fe39487965 100644 --- a/crates/wit-dylib/wit_dylib.h +++ b/crates/wit-dylib/wit_dylib.h @@ -46,7 +46,7 @@ typedef uint32_t wit_type_t; #define WIT_TYPE_OPTION 21 #define WIT_TYPE_RESULT 22 #define WIT_TYPE_LIST 23 -#define WIT_TYPE_FIXED_SIZE_LIST 24 +#define WIT_TYPE_FIXED_LENGTH_LIST 24 #define WIT_TYPE_FUTURE 25 #define WIT_TYPE_STREAM 26 #define WIT_TYPE_ALIAS 27 @@ -199,12 +199,12 @@ typedef struct wit_list { wit_type_t ty; } wit_list_t; -typedef struct wit_fixed_size_list { +typedef struct wit_fixed_length_list { const char *interface; const char *name; size_t size; wit_type_t ty; -} wit_fixed_size_list_t; +} wit_fixed_length_list_t; typedef void(*wit_lift_fn_t)(void* cx, const void *buffer); typedef void(*wit_lower_fn_t)(void* cx, void *buffer); @@ -292,8 +292,8 @@ typedef struct wit { const wit_result_t *results; size_t num_lists; const wit_list_t *lists; - size_t num_fixed_size_lists; - const wit_fixed_size_list_t *fixed_size_lists; + size_t num_fixed_length_lists; + const wit_fixed_length_list_t *fixed_length_lists; size_t num_futures; const wit_future_t *futures; size_t num_streams; diff --git a/crates/wit-encoder/src/from_parser.rs b/crates/wit-encoder/src/from_parser.rs index 84d8b62c7c..5e1c692a94 100644 --- a/crates/wit-encoder/src/from_parser.rs +++ b/crates/wit-encoder/src/from_parser.rs @@ -247,8 +247,8 @@ impl<'a> Converter<'a> { let output = Type::map(self.convert_type(key), self.convert_type(value)); TypeDefKind::Type(output) } - wit_parser::TypeDefKind::FixedSizeList(ty, size) => { - let output = Type::fixed_size_list(self.convert_type(ty), *size); + wit_parser::TypeDefKind::FixedLengthList(ty, size) => { + let output = Type::fixed_length_list(self.convert_type(ty), *size); TypeDefKind::Type(output) } wit_parser::TypeDefKind::Handle(handle) => { @@ -315,8 +315,8 @@ impl<'a> Converter<'a> { wit_parser::TypeDefKind::Map(key, value) => { Type::map(self.convert_type(key), self.convert_type(value)) } - wit_parser::TypeDefKind::FixedSizeList(type_, size) => { - Type::fixed_size_list(self.convert_type(type_), *size) + wit_parser::TypeDefKind::FixedLengthList(type_, size) => { + Type::fixed_length_list(self.convert_type(type_), *size) } wit_parser::TypeDefKind::Handle(handle) => self.handle_to_type(handle), wit_parser::TypeDefKind::Future(type_) => { diff --git a/crates/wit-encoder/src/ty.rs b/crates/wit-encoder/src/ty.rs index f0fdb7d56c..68c0ed7337 100644 --- a/crates/wit-encoder/src/ty.rs +++ b/crates/wit-encoder/src/ty.rs @@ -27,7 +27,7 @@ pub enum Type { Result(Box), List(Box), Map(Box, Box), - FixedSizeList(Box, u32), + FixedLengthList(Box, u32), Tuple(Tuple), Future(Option>), Stream(Option>), @@ -63,8 +63,8 @@ impl Type { pub fn map(key: Type, value: Type) -> Self { Type::Map(Box::new(key), Box::new(value)) } - pub fn fixed_size_list(type_: Type, size: u32) -> Self { - Type::FixedSizeList(Box::new(type_), size) + pub fn fixed_length_list(type_: Type, size: u32) -> Self { + Type::FixedLengthList(Box::new(type_), size) } pub fn tuple(types: impl IntoIterator) -> Self { Type::Tuple(Tuple { @@ -127,7 +127,7 @@ impl Display for Type { Type::Map(key, value) => { write!(f, "map<{key}, {value}>") } - Type::FixedSizeList(type_, size) => { + Type::FixedLengthList(type_, size) => { write!(f, "list<{type_}, {size}>") } Type::Tuple(tuple) => tuple.fmt(f), diff --git a/crates/wit-parser/src/abi.rs b/crates/wit-parser/src/abi.rs index 38b8154500..8655bdf193 100644 --- a/crates/wit-parser/src/abi.rs +++ b/crates/wit-parser/src/abi.rs @@ -340,7 +340,7 @@ impl Resolve { result.push(WasmType::Pointer) && result.push(WasmType::Length) } - TypeDefKind::FixedSizeList(ty, size) => { + TypeDefKind::FixedLengthList(ty, size) => { self.push_flat_list((0..*size).map(|_| ty), result) } diff --git a/crates/wit-parser/src/ast.rs b/crates/wit-parser/src/ast.rs index 89b999b8d6..84d30be186 100644 --- a/crates/wit-parser/src/ast.rs +++ b/crates/wit-parser/src/ast.rs @@ -760,7 +760,7 @@ enum Type<'a> { Name(Id<'a>), List(List<'a>), Map(Map<'a>), - FixedSizeList(FixedSizeList<'a>), + FixedLengthList(FixedLengthList<'a>), Handle(Handle<'a>), Resource(Resource<'a>), Record(Record<'a>), @@ -924,7 +924,7 @@ struct Map<'a> { value: Box>, } -struct FixedSizeList<'a> { +struct FixedLengthList<'a> { span: Span, ty: Box>, size: u32, @@ -1398,14 +1398,14 @@ impl<'a> Type<'a> { let size: u32 = tokens.get_span(span).parse()?; Some(size) } else { - return Err(err_expected(tokens, "fixed size", number).into()); + return Err(err_expected(tokens, "fixed-length", number).into()); } } else { None }; tokens.expect(Token::GreaterThan)?; if let Some(size) = size { - Ok(Type::FixedSizeList(FixedSizeList { + Ok(Type::FixedLengthList(FixedLengthList { span, ty: Box::new(ty), size, @@ -1543,7 +1543,7 @@ impl<'a> Type<'a> { Type::Name(id) => id.span, Type::List(l) => l.span, Type::Map(m) => m.span, - Type::FixedSizeList(l) => l.span, + Type::FixedLengthList(l) => l.span, Type::Handle(h) => h.span(), Type::Resource(r) => r.span, Type::Record(r) => r.span, diff --git a/crates/wit-parser/src/ast/resolve.rs b/crates/wit-parser/src/ast/resolve.rs index 04221005a2..43343d1582 100644 --- a/crates/wit-parser/src/ast/resolve.rs +++ b/crates/wit-parser/src/ast/resolve.rs @@ -97,7 +97,7 @@ enum Key { Enum(Vec), List(Type), Map(Type, Type), - FixedSizeList(Type, u32), + FixedLengthList(Type, u32), Option(Type), Result(Option, Option), Future(Option), @@ -1218,9 +1218,9 @@ impl<'a> Resolver<'a> { TypeDefKind::Map(key_ty, value_ty) } - ast::Type::FixedSizeList(list) => { + ast::Type::FixedLengthList(list) => { let ty = self.resolve_type(&list.ty, stability)?; - TypeDefKind::FixedSizeList(ty, list.size) + TypeDefKind::FixedLengthList(ty, list.size) } ast::Type::Handle(handle) => TypeDefKind::Handle(match handle { ast::Handle::Own { resource } => Handle::Own(self.validate_resource(resource)?), @@ -1403,7 +1403,7 @@ impl<'a> Resolver<'a> { } TypeDefKind::Tuple(t) => t.types.iter().find_map(|ty| find_in_type(types, *ty)), TypeDefKind::List(ty) - | TypeDefKind::FixedSizeList(ty, _) + | TypeDefKind::FixedLengthList(ty, _) | TypeDefKind::Option(ty) => find_in_type(types, *ty), TypeDefKind::Map(k, v) => { find_in_type(types, *k).or_else(|| find_in_type(types, *v)) @@ -1500,7 +1500,7 @@ impl<'a> Resolver<'a> { } TypeDefKind::List(ty) => Key::List(*ty), TypeDefKind::Map(k, v) => Key::Map(*k, *v), - TypeDefKind::FixedSizeList(ty, size) => Key::FixedSizeList(*ty, *size), + TypeDefKind::FixedLengthList(ty, size) => Key::FixedLengthList(*ty, *size), TypeDefKind::Option(t) => Key::Option(*t), TypeDefKind::Result(r) => Key::Result(r.ok, r.err), TypeDefKind::Future(ty) => Key::Future(*ty), @@ -1788,7 +1788,7 @@ fn collect_deps<'a>(ty: &ast::Type<'a>, deps: &mut Vec>) { } ast::Type::Option(ast::Option_ { ty, .. }) | ast::Type::List(ast::List { ty, .. }) - | ast::Type::FixedSizeList(ast::FixedSizeList { ty, .. }) => collect_deps(ty, deps), + | ast::Type::FixedLengthList(ast::FixedLengthList { ty, .. }) => collect_deps(ty, deps), ast::Type::Map(ast::Map { key, value, .. }) => { collect_deps(key, deps); collect_deps(value, deps); diff --git a/crates/wit-parser/src/decoding.rs b/crates/wit-parser/src/decoding.rs index 814dced4fd..d07fa8e354 100644 --- a/crates/wit-parser/src/decoding.rs +++ b/crates/wit-parser/src/decoding.rs @@ -1264,7 +1264,7 @@ impl WitPackageDecoder<'_> { TypeDefKind::Type(_) | TypeDefKind::List(_) | TypeDefKind::Map(_, _) - | TypeDefKind::FixedSizeList(..) + | TypeDefKind::FixedLengthList(..) | TypeDefKind::Tuple(_) | TypeDefKind::Option(_) | TypeDefKind::Result(_) @@ -1311,9 +1311,9 @@ impl WitPackageDecoder<'_> { Ok(TypeDefKind::Map(k, v)) } - ComponentDefinedType::FixedSizeList(t, size) => { + ComponentDefinedType::FixedLengthList(t, size) => { let t = self.convert_valtype(t)?; - Ok(TypeDefKind::FixedSizeList(t, *size)) + Ok(TypeDefKind::FixedLengthList(t, *size)) } ComponentDefinedType::Tuple(t) => { @@ -1621,11 +1621,11 @@ impl Registrar<'_> { self.valtype(v, value_ty) } - ComponentDefinedType::FixedSizeList(t, elements) => { + ComponentDefinedType::FixedLengthList(t, elements) => { let ty = match &self.resolve.types[id].kind { - TypeDefKind::FixedSizeList(r, elements2) if elements2 == elements => r, + TypeDefKind::FixedLengthList(r, elements2) if elements2 == elements => r, TypeDefKind::Type(Type::Id(_)) => return Ok(()), - _ => bail!("expected a fixed size {elements} list"), + _ => bail!("expected a fixed-length {elements} list"), }; self.valtype(t, ty) } diff --git a/crates/wit-parser/src/lib.rs b/crates/wit-parser/src/lib.rs index 3266c10732..25217a7423 100644 --- a/crates/wit-parser/src/lib.rs +++ b/crates/wit-parser/src/lib.rs @@ -643,7 +643,7 @@ pub enum TypeDefKind { Result(Result_), List(Type), Map(Type, Type), - FixedSizeList(Type, u32), + FixedLengthList(Type, u32), Future(Option), Stream(Option), Type(Type), @@ -673,7 +673,7 @@ impl TypeDefKind { TypeDefKind::Result(_) => "result", TypeDefKind::List(_) => "list", TypeDefKind::Map(_, _) => "map", - TypeDefKind::FixedSizeList(..) => "fixed size list", + TypeDefKind::FixedLengthList(..) => "fixed-length list", TypeDefKind::Future(_) => "future", TypeDefKind::Stream(_) => "stream", TypeDefKind::Type(_) => "type", @@ -1300,7 +1300,7 @@ fn find_futures_and_streams(resolve: &Resolve, ty: Type, results: &mut Vec { find_futures_and_streams(resolve, *ty, results); } diff --git a/crates/wit-parser/src/live.rs b/crates/wit-parser/src/live.rs index 4819666c85..3e6b1f4fd7 100644 --- a/crates/wit-parser/src/live.rs +++ b/crates/wit-parser/src/live.rs @@ -135,7 +135,7 @@ pub trait TypeIdVisitor { match &ty.kind { TypeDefKind::Type(t) | TypeDefKind::List(t) - | TypeDefKind::FixedSizeList(t, ..) + | TypeDefKind::FixedLengthList(t, ..) | TypeDefKind::Option(t) | TypeDefKind::Future(Some(t)) | TypeDefKind::Stream(Some(t)) => self.visit_type(resolve, t), diff --git a/crates/wit-parser/src/resolve/clone.rs b/crates/wit-parser/src/resolve/clone.rs index a28431c7ec..772fe96ebc 100644 --- a/crates/wit-parser/src/resolve/clone.rs +++ b/crates/wit-parser/src/resolve/clone.rs @@ -140,7 +140,7 @@ impl<'a> Cloner<'a> { } TypeDefKind::Option(ty) | TypeDefKind::List(ty) - | TypeDefKind::FixedSizeList(ty, ..) => { + | TypeDefKind::FixedLengthList(ty, ..) => { self.ty(ty); } TypeDefKind::Map(k, v) => { diff --git a/crates/wit-parser/src/resolve/mod.rs b/crates/wit-parser/src/resolve/mod.rs index 21991feac0..8d8eb30e29 100644 --- a/crates/wit-parser/src/resolve/mod.rs +++ b/crates/wit-parser/src/resolve/mod.rs @@ -400,7 +400,9 @@ package {name} is defined in two different locations:\n\ | TypeDefKind::Result(_) | TypeDefKind::Future(_) | TypeDefKind::Stream(_) => false, - TypeDefKind::Type(t) | TypeDefKind::FixedSizeList(t, ..) => self.all_bits_valid(t), + TypeDefKind::Type(t) | TypeDefKind::FixedLengthList(t, ..) => { + self.all_bits_valid(t) + } TypeDefKind::Handle(h) => match h { crate::Handle::Own(_) => true, @@ -3165,9 +3167,11 @@ impl Remap { } } } - Option(t) | List(t, ..) | FixedSizeList(t, ..) | Future(Some(t)) | Stream(Some(t)) => { - self.update_ty(resolve, t, span)? - } + Option(t) + | List(t, ..) + | FixedLengthList(t, ..) + | Future(Some(t)) + | Stream(Some(t)) => self.update_ty(resolve, t, span)?, Map(k, v) => { self.update_ty(resolve, k, span)?; self.update_ty(resolve, v, span)?; @@ -3662,7 +3666,7 @@ impl Remap { TypeDefKind::Tuple(t) => t.types.iter().any(|t| self.type_has_borrow(resolve, t)), TypeDefKind::Enum(_) => false, TypeDefKind::List(ty) - | TypeDefKind::FixedSizeList(ty, ..) + | TypeDefKind::FixedLengthList(ty, ..) | TypeDefKind::Future(Some(ty)) | TypeDefKind::Stream(Some(ty)) | TypeDefKind::Option(ty) => self.type_has_borrow(resolve, ty), diff --git a/crates/wit-parser/src/sizealign.rs b/crates/wit-parser/src/sizealign.rs index 6c49f2507f..0c6acd83bb 100644 --- a/crates/wit-parser/src/sizealign.rs +++ b/crates/wit-parser/src/sizealign.rs @@ -263,7 +263,7 @@ impl SizeAlign { fn calculate(&self, ty: &TypeDef) -> ElementInfo { match &ty.kind { TypeDefKind::Type(t) => ElementInfo::new(self.size(t), self.align(t)), - TypeDefKind::FixedSizeList(t, size) => { + TypeDefKind::FixedLengthList(t, size) => { let field_align = self.align(t); let field_size = self.size(t); ElementInfo::new( diff --git a/crates/wit-parser/tests/ui/parse-fail/bad-list2.wit.result b/crates/wit-parser/tests/ui/parse-fail/bad-list2.wit.result index 94b02e2ad5..248a9d4df8 100644 --- a/crates/wit-parser/tests/ui/parse-fail/bad-list2.wit.result +++ b/crates/wit-parser/tests/ui/parse-fail/bad-list2.wit.result @@ -1,4 +1,4 @@ -expected fixed size, found keyword `type` +expected fixed-length, found keyword `type` --> tests/ui/parse-fail/bad-list2.wit:6:3 | 6 | type y = u32 diff --git a/crates/wit-parser/tests/ui/parse-fail/bad-list3.wit.result b/crates/wit-parser/tests/ui/parse-fail/bad-list3.wit.result index 4f48238f89..39d54a0383 100644 --- a/crates/wit-parser/tests/ui/parse-fail/bad-list3.wit.result +++ b/crates/wit-parser/tests/ui/parse-fail/bad-list3.wit.result @@ -1,4 +1,4 @@ -expected fixed size, found '>' +expected fixed-length, found '>' --> tests/ui/parse-fail/bad-list3.wit:4:21 | 4 | type a = list diff --git a/crates/wit-parser/tests/ui/parse-fail/bad-list4.wit.result b/crates/wit-parser/tests/ui/parse-fail/bad-list4.wit.result index c2aae207fa..bc41d366c4 100644 --- a/crates/wit-parser/tests/ui/parse-fail/bad-list4.wit.result +++ b/crates/wit-parser/tests/ui/parse-fail/bad-list4.wit.result @@ -1,4 +1,4 @@ -expected fixed size, found keyword `u32` +expected fixed-length, found keyword `u32` --> tests/ui/parse-fail/bad-list4.wit:4:22 | 4 | type b = list diff --git a/crates/wit-parser/tests/ui/types.wit.json b/crates/wit-parser/tests/ui/types.wit.json index a8dfbc8136..baa6a74849 100644 --- a/crates/wit-parser/tests/ui/types.wit.json +++ b/crates/wit-parser/tests/ui/types.wit.json @@ -703,7 +703,7 @@ { "name": "t51a", "kind": { - "fixed-size-list": [ + "fixed-length-list": [ "u32", 4 ] @@ -715,7 +715,7 @@ { "name": null, "kind": { - "fixed-size-list": [ + "fixed-length-list": [ "u32", 4 ] @@ -725,7 +725,7 @@ { "name": "t51b", "kind": { - "fixed-size-list": [ + "fixed-length-list": [ 53, 2 ] diff --git a/crates/wit-smith/src/config.rs b/crates/wit-smith/src/config.rs index 3bd3ecfe9a..e5d0849845 100644 --- a/crates/wit-smith/src/config.rs +++ b/crates/wit-smith/src/config.rs @@ -27,8 +27,8 @@ pub struct Config { pub streams: bool, #[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().error_context))] pub error_context: bool, - #[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().fixed_size_list))] - pub fixed_size_list: bool, + #[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().fixed_length_lists))] + pub fixed_length_lists: bool, #[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().world_include))] pub world_include: bool, } @@ -48,7 +48,7 @@ impl Default for Config { futures: false, streams: false, error_context: false, - fixed_size_list: false, + fixed_length_lists: false, world_include: false, } } @@ -69,7 +69,7 @@ impl Arbitrary<'_> for Config { futures: u.arbitrary()?, streams: u.arbitrary()?, error_context: u.arbitrary()?, - fixed_size_list: u.arbitrary()?, + fixed_length_lists: u.arbitrary()?, world_include: false, }) } diff --git a/crates/wit-smith/src/generate.rs b/crates/wit-smith/src/generate.rs index f823bfd28b..eddc657303 100644 --- a/crates/wit-smith/src/generate.rs +++ b/crates/wit-smith/src/generate.rs @@ -1090,7 +1090,7 @@ impl<'a> InterfaceGenerator<'a> { Option, Result, List, - FixedSizeList, + FixedLengthList, Stream, Future, ErrorContext, @@ -1172,8 +1172,8 @@ impl<'a> InterfaceGenerator<'a> { self.gen_type(u, fuel, dst)?; dst.push_str(">"); } - Kind::FixedSizeList => { - if !self.generator.config.fixed_size_list { + Kind::FixedLengthList => { + if !self.generator.config.fixed_length_lists { continue; } *fuel = match fuel.checked_sub(1) { diff --git a/tests/cli/component-model/async/abi.wast b/tests/cli/component-model/async/abi.wast index 04c94d8d8d..ede47c94d0 100644 --- a/tests/cli/component-model/async/abi.wast +++ b/tests/cli/component-model/async/abi.wast @@ -1,4 +1,4 @@ -;; RUN: wast --assert default --snapshot tests/snapshots % -f cm-async,cm-fixed-size-list +;; RUN: wast --assert default --snapshot tests/snapshots % -f cm-async,cm-fixed-length-lists ;; async lower (component diff --git a/tests/cli/component-model/async/stackful.wast b/tests/cli/component-model/async/stackful.wast index e581b80aec..bc6688531f 100644 --- a/tests/cli/component-model/async/stackful.wast +++ b/tests/cli/component-model/async/stackful.wast @@ -1,4 +1,4 @@ -;; RUN: wast --assert default --snapshot tests/snapshots % -f cm-async,cm-async-stackful,cm-fixed-size-list +;; RUN: wast --assert default --snapshot tests/snapshots % -f cm-async,cm-async-stackful,cm-fixed-length-lists ;; waitable-set.wait (component diff --git a/tests/cli/component-model/fixed-size-list.wast b/tests/cli/component-model/fixed-length-list.wast similarity index 98% rename from tests/cli/component-model/fixed-size-list.wast rename to tests/cli/component-model/fixed-length-list.wast index 63b8943f11..5b3631f743 100644 --- a/tests/cli/component-model/fixed-size-list.wast +++ b/tests/cli/component-model/fixed-length-list.wast @@ -1,4 +1,4 @@ -;; RUN: wast % --assert default --snapshot tests/snapshots -f cm-fixed-size-list +;; RUN: wast % --assert default --snapshot tests/snapshots -f cm-fixed-length-lists (component (core module $m diff --git a/tests/cli/missing-features/component-model/fixed-size-list.wast b/tests/cli/missing-features/component-model/fixed-length-list.wast similarity index 79% rename from tests/cli/missing-features/component-model/fixed-size-list.wast rename to tests/cli/missing-features/component-model/fixed-length-list.wast index b6a92ada29..4e20f1a405 100644 --- a/tests/cli/missing-features/component-model/fixed-size-list.wast +++ b/tests/cli/missing-features/component-model/fixed-length-list.wast @@ -12,7 +12,7 @@ (canon lift (core func $i "ret-list") (memory $i "memory")) ) ) - "Fixed size lists require the component model fixed size list feature (at offset 0x54)" + "Fixed size lists require the component model fixed-length list feature (at offset 0x54)" ) (assert_invalid @@ -26,5 +26,5 @@ (canon lift (core func $i "param-list")) ) ) - "Fixed size lists require the component model fixed size list feature" + "Fixed size lists require the component model fixed-length list feature" ) diff --git a/tests/cli/validate-unknown-features.wat.stderr b/tests/cli/validate-unknown-features.wat.stderr index 22b6c7a6f6..4f86f9384a 100644 --- a/tests/cli/validate-unknown-features.wat.stderr +++ b/tests/cli/validate-unknown-features.wat.stderr @@ -1,4 +1,4 @@ error: invalid value 'unknown' for '--features ': unknown feature `unknown` -Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, cm-values, cm-nested-names, cm-async, cm-async-stackful, cm-async-builtins, cm-threading, cm-error-context, cm-fixed-size-list, cm-gc, call-indirect-overlong, bulk-memory-opt, custom-descriptors, compact-imports, cm-map, mvp, wasm1, wasm2, wasm3, lime1, all +Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, cm-values, cm-nested-names, cm-async, cm-async-stackful, cm-async-builtins, cm-threading, cm-error-context, cm-fixed-length-lists, cm-gc, call-indirect-overlong, bulk-memory-opt, custom-descriptors, compact-imports, cm-map, mvp, wasm1, wasm2, wasm3, lime1, all For more information, try '--help'. diff --git a/tests/cli/wit-deep-list.wit b/tests/cli/wit-deep-list.wit index a3c23d4434..26c4b54e4f 100644 --- a/tests/cli/wit-deep-list.wit +++ b/tests/cli/wit-deep-list.wit @@ -1,5 +1,5 @@ -// RUN[parse]: component wit % -t | validate -f cm-fixed-size-list -// RUN[abi]: component embed --dummy % | component new | validate -f cm-fixed-size-list +// RUN[parse]: component wit % -t | validate -f cm-fixed-length-lists +// RUN[abi]: component embed --dummy % | component new | validate -f cm-fixed-length-lists package a:b; diff --git a/tests/snapshots/cli/component-model/fixed-size-list.wast.json b/tests/snapshots/cli/component-model/fixed-length-list.wast.json similarity index 69% rename from tests/snapshots/cli/component-model/fixed-size-list.wast.json rename to tests/snapshots/cli/component-model/fixed-length-list.wast.json index 2d7c8c444c..72106a3e6f 100644 --- a/tests/snapshots/cli/component-model/fixed-size-list.wast.json +++ b/tests/snapshots/cli/component-model/fixed-length-list.wast.json @@ -1,43 +1,43 @@ { - "source_filename": "tests/cli/component-model/fixed-size-list.wast", + "source_filename": "tests/cli/component-model/fixed-length-list.wast", "commands": [ { "type": "module", "line": 3, - "filename": "fixed-size-list.0.wasm", + "filename": "fixed-length-list.0.wasm", "module_type": "binary" }, { "type": "module", "line": 15, - "filename": "fixed-size-list.1.wasm", + "filename": "fixed-length-list.1.wasm", "module_type": "binary" }, { "type": "assert_invalid", "line": 27, - "filename": "fixed-size-list.2.wasm", + "filename": "fixed-length-list.2.wasm", "module_type": "binary", "text": "Fixed size lists must have more than zero elements (at offset 0x54)" }, { "type": "assert_malformed", "line": 42, - "filename": "fixed-size-list.3.wat", + "filename": "fixed-length-list.3.wat", "module_type": "text", "text": "invalid u32 number: constant out of range" }, { "type": "assert_invalid", "line": 57, - "filename": "fixed-size-list.4.wasm", + "filename": "fixed-length-list.4.wasm", "module_type": "binary", "text": "type mismatch for import `x`" }, { "type": "assert_invalid", "line": 70, - "filename": "fixed-size-list.5.wasm", + "filename": "fixed-length-list.5.wasm", "module_type": "binary", "text": "type mismatch for import `x`" } diff --git a/tests/snapshots/cli/component-model/fixed-size-list.wast/0.print b/tests/snapshots/cli/component-model/fixed-length-list.wast/0.print similarity index 100% rename from tests/snapshots/cli/component-model/fixed-size-list.wast/0.print rename to tests/snapshots/cli/component-model/fixed-length-list.wast/0.print diff --git a/tests/snapshots/cli/component-model/fixed-size-list.wast/1.print b/tests/snapshots/cli/component-model/fixed-length-list.wast/1.print similarity index 100% rename from tests/snapshots/cli/component-model/fixed-size-list.wast/1.print rename to tests/snapshots/cli/component-model/fixed-length-list.wast/1.print diff --git a/tests/snapshots/cli/missing-features/component-model/fixed-size-list.wast.json b/tests/snapshots/cli/missing-features/component-model/fixed-length-list.wast.json similarity index 68% rename from tests/snapshots/cli/missing-features/component-model/fixed-size-list.wast.json rename to tests/snapshots/cli/missing-features/component-model/fixed-length-list.wast.json index d91233361d..cc1e4937b5 100644 --- a/tests/snapshots/cli/missing-features/component-model/fixed-size-list.wast.json +++ b/tests/snapshots/cli/missing-features/component-model/fixed-length-list.wast.json @@ -1,19 +1,19 @@ { - "source_filename": "tests/cli/missing-features/component-model/fixed-size-list.wast", + "source_filename": "tests/cli/missing-features/component-model/fixed-length-list.wast", "commands": [ { "type": "assert_invalid", "line": 4, - "filename": "fixed-size-list.0.wasm", + "filename": "fixed-length-list.0.wasm", "module_type": "binary", - "text": "Fixed size lists require the component model fixed size list feature (at offset 0x54)" + "text": "Fixed size lists require the component model fixed-length list feature (at offset 0x54)" }, { "type": "assert_invalid", "line": 19, - "filename": "fixed-size-list.1.wasm", + "filename": "fixed-length-list.1.wasm", "module_type": "binary", - "text": "Fixed size lists require the component model fixed size list feature" + "text": "Fixed size lists require the component model fixed-length list feature" } ] } \ No newline at end of file From 6417c1a0c481304a036cf4d692d5cc0b0b29b9a1 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Tue, 20 Jan 2026 13:49:59 +0100 Subject: [PATCH 2/5] found some places where the feature was missing an s --- crates/wit-dylib/tests/roundtrip.rs | 2 +- .../{fixed-length-list.wast => fixed-length-lists.wast} | 0 .../{fixed-length-list.wast => fixed-length-lists.wast} | 0 ...fixed-length-list.wast.json => fixed-length-lists.wast.json} | 0 .../{fixed-length-list.wast => fixed-length-lists.wast}/0.print | 0 .../{fixed-length-list.wast => fixed-length-lists.wast}/1.print | 0 ...fixed-length-list.wast.json => fixed-length-lists.wast.json} | 0 7 files changed, 1 insertion(+), 1 deletion(-) rename tests/cli/component-model/{fixed-length-list.wast => fixed-length-lists.wast} (100%) rename tests/cli/missing-features/component-model/{fixed-length-list.wast => fixed-length-lists.wast} (100%) rename tests/snapshots/cli/component-model/{fixed-length-list.wast.json => fixed-length-lists.wast.json} (100%) rename tests/snapshots/cli/component-model/{fixed-length-list.wast => fixed-length-lists.wast}/0.print (100%) rename tests/snapshots/cli/component-model/{fixed-length-list.wast => fixed-length-lists.wast}/1.print (100%) rename tests/snapshots/cli/missing-features/component-model/{fixed-length-list.wast.json => fixed-length-lists.wast.json} (100%) diff --git a/crates/wit-dylib/tests/roundtrip.rs b/crates/wit-dylib/tests/roundtrip.rs index af03d09d72..ef60ea4e6d 100644 --- a/crates/wit-dylib/tests/roundtrip.rs +++ b/crates/wit-dylib/tests/roundtrip.rs @@ -62,7 +62,7 @@ fn run_one(u: &mut Unstructured<'_>) -> Result<()> { let iters = 200; let mut config = u.arbitrary::()?; config.error_context = false; - config.fixed_length_list = false; + config.fixed_length_lists = false; config.futures = false; // TODO config.streams = false; // TODO config.async_ = false; diff --git a/tests/cli/component-model/fixed-length-list.wast b/tests/cli/component-model/fixed-length-lists.wast similarity index 100% rename from tests/cli/component-model/fixed-length-list.wast rename to tests/cli/component-model/fixed-length-lists.wast diff --git a/tests/cli/missing-features/component-model/fixed-length-list.wast b/tests/cli/missing-features/component-model/fixed-length-lists.wast similarity index 100% rename from tests/cli/missing-features/component-model/fixed-length-list.wast rename to tests/cli/missing-features/component-model/fixed-length-lists.wast diff --git a/tests/snapshots/cli/component-model/fixed-length-list.wast.json b/tests/snapshots/cli/component-model/fixed-length-lists.wast.json similarity index 100% rename from tests/snapshots/cli/component-model/fixed-length-list.wast.json rename to tests/snapshots/cli/component-model/fixed-length-lists.wast.json diff --git a/tests/snapshots/cli/component-model/fixed-length-list.wast/0.print b/tests/snapshots/cli/component-model/fixed-length-lists.wast/0.print similarity index 100% rename from tests/snapshots/cli/component-model/fixed-length-list.wast/0.print rename to tests/snapshots/cli/component-model/fixed-length-lists.wast/0.print diff --git a/tests/snapshots/cli/component-model/fixed-length-list.wast/1.print b/tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print similarity index 100% rename from tests/snapshots/cli/component-model/fixed-length-list.wast/1.print rename to tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print diff --git a/tests/snapshots/cli/missing-features/component-model/fixed-length-list.wast.json b/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json similarity index 100% rename from tests/snapshots/cli/missing-features/component-model/fixed-length-list.wast.json rename to tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json From c909a9961df255bea9006d56447af088f1347211 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Tue, 20 Jan 2026 14:08:50 +0100 Subject: [PATCH 3/5] a few renames were missing --- .../component-model/fixed-length-lists.wast.json | 16 ++++++++-------- .../component-model/fixed-length-lists.wast.json | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/snapshots/cli/component-model/fixed-length-lists.wast.json b/tests/snapshots/cli/component-model/fixed-length-lists.wast.json index 72106a3e6f..23eccc21bf 100644 --- a/tests/snapshots/cli/component-model/fixed-length-lists.wast.json +++ b/tests/snapshots/cli/component-model/fixed-length-lists.wast.json @@ -1,43 +1,43 @@ { - "source_filename": "tests/cli/component-model/fixed-length-list.wast", + "source_filename": "tests/cli/component-model/fixed-length-lists.wast", "commands": [ { "type": "module", "line": 3, - "filename": "fixed-length-list.0.wasm", + "filename": "fixed-length-lists.0.wasm", "module_type": "binary" }, { "type": "module", "line": 15, - "filename": "fixed-length-list.1.wasm", + "filename": "fixed-length-lists.1.wasm", "module_type": "binary" }, { "type": "assert_invalid", "line": 27, - "filename": "fixed-length-list.2.wasm", + "filename": "fixed-length-lists.2.wasm", "module_type": "binary", - "text": "Fixed size lists must have more than zero elements (at offset 0x54)" + "text": "Fixed length-lists must have more than zero elements (at offset 0x54)" }, { "type": "assert_malformed", "line": 42, - "filename": "fixed-length-list.3.wat", + "filename": "fixed-length-lists.3.wat", "module_type": "text", "text": "invalid u32 number: constant out of range" }, { "type": "assert_invalid", "line": 57, - "filename": "fixed-length-list.4.wasm", + "filename": "fixed-length-lists.4.wasm", "module_type": "binary", "text": "type mismatch for import `x`" }, { "type": "assert_invalid", "line": 70, - "filename": "fixed-length-list.5.wasm", + "filename": "fixed-length-lists.5.wasm", "module_type": "binary", "text": "type mismatch for import `x`" } diff --git a/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json b/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json index cc1e4937b5..4405a08031 100644 --- a/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json +++ b/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json @@ -1,17 +1,17 @@ { - "source_filename": "tests/cli/missing-features/component-model/fixed-length-list.wast", + "source_filename": "tests/cli/missing-features/component-model/fixed-length-lists.wast", "commands": [ { "type": "assert_invalid", "line": 4, - "filename": "fixed-length-list.0.wasm", + "filename": "fixed-length-lists.0.wasm", "module_type": "binary", "text": "Fixed size lists require the component model fixed-length list feature (at offset 0x54)" }, { "type": "assert_invalid", "line": 19, - "filename": "fixed-length-list.1.wasm", + "filename": "fixed-length-lists.1.wasm", "module_type": "binary", "text": "Fixed size lists require the component model fixed-length list feature" } From 74b117bd34e3c5abf473d7461950e4926dde8d2d Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Tue, 20 Jan 2026 14:27:57 +0100 Subject: [PATCH 4/5] hopefully the last round of test related string changes --- crates/wasmparser/src/validator/component.rs | 4 ++-- tests/cli/component-model/fixed-length-lists.wast | 2 +- .../missing-features/component-model/fixed-length-lists.wast | 4 ++-- .../cli/component-model/fixed-length-lists.wast.json | 2 +- .../component-model/fixed-length-lists.wast.json | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/wasmparser/src/validator/component.rs b/crates/wasmparser/src/validator/component.rs index 05b12ed2be..adb05f5c92 100644 --- a/crates/wasmparser/src/validator/component.rs +++ b/crates/wasmparser/src/validator/component.rs @@ -3933,11 +3933,11 @@ impl ComponentState { if !self.features.cm_fixed_length_lists() { bail!( offset, - "Fixed size lists require the component model fixed-length list feature" + "Fixed-length lists require the component model fixed-length lists feature" ) } if elements < 1 { - bail!(offset, "Fixed size lists must have more than zero elements") + bail!(offset, "Fixed-length lists must have more than zero elements") } Ok(ComponentDefinedType::FixedLengthList( self.create_component_val_type(ty, offset)?, diff --git a/tests/cli/component-model/fixed-length-lists.wast b/tests/cli/component-model/fixed-length-lists.wast index 5b3631f743..43c01161f1 100644 --- a/tests/cli/component-model/fixed-length-lists.wast +++ b/tests/cli/component-model/fixed-length-lists.wast @@ -35,7 +35,7 @@ (canon lift (core func $i "ret-list") (memory $i "memory")) ) ) - "Fixed size lists must have more than zero elements (at offset 0x54)" + "Fixed-length lists must have more than zero elements (at offset 0x54)" ) (assert_malformed diff --git a/tests/cli/missing-features/component-model/fixed-length-lists.wast b/tests/cli/missing-features/component-model/fixed-length-lists.wast index 4e20f1a405..5443b9ee00 100644 --- a/tests/cli/missing-features/component-model/fixed-length-lists.wast +++ b/tests/cli/missing-features/component-model/fixed-length-lists.wast @@ -12,7 +12,7 @@ (canon lift (core func $i "ret-list") (memory $i "memory")) ) ) - "Fixed size lists require the component model fixed-length list feature (at offset 0x54)" + "Fixed-length lists require the component model fixed-length lists feature (at offset 0x54)" ) (assert_invalid @@ -26,5 +26,5 @@ (canon lift (core func $i "param-list")) ) ) - "Fixed size lists require the component model fixed-length list feature" + "Fixed-length lists require the component model fixed-length lists feature" ) diff --git a/tests/snapshots/cli/component-model/fixed-length-lists.wast.json b/tests/snapshots/cli/component-model/fixed-length-lists.wast.json index 23eccc21bf..8d9bf2ea0f 100644 --- a/tests/snapshots/cli/component-model/fixed-length-lists.wast.json +++ b/tests/snapshots/cli/component-model/fixed-length-lists.wast.json @@ -18,7 +18,7 @@ "line": 27, "filename": "fixed-length-lists.2.wasm", "module_type": "binary", - "text": "Fixed length-lists must have more than zero elements (at offset 0x54)" + "text": "Fixed-length lists must have more than zero elements (at offset 0x54)" }, { "type": "assert_malformed", diff --git a/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json b/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json index 4405a08031..acc076b89d 100644 --- a/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json +++ b/tests/snapshots/cli/missing-features/component-model/fixed-length-lists.wast.json @@ -6,14 +6,14 @@ "line": 4, "filename": "fixed-length-lists.0.wasm", "module_type": "binary", - "text": "Fixed size lists require the component model fixed-length list feature (at offset 0x54)" + "text": "Fixed-length lists require the component model fixed-length lists feature (at offset 0x54)" }, { "type": "assert_invalid", "line": 19, "filename": "fixed-length-lists.1.wasm", "module_type": "binary", - "text": "Fixed size lists require the component model fixed-length list feature" + "text": "Fixed-length lists require the component model fixed-length lists feature" } ] } \ No newline at end of file From 561972e9b238a82db1bc3605d9ffc606498a0203 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Tue, 20 Jan 2026 14:31:41 +0100 Subject: [PATCH 5/5] the correct error message lead to a reformat --- crates/wasmparser/src/validator/component.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/wasmparser/src/validator/component.rs b/crates/wasmparser/src/validator/component.rs index adb05f5c92..c3ab9f4768 100644 --- a/crates/wasmparser/src/validator/component.rs +++ b/crates/wasmparser/src/validator/component.rs @@ -3937,7 +3937,10 @@ impl ComponentState { ) } if elements < 1 { - bail!(offset, "Fixed-length lists must have more than zero elements") + bail!( + offset, + "Fixed-length lists must have more than zero elements" + ) } Ok(ComponentDefinedType::FixedLengthList( self.create_component_val_type(ty, offset)?,