-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
fn () -> Result<T, JsValue>
leaking stack space (#2710)
* add Descriptor RESULT and Instruction::UnwrapResult * ResultAbi / ResultAbiUnion basic wasmresult support one WasmResult ctor per WasmAbi Remove WasmResult class * Reverse the fields on ResultAbi, remove is_ok as err can be 0 impl OptionIntoWasmAbi for JsValue * implement ResultAbi * Add tests for `-> Result<T, JsError>` * split result.rs tests in two remove console_log * initial implementation of `-> Result<T, JsError>` describe Result<_, JsError> implement Intrinsics::ErrorNew Revert impl From<()> for JsValue (src/lib.rs) impl WasmDescribe etc for JsError remove unused JsError * docs on JsError, move to lib.rs * Add test for returning Result<(), _> * Add failing test for returning `Result<Option<f64>, _>` This fails because the generated LoadRetptr instructions do not have any conception of how big the previous args are. It only fails when any part of T is an f64. * Make LoadRetptr offsets factor in alignment and previously read values * Add a doc comment to UnwrapResult * Slight correction to a comment * Better error message * un-implement OptionIntoWasmAbi for JsValue, use discriminant instead * Add some documentation from the PR discussion to ResultAbi * un-implement OptionIntoWasmAbi for &'a JsValue too * bless some UI tests, not sure why * bless the CLI's output tests * fix indentation of if (is_ok === 0) { throw ... } code * add tests for async fn() -> Result<_, JsError> and custom error types * cargo fmt * fix bug where takeObject was missing * support externref in UnwrapResult * add a WASM_BINDGEN_EXTERNREF=1 test to ci * getFromExternrefTable -> takeFromExternrefTable Now we do not leak externrefs, as the take function calls drop on them. * rewrite outgoing_result There was a crash where _outgoing inserted more than one instruction, e.g. for string. In that case, the deferred free() call was using the wrong popped values, and tried to free nonsense formed by the is_ok/err pair. Now it does a similar idea, but without assuming exactly one instruction will be pushed by self._outgoing(). * rename is_ok -> is_err, which makes generated glue easier to read * update ui tests * add a crashing (if you uncomment the throw) test of Result<String, _> * add result-string reference test * Fix the crashy Result<String, _> by setting ptr/len to 0 on error
- Loading branch information
1 parent
9fdf8f0
commit ac87c82
Showing
33 changed files
with
1,236 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.