From cce12bfe165564e43c18da7742e804f52b310be5 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Fri, 17 May 2019 15:52:26 +0100 Subject: [PATCH] Remove unsafe from #[wasm_bindgen_test] output This is not necessary because references are FFI-safe and compatible with corresponding pointers, so we can just use them directly as an input. Fixes #1540. --- crates/test-macro/src/lib.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 83b82040..65ac76cb 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -65,12 +65,9 @@ pub fn wasm_bindgen_test( tokens.extend( (quote! { #[no_mangle] - pub extern "C" fn #name(cx: *const ::wasm_bindgen_test::__rt::Context) { - unsafe { - let cx = &*cx; - let test_name = concat!(module_path!(), "::", stringify!(#ident)); - #test_body - } + pub extern "C" fn #name(cx: &::wasm_bindgen_test::__rt::Context) { + let test_name = concat!(module_path!(), "::", stringify!(#ident)); + #test_body } }) .into_iter(),