Skip to content

Commit

Permalink
use immutable runtime handle
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Mar 22, 2024
1 parent dbbbf61 commit bf3501a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ pub fn ocaml_func(attribute: TokenStream, item: TokenStream) -> TokenStream {
let inner = if returns {
quote! {
#[inline(always)]
#constness #unsafety fn inner(#gc_name: &mut ocaml::Runtime, #(#rust_args),*) -> #rust_return_type {
#constness #unsafety fn inner(#gc_name: &ocaml::Runtime, #(#rust_args),*) -> #rust_return_type {
#use_gc
#body
}
}
} else {
quote! {
#[inline(always)]
#constness #unsafety fn inner(#gc_name: &mut ocaml::Runtime, #(#rust_args),*) {
#constness #unsafety fn inner(#gc_name: &ocaml::Runtime, #(#rust_args),*) {
#use_gc
#body
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ impl Runtime {

#[doc(hidden)]
#[inline(always)]
pub unsafe fn recover_handle() -> &'static mut Self {
static mut RUNTIME: Runtime = Runtime { _private: () };
&mut RUNTIME
pub unsafe fn recover_handle() -> &'static Self {
static RUNTIME: Runtime = Runtime { _private: () };
&RUNTIME
}
}

0 comments on commit bf3501a

Please sign in to comment.