-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Drop::drop() not called on a panic! when compiling to WASM #58874
Copy link
Copy link
Closed
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Running 1.34.0-nightly 2019-02-22, but it also happens on stable. Repr here: https://github.com/coolreader18/wasm-no-drop/.
I noticed this with an
Rc<RefCell<_>>, when I borrowed it mutably and something panicked while the borrow was held, trying to borrow that same RefCell again panicked with "already borrowed: BorrowMutError". This might be a wasm-bindgen error, cause it seems weird that this bug would go unnoticed for the whole time that wasm32-unknown-unknown has been stable (unless I missed the issue).Demo currently in production: https://rustpython.github.io/demo, add a line that contains
global x, click Run, remove that line, and try to run it again. There's a version of that that shows the panic error message, and the first time it's "not implemented: global` and the second time it's "borrow error".