diff --git a/bindings/wasm/build/lints.js b/bindings/wasm/build/lints.js index 3d6a64c641..dc876de590 100644 --- a/bindings/wasm/build/lints.js +++ b/bindings/wasm/build/lints.js @@ -1,35 +1,3 @@ -/** - * Rejects any `.ptr = 0;` occurrence, excluding `this.ptr = 0;` in `free()` implementations. - * - * Prevents generated code that nulls out Wasm pointers without de-registering the finalizer, since they cause - * runtime errors during automatic garbage collection from WasmRefCell thinking the instance is still borrowed. - * - * Functions which take owned parameters cause this situation; the solution is to borrow and clone the parameter - * instead. - */ -function lintPtrNullWithoutFree(content) { - // Find line numbers of offending code. - const lines = content.split(/\r?\n/); - const matches = lines.flatMap(function(line, number) { - if (/(? 0) { - throw (`ERROR: generated Javascript should not include 'obj.ptr = 0;'. -When weak references are enabled with '--weak-refs', WasmRefCell in wasm-bindgen causes -runtime errors from automatic garbage collection trying to free objects taken as owned parameters. - -Matches: -${matches} - -SUGGESTION: change any exported functions which take an owned parameter (excluding flat enums) to use a borrow instead. -See: https://github.com/rustwasm/wasm-bindgen/pull/2677`); - } -} - /** Rejects any `imports['env']` occurrences, which cause failures at runtime. * * This is typically due to Wasm compatibility features not being enabled on crate dependencies. **/ @@ -66,7 +34,6 @@ See: /** Runs all custom lints on the generated code. Exits the process immediately with code 1 if any fail. **/ function lintAll(content) { try { - lintPtrNullWithoutFree(content); lintImportEnv(content); } catch (err) { console.error("Custom lint failed!");