Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(RFC) rust: mark extern "C" ffi functions as unsafe - v4 #6276

Closed
wants to merge 3 commits into from

Commits on Jul 20, 2021

  1. rust: functions that reference raw pointers are unsafe

    Based on the Rust clippy lint that recommends that any public
    function that dereferences a raw pointer, mark all FFI functions
    that reference raw pointers with build_slice and cast_pointer
    as unsafe.
    
    This commits starts by removing the unsafe wrapper inside
    the build_slice and cast_pointer macros then marks all
    functions that use these macros as unsafe.
    jasonish committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    baa85d4 View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2021

  1. rust: remove transmute for state allocation and free

    Instead use Box::into_raw and from_raw which is more idiomatic
    for this purpose.  For now do this for Rust objects that are
    opaque to C, but have their life time (allocation and free)
    managed from C.
    jasonish committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    482ae3e View commit details
    Browse the repository at this point in the history
  2. rust: std::os::raw::c_void to std::ffi::c_void

    As of Rust 1.30 the primary location of c_void is inside
    std::ffi and not std::os::raw which is for platform specific
    types.
    jasonish committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    a8176f0 View commit details
    Browse the repository at this point in the history