@@ -940,12 +940,12 @@ pub mod vtable{ordinal} {{
940
940
self . src,
941
941
"\
942
942
#[doc(hidden)]
943
- #[allow(non_snake_case)]
943
+ #[allow(non_snake_case, unused_unsafe )]
944
944
pub unsafe fn _export_{name_snake}_cabi<T: {trait_name}>\
945
945
",
946
946
) ;
947
947
let params = self . print_export_sig ( func, async_) ;
948
- self . push_str ( " {" ) ;
948
+ self . push_str ( " { unsafe { " ) ;
949
949
950
950
if !self . r#gen . opts . disable_run_ctors_once_workaround {
951
951
let run_ctors_once = self . path_to_run_ctors_once ( ) ;
@@ -1004,7 +1004,7 @@ pub mod vtable{ordinal} {{
1004
1004
self . src . push_str ( "\n " ) ;
1005
1005
}
1006
1006
self . src . push_str ( & String :: from ( src) ) ;
1007
- self . src . push_str ( "}\n " ) ;
1007
+ self . src . push_str ( "} } \n " ) ;
1008
1008
1009
1009
if async_ {
1010
1010
let async_support = self . r#gen . async_support_path ( ) ;
@@ -1030,7 +1030,7 @@ pub mod vtable{ordinal} {{
1030
1030
"
1031
1031
) ;
1032
1032
let params = self . print_post_return_sig ( func) ;
1033
- self . src . push_str ( "{\n " ) ;
1033
+ self . src . push_str ( "{ unsafe { \n " ) ;
1034
1034
1035
1035
let mut f = FunctionBindgen :: new ( self , params, async_, self . wasm_import_module , false ) ;
1036
1036
abi:: post_return ( f. r#gen . resolve , func, & mut f, async_) ;
@@ -1043,7 +1043,7 @@ pub mod vtable{ordinal} {{
1043
1043
assert ! ( !needs_cleanup_list) ;
1044
1044
assert ! ( handle_decls. is_empty( ) ) ;
1045
1045
self . src . push_str ( & String :: from ( src) ) ;
1046
- self . src . push_str ( "}\n " ) ;
1046
+ self . src . push_str ( "} } \n " ) ;
1047
1047
}
1048
1048
}
1049
1049
@@ -1228,6 +1228,7 @@ pub mod vtable{ordinal} {{
1228
1228
sig. self_arg = Some ( "&self" . into ( ) ) ;
1229
1229
sig. self_is_first_param = true ;
1230
1230
}
1231
+ self . src . push_str ( "#[allow(unused_variables)]\n " ) ;
1231
1232
self . print_signature ( func, true , & sig) ;
1232
1233
self . src . push_str ( "{ unreachable!() }\n " ) ;
1233
1234
}
@@ -1307,6 +1308,10 @@ pub mod vtable{ordinal} {{
1307
1308
// TODO: re-add this when docs are back
1308
1309
// self.rustdoc_params(&func.results, "Return");
1309
1310
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
+
1310
1315
if !sig. private {
1311
1316
self . push_str ( "pub " ) ;
1312
1317
}
@@ -2717,7 +2722,7 @@ impl<'a> {camel}Borrow<'a>{{
2717
2722
#[doc(hidden)]
2718
2723
pub unsafe fn _lift(val: {repr}) -> {name} {{
2719
2724
if !cfg!(debug_assertions) {{
2720
- return ::core::mem::transmute(val);
2725
+ return unsafe {{ ::core::mem::transmute(val) }} ;
2721
2726
}}
2722
2727
2723
2728
match val {{
0 commit comments