/** The data structure associated with each crypto device. */
struct rte_cryptodev {
dequeue_pkt_burst_t dequeue_burst;
/**< Pointer to PMD receive function. */
enqueue_pkt_burst_t enqueue_burst;
/**< Pointer to PMD transmit function. */
const struct rte_cryptodev_driver *driver;
/**< Driver for this device */
struct rte_cryptodev_data *data;
/**< Pointer to device data */
struct rte_cryptodev_ops *dev_ops;
/**< Functions exported by PMD */
uint64_t feature_flags;
/**< Supported features */
struct rte_device *device;
/**< Backing device */
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
__extension__
uint8_t attached : 1;
/**< Flag indicating the device is attached */
} __rte_cache_aligned;
__rte_cache_aligned is 64byte alignment.
bindgen::builder()
.header(header_path.to_str().unwrap())
.no_unstable_rust()
.clang_arg(format!("-I{}", dpdk_include_path.to_str().unwrap()))
.clang_arg(format!("-I{}", c_include_path.to_str().unwrap()))
.clang_arg("-imacros")
.clang_arg(dpdk_config_path.to_str().unwrap())
.clang_arg("-march=native")
.generate()
.unwrap()
.write_to_file(target_path)
.ok();
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_cryptodev {
pub dequeue_burst: dequeue_pkt_burst_t,
pub enqueue_burst: enqueue_pkt_burst_t,
pub driver: *const rte_cryptodev_driver,
pub data: *mut rte_cryptodev_data,
pub dev_ops: *mut rte_cryptodev_ops,
pub feature_flags: u64,
pub device: *mut rte_device,
pub dev_type: rte_cryptodev_type,
pub link_intr_cbs: rte_cryptodev_cb_list,
pub _bitfield_1: u8,
pub __bindgen_padding_0: [u8; 47usize],
}
Compiling bindgen v0.23.1 (https://github.com/servo/rust-bindgen.git?rev=f775f1f#f775f1f2)
Compiling rust-dpdk v0.0.1-dev (file:///home/leeopop/git/rust-dpdk)
error[E0277]: the trait bound `[u8; 47]: std::fmt::Debug` is not satisfied
--> /home/leeopop/git/rust-dpdk/src/dpdk.rs:18040:5
|
18040 | pub __bindgen_padding_0: [u8; 47usize],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::fmt::Debug` is not implemented for `[u8; 47]`
|
= note: `[u8; 47]` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u8; 47]`
= note: required for the cast to the object type `std::fmt::Debug`
This structure contains [u8; 47] which does not implement Debug trait.
By the way, does [u8; 47] implements Copy trait?
struct rte_cryptodev should not derive Debug and Copy trait also.
Thanks for the bug report!
@leeopop both bitfields and deriving debug have undergone significant changes since you reported this; are you still able to reproduce on master?
If so, the best way to help resolve this bug would be to get us a standalone test case we can reproduce ourselves with: https://github.com/servo/rust-bindgen/blob/master/CONTRIBUTING.md#using-creduce-to-minimize-test-cases
Thanks!
Hi !
I used creduce and get this result:
struct {
void *schedule;
unsigned enqueue;
short *enqueue_burst;
unsigned enqueue_new_burst;
short *enqueue_forward_burst;
short *dequeue;
short dequeue_burst;
int *data;
int *dev_ops;
char attached
} __attribute__((__aligned__(64)));
Once I run bindgen, I get
error[E0277]: the trait bound `[u8; 55]: std::fmt::Debug` is not satisfied
--> src/lib.rs:16:5
|
16 | pub __bindgen_padding_0: [u8; 55usize],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[u8; 55]` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
|
= help: the trait `std::fmt::Debug` is not implemented for `[u8; 55]`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u8; 55]`
= note: required for the cast to the object type `std::fmt::Debug
edit:
bindgen used: 0.28.0 (built on 167e84cea2f2a12c428b2e3ba71738f993f0a867)
rustc 1.21.0-nightly (c417ee9ae 2017-07-25)
Thanks! This is very helpful! Will dig into it.
Most helpful comment
Hi !
I used creduce and get this result:
Once I run bindgen, I get
edit:
bindgen used: 0.28.0 (built on 167e84cea2f2a12c428b2e3ba71738f993f0a867)
rustc 1.21.0-nightly (c417ee9ae 2017-07-25)