You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* * IO completion data structure (Completion Queue Entry)*/structio_uring_cqe {
__u64 user_data; /* sqe->data submission passed back */
__s32 res; /* result code for this event */
__u32 flags;
/* * If the ring is initialized with IORING_SETUP_CQE32, then this field * contains 16-bytes of padding, doubling the size of the CQE.*/
__u64 big_cqe[];
};
Bindgen Invocation
bindgen::Builder::default().header("wrapper.h").allowlist_type("(io_uring_(sqe|cqe)|io_(sq|cq)ring_offsets|io_uring_params)").blocklist_type("__(u8|u16|s32|u32|u64|kernel_rwf_t).*").derive_debug(true).derive_copy(true).formatter(bindgen::Formatter::Rustfmt).impl_debug(true).layout_tests(false).parse_callbacks(Box::new(CallBack)).generate().expect("Unable to generate bindings");
::std::marker::Copy is implemented for __IncompleteArrayField<__u64>
It seems that a few of the other examples I can find related to this field imply that it can be Copy, but perhaps I am missing some constraints about why it's omitted here (I am new to bindgen and Rust). Should I be doing this manually because PhantomData<T> cannot be sure that T is actually Copy? For instance the below works but I'm unsure it's "sound":
I should also mention I'm using blocklisted_item_implements_trait in ParseCallback to get the behaviour I need too (so that the io_uring types can implement the necessary traits).
Thanks!
The text was updated successfully, but these errors were encountered:
In general trailing incomplete array members are used to implement dynamically sized data. That can't implement Copy in rust, because it can't be allocated on the stack (easily at least), and bindgen doesn't know the length of the array per se.
Closing because I don't think generating Copy there is reasonable, but lmk if I'm missing something.
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
::std::marker::Copy
is implemented for__IncompleteArrayField<__u64>
It seems that a few of the other examples I can find related to this field imply that it can be
Copy
, but perhaps I am missing some constraints about why it's omitted here (I am new to bindgen and Rust). Should I be doing this manually becausePhantomData<T>
cannot be sure thatT
is actuallyCopy
? For instance the below works but I'm unsure it's "sound":I should also mention I'm using
blocklisted_item_implements_trait
inParseCallback
to get the behaviour I need too (so that the io_uring types can implement the necessary traits).Thanks!
The text was updated successfully, but these errors were encountered: