File tree Expand file tree Collapse file tree
crates/wasmparser/src/validator
cli/component-model/async
snapshots/cli/component-model/async Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3965,10 +3965,25 @@ impl ComponentState {
39653965 "`stream` requires the component model async feature"
39663966 )
39673967 }
3968- Ok ( ComponentDefinedType :: Stream (
3969- ty. map ( |ty| self . create_component_val_type ( ty, offset) )
3970- . transpose ( ) ?,
3971- ) )
3968+ let ty = ty
3969+ . map ( |ty| self . create_component_val_type ( ty, offset) )
3970+ . transpose ( ) ?;
3971+ let prim = match ty {
3972+ Some ( ComponentValType :: Primitive ( p) ) => Some ( p) ,
3973+ Some ( ComponentValType :: Type ( id) ) => match types[ id] {
3974+ ComponentDefinedType :: Primitive ( p) => Some ( p) ,
3975+ _ => None ,
3976+ } ,
3977+ None => None ,
3978+ } ;
3979+ if prim == Some ( crate :: PrimitiveValType :: Char ) {
3980+ bail ! (
3981+ offset,
3982+ "`stream<char>` is not valid at this time, use `stream<u8>` \
3983+ with a defined by encoding instead for now"
3984+ )
3985+ }
3986+ Ok ( ComponentDefinedType :: Stream ( ty) )
39723987 }
39733988 }
39743989 }
Original file line number Diff line number Diff line change 211211 )
212212 " type mismatch for export `stream.drop-writable` of module instantiation argument ``"
213213)
214+
215+ ;; stream<char> isn't valid yet
216+ (assert_invalid
217+ (component (type (stream char)))
218+ " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
219+ )
220+ (assert_invalid
221+ (component (type $t char) (type (stream $t )))
222+ " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
223+ )
224+ (assert_invalid
225+ (component (type (func (param " x" (stream char)))))
226+ " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
227+ )
Original file line number Diff line number Diff line change 111111 "filename" : " streams.16.wasm" ,
112112 "module_type" : " binary" ,
113113 "text" : " type mismatch for export `stream.drop-writable` of module instantiation argument ``"
114+ },
115+ {
116+ "type" : " assert_invalid" ,
117+ "line" : 217 ,
118+ "filename" : " streams.17.wasm" ,
119+ "module_type" : " binary" ,
120+ "text" : " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
121+ },
122+ {
123+ "type" : " assert_invalid" ,
124+ "line" : 221 ,
125+ "filename" : " streams.18.wasm" ,
126+ "module_type" : " binary" ,
127+ "text" : " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
128+ },
129+ {
130+ "type" : " assert_invalid" ,
131+ "line" : 225 ,
132+ "filename" : " streams.19.wasm" ,
133+ "module_type" : " binary" ,
134+ "text" : " `stream<char>` is not valid at this time, use `stream<u8>` with a defined by encoding instead for now"
114135 }
115136 ]
116137}
You can’t perform that action at this time.
0 commit comments