Skip to content

Copy not derived when using whitelist_recursively(false) #1454

@jethrogb

Description

@jethrogb

Input C/C++ Header

#include <stdint.h>
#include <stdlib.h>
typedef uint64_t mbedtls_mpi_uint;
typedef struct
{
    int s;              /*!<  integer sign      */
    size_t n;           /*!<  total # of limbs  */
    mbedtls_mpi_uint *p;          /*!<  pointer to limbs  */
}
mbedtls_mpi;

Bindgen Invocation

    let bindings = bindgen::builder()
        .header_contents("test.h", ...)
        .trust_clang_mangling(false)
        .derive_copy(true)
        .whitelist_type("mbedtls_.*")
        .whitelist_recursively(whitelist_recursively)
        .layout_tests(false)
        .generate()
        .expect("bindgen error");

Actual Results

// whitelist_recursively = false
/* automatically generated by rust-bindgen */

pub type mbedtls_mpi_uint = u64;
#[repr(C)]
pub struct mbedtls_mpi {
    ///<  integer sign
    pub s: ::std::os::raw::c_int,
    ///<  total # of limbs
    pub n: usize,
    ///<  pointer to limbs
    pub p: *mut mbedtls_mpi_uint,
}

Expected Results

// whitelist_recursively = true
/* automatically generated by rust-bindgen */

pub type mbedtls_mpi_uint = u64;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mbedtls_mpi {
    ///<  integer sign
    pub s: ::std::os::raw::c_int,
    ///<  total # of limbs
    pub n: usize,
    ///<  pointer to limbs
    pub p: *mut mbedtls_mpi_uint,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions