Skip to content

Remove experimental flag for Symbol.dispose #4514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
@@ -1193,16 +1193,14 @@ __wbg_set_wasm(wasm);"
wasm_bindgen_shared::free_function(name),
));
ts_dst.push_str(" free(): void;\n");
if self.config.symbol_dispose {
dst.push_str(
"
[Symbol.dispose]() {{
this.free();
}}
",
);
ts_dst.push_str(" [Symbol.dispose](): void;\n");
}
dst.push_str(
"
[Symbol.dispose]() {{
this.free();
}}
",
);
ts_dst.push_str(" [Symbol.dispose](): void;\n");
dst.push_str(&class.contents);
ts_dst.push_str(&class.typescript);

@@ -2724,7 +2722,7 @@ __wbg_set_wasm(wasm);"
pub fn generate(&mut self) -> Result<(), Error> {
self.prestore_global_import_identifiers()?;
// conditionally override Symbol.dispose
if self.config.symbol_dispose && !self.aux.structs.is_empty() {
if !self.aux.structs.is_empty() {
self.expose_symbol_dispose()?;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely sure if I should remove expose_symbol_dispose() as well.

}

3 changes: 0 additions & 3 deletions crates/cli-support/src/lib.rs
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ pub struct Bindgen {
multi_value: bool,
encode_into: EncodeInto,
split_linked_modules: bool,
symbol_dispose: bool,
}

pub struct Output {
@@ -86,7 +85,6 @@ impl Bindgen {
let externref =
env::var("WASM_BINDGEN_ANYREF").is_ok() || env::var("WASM_BINDGEN_EXTERNREF").is_ok();
let multi_value = env::var("WASM_BINDGEN_MULTI_VALUE").is_ok();
let symbol_dispose = env::var("WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE").is_ok();
Bindgen {
input: Input::None,
out_name: None,
@@ -107,7 +105,6 @@ impl Bindgen {
encode_into: EncodeInto::Test,
omit_default_module_path: true,
split_linked_modules: false,
symbol_dispose,
}
}

2 changes: 1 addition & 1 deletion examples/explicit-resource-management/build.sh
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@
set -eux

cargo build --target wasm32-unknown-unknown --release
WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE=1 cargo run --package wasm-bindgen-cli --bin wasm-bindgen -- \
cargo run --package wasm-bindgen-cli --bin wasm-bindgen -- \
--out-dir pkg --target deno ${CARGO_TARGET_DIR:-../../target}/wasm32-unknown-unknown/release/explicit_resource_management.wasm

Unchanged files with check annotations Beta

}
}
fn internal_error(msg: &str) -> ! {

Check warning on line 101 in src/externref.rs

GitHub Actions / Build and test the deno example

unused variable: `msg`
cfg_if::cfg_if! {
if #[cfg(debug_assertions)] {
super::throw_str(msg)
inform(invoke::<$($var,)* R> as usize as u32);
unsafe extern fn destroy<$($var: FromWasmAbi,)* R: ReturnWasmAbi>(

Check warning on line 602 in src/closure.rs

GitHub Actions / Build and test the deno example

extern declarations without an explicit ABI are deprecated
a: usize,
b: usize,
) {
inform(invoke::<$($var,)* R> as usize as u32);
unsafe extern fn destroy<$($var: FromWasmAbi,)* R: ReturnWasmAbi>(

Check warning on line 663 in src/closure.rs

GitHub Actions / Build and test the deno example

extern declarations without an explicit ABI are deprecated
a: usize,
b: usize,
) {