@@ -15,6 +15,7 @@ use std::env;
1515use std:: fs;
1616use std:: path:: { Path , PathBuf } ;
1717use std:: process:: Command ;
18+ use walrus:: ModuleConfig ;
1819
1920fn main ( ) -> Result < ( ) > {
2021 let filter = env:: args ( ) . nth ( 1 ) ;
@@ -93,7 +94,11 @@ fn runtest(test: &Path) -> Result<()> {
9394 . join ( "reference_test.wasm" ) ;
9495
9596 let mut bindgen = Command :: cargo_bin ( "wasm-bindgen" ) ?;
96- bindgen. arg ( "--out-dir" ) . arg ( td. path ( ) ) . arg ( & wasm) ;
97+ bindgen
98+ . arg ( "--out-dir" )
99+ . arg ( td. path ( ) )
100+ . arg ( & wasm)
101+ . arg ( "--remove-producers-section" ) ;
97102 if contents. contains ( "// enable-externref" ) {
98103 bindgen. env ( "WASM_BINDGEN_EXTERNREF" , "1" ) ;
99104 }
@@ -125,7 +130,9 @@ fn sanitize_wasm(wasm: &Path) -> Result<String> {
125130 // Clean up the wasm module by removing all function
126131 // implementations/instructions, data sections, etc. This'll help us largely
127132 // only deal with exports/imports which is all we're really interested in.
128- let mut module = walrus:: Module :: from_file ( wasm) ?;
133+ let mut module = ModuleConfig :: new ( )
134+ . generate_producers_section ( false )
135+ . parse_file ( wasm) ?;
129136 for func in module. funcs . iter_mut ( ) {
130137 let local = match & mut func. kind {
131138 walrus:: FunctionKind :: Local ( l) => l,
0 commit comments