File tree 1 file changed +13
-8
lines changed
crates/cli-support/src/js
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1211,21 +1211,20 @@ impl<'a> Context<'a> {
1211
1211
debug
1212
1212
) ;
1213
1213
1214
+ // Looks like `encodeInto` doesn't currently work when the memory passed
1215
+ // in is backed by a `SharedArrayBuffer`, so force usage of `encode` if
1216
+ // a `SharedArrayBuffer` is in use.
1217
+ let shared = self . module . memories . get ( self . memory ) . shared ;
1218
+
1214
1219
match self . config . encode_into {
1215
- EncodeInto :: Never => {
1216
- self . global ( & format ! (
1217
- "function passStringToWasm(arg) {{ {} }}" ,
1218
- use_encode,
1219
- ) ) ;
1220
- }
1221
- EncodeInto :: Always => {
1220
+ EncodeInto :: Always if !shared => {
1222
1221
self . require_internal_export ( "__wbindgen_realloc" ) ?;
1223
1222
self . global ( & format ! (
1224
1223
"function passStringToWasm(arg) {{ {} }}" ,
1225
1224
use_encode_into,
1226
1225
) ) ;
1227
1226
}
1228
- EncodeInto :: Test => {
1227
+ EncodeInto :: Test if !shared => {
1229
1228
self . require_internal_export ( "__wbindgen_realloc" ) ?;
1230
1229
self . global ( & format ! (
1231
1230
"
@@ -1240,6 +1239,12 @@ impl<'a> Context<'a> {
1240
1239
use_encode,
1241
1240
) ) ;
1242
1241
}
1242
+ _ => {
1243
+ self . global ( & format ! (
1244
+ "function passStringToWasm(arg) {{ {} }}" ,
1245
+ use_encode,
1246
+ ) ) ;
1247
+ }
1243
1248
}
1244
1249
Ok ( ( ) )
1245
1250
}
You can’t perform that action at this time.
0 commit comments