Skip to content

Commit

Permalink
Fixed compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lch361 committed Dec 8, 2023
1 parent f90c678 commit 66f5019
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
default-features = false
libc = "0.2"
libc = { version = "0.2", default-features = false }

[dev-dependencies]
expect-test = "1.4"
Expand Down
8 changes: 4 additions & 4 deletions src/cee_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ where
}

unsafe {
let closure_env_ptr = std::ptr::addr_of_mut!(callback);
let closure_env_ptr = core::ptr::addr_of_mut!(callback);

// The callback is now effectively owned by `closure_env_ptr` (i.e., the
// `closure_env_ptr.read()` call in `call_from_c_to_rust` will take a
// direct bitwise copy of its state, and pass that ownership into the
// FnOnce::call_once invocation.)
//
// Therefore, we need to forget about our own ownership of the callback now.
std::mem::forget(callback);
core::mem::forget(callback);

call_closure_with_setjmp(closure_env_ptr as *mut c_void, call_from_c_to_rust::<F>)
}
Expand Down Expand Up @@ -66,15 +66,15 @@ where
let savemask: c_int = if savemask { 1 } else { 0 };

unsafe {
let closure_env_ptr = std::ptr::addr_of_mut!(callback);
let closure_env_ptr = core::ptr::addr_of_mut!(callback);

// The callback is now effectively owned by `closure_env_ptr` (i.e., the
// `closure_env_ptr.read()` call in `call_from_c_to_rust` will take a
// direct bitwise copy of its state, and pass that ownership into the
// FnOnce::call_once invocation.)
//
// Therefore, we need to forget about our own ownership of the callback now.
std::mem::forget(callback);
core::mem::forget(callback);

call_closure_with_sigsetjmp(savemask, closure_env_ptr as *mut c_void, call_from_c_to_rust::<F>)
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
//! })
//! });
//! ```
#![no_std]
#![cfg_attr(not(test), no_std)]

use libc::c_int;

Expand Down

0 comments on commit 66f5019

Please sign in to comment.