Skip to content

Commit 22012c5

Browse files
committed
Fix Rust edition 2024 compatibility
This adds `unsafe` to all `extern "C" { ... }` generated blocks to account for edition 2024 requirements.
1 parent 1d4965c commit 22012c5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/backend/src/codegen.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl ToTokens for ast::Struct {
276276

277277
#[link(wasm_import_module = "__wbindgen_placeholder__")]
278278
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
279-
extern "C" {
279+
unsafe extern "C" {
280280
fn #new_fn(ptr: u32) -> u32;
281281
}
282282

@@ -382,7 +382,7 @@ impl ToTokens for ast::Struct {
382382

383383
#[link(wasm_import_module = "__wbindgen_placeholder__")]
384384
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
385-
extern "C" {
385+
unsafe extern "C" {
386386
fn #unwrap_fn(ptr: u32) -> u32;
387387
}
388388

@@ -1067,7 +1067,7 @@ impl ToTokens for ast::ImportType {
10671067
fn instanceof(val: &JsValue) -> bool {
10681068
#[link(wasm_import_module = "__wbindgen_placeholder__")]
10691069
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
1070-
extern "C" {
1070+
unsafe extern "C" {
10711071
fn #instanceof_shim(val: u32) -> u32;
10721072
}
10731073
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
@@ -1762,7 +1762,7 @@ fn static_init(wasm_bindgen: &syn::Path, ty: &syn::Type, shim_name: &Ident) -> T
17621762
quote! {
17631763
#[link(wasm_import_module = "__wbindgen_placeholder__")]
17641764
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
1765-
extern "C" {
1765+
unsafe extern "C" {
17661766
fn #shim_name() -> #abi_ret;
17671767
}
17681768

@@ -1843,7 +1843,7 @@ fn extern_fn(
18431843
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
18441844
#(#attrs)*
18451845
#[link(wasm_import_module = "__wbindgen_placeholder__")]
1846-
extern "C" {
1846+
unsafe extern "C" {
18471847
fn #import_name(#(#abi_arguments),*) -> #abi_ret;
18481848
}
18491849

0 commit comments

Comments
 (0)