Skip to content

Commit

Permalink
Support unsafe fns in #[polkavm_export]
Browse files Browse the repository at this point in the history
  • Loading branch information
koute committed Jan 10, 2024
1 parent 9b76ec5 commit 2001240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/polkavm-derive-impl/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pub fn polkavm_export(input: syn::ItemFn) -> Result<proc_macro2::TokenStream, sy

unsupported_if_some!(sig.constness);
unsupported_if_some!(sig.asyncness);
unsupported_if_some!(sig.unsafety);
unsupported_if_some!(sig.generics.lt_token);
unsupported_if_some!(sig.generics.params.first());
unsupported_if_some!(sig.generics.gt_token);
Expand All @@ -75,6 +74,7 @@ pub fn polkavm_export(input: syn::ItemFn) -> Result<proc_macro2::TokenStream, sy
let ident = &sig.ident;
let args = &sig.inputs;
let return_ty = &sig.output;
let unsafety = &sig.unsafety;
let vis = &input.vis;
let body = &input.block;

Expand All @@ -90,7 +90,7 @@ pub fn polkavm_export(input: syn::ItemFn) -> Result<proc_macro2::TokenStream, sy
#(#cfg_attributes)*
#(#fn_attributes)*
#[cfg_attr(any(target_arch = "riscv32", target_arch = "riscv64"), link_section = ".text.polkavm_export")]
#vis extern "C" fn #ident(#args) #return_ty #body
#vis #unsafety extern "C" fn #ident(#args) #return_ty #body

// A dirty hack to remove the need for a linker script.
#(#cfg_attributes)*
Expand Down

0 comments on commit 2001240

Please sign in to comment.