@@ -940,12 +940,12 @@ pub mod vtable{ordinal} {{
940940 self . src,
941941 "\
942942 #[doc(hidden)]
943- #[allow(non_snake_case)]
943+ #[allow(non_snake_case, unused_unsafe )]
944944 pub unsafe fn _export_{name_snake}_cabi<T: {trait_name}>\
945945 ",
946946 ) ;
947947 let params = self . print_export_sig ( func, async_) ;
948- self . push_str ( " {" ) ;
948+ self . push_str ( " { unsafe { " ) ;
949949
950950 if !self . r#gen . opts . disable_run_ctors_once_workaround {
951951 let run_ctors_once = self . path_to_run_ctors_once ( ) ;
@@ -1004,7 +1004,7 @@ pub mod vtable{ordinal} {{
10041004 self . src . push_str ( "\n " ) ;
10051005 }
10061006 self . src . push_str ( & String :: from ( src) ) ;
1007- self . src . push_str ( "}\n " ) ;
1007+ self . src . push_str ( "} } \n " ) ;
10081008
10091009 if async_ {
10101010 let async_support = self . r#gen . async_support_path ( ) ;
@@ -1030,7 +1030,7 @@ pub mod vtable{ordinal} {{
10301030 "
10311031 ) ;
10321032 let params = self . print_post_return_sig ( func) ;
1033- self . src . push_str ( "{\n " ) ;
1033+ self . src . push_str ( "{ unsafe { \n " ) ;
10341034
10351035 let mut f = FunctionBindgen :: new ( self , params, async_, self . wasm_import_module , false ) ;
10361036 abi:: post_return ( f. r#gen . resolve , func, & mut f, async_) ;
@@ -1043,7 +1043,7 @@ pub mod vtable{ordinal} {{
10431043 assert ! ( !needs_cleanup_list) ;
10441044 assert ! ( handle_decls. is_empty( ) ) ;
10451045 self . src . push_str ( & String :: from ( src) ) ;
1046- self . src . push_str ( "}\n " ) ;
1046+ self . src . push_str ( "} } \n " ) ;
10471047 }
10481048 }
10491049
@@ -1228,6 +1228,7 @@ pub mod vtable{ordinal} {{
12281228 sig. self_arg = Some ( "&self" . into ( ) ) ;
12291229 sig. self_is_first_param = true ;
12301230 }
1231+ self . src . push_str ( "#[allow(unused_variables)]\n " ) ;
12311232 self . print_signature ( func, true , & sig) ;
12321233 self . src . push_str ( "{ unreachable!() }\n " ) ;
12331234 }
@@ -1307,6 +1308,10 @@ pub mod vtable{ordinal} {{
13071308 // TODO: re-add this when docs are back
13081309 // self.rustdoc_params(&func.results, "Return");
13091310
1311+ // TODO: should probably return `impl Future` in traits instead of
1312+ // having an `async fn` but that'll require more plumbing here.
1313+ self . push_str ( "#[allow(async_fn_in_trait)]\n " ) ;
1314+
13101315 if !sig. private {
13111316 self . push_str ( "pub " ) ;
13121317 }
@@ -2717,7 +2722,7 @@ impl<'a> {camel}Borrow<'a>{{
27172722 #[doc(hidden)]
27182723 pub unsafe fn _lift(val: {repr}) -> {name} {{
27192724 if !cfg!(debug_assertions) {{
2720- return ::core::mem::transmute(val);
2725+ return unsafe {{ ::core::mem::transmute(val) }} ;
27212726 }}
27222727
27232728 match val {{
0 commit comments