-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(ffi): add repr(transparent) to hyper_context #3191
fix(ffi): add repr(transparent) to hyper_context #3191
Conversation
The default representation does not guarantee the absence of initial padding, which is necessary for the transmute to be sound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This reverts commit 187b8f2.
Sorry, I had to revert this in #3193, since I accidentally merged it before checking CI was happy. At the least, it's changed how the |
Whoops! I hadn't noticed that this project uses cbindgen. Indeed, it doesn't seem to do what we want, referring to a nonexistent @@ -158,11 +158,6 @@
typedef struct hyper_clientconn_options hyper_clientconn_options;
/*
- An async context for a task that contains the related waker.
- */
-typedef struct hyper_context hyper_context;
-
-/*
A more detailed error object returned by some hyper functions.
*/
typedef struct hyper_error hyper_error;
@@ -206,15 +201,20 @@
typedef int (*hyper_body_foreach_callback)(void*, const struct hyper_buf*);
-typedef int (*hyper_body_data_callback)(void*, struct hyper_context*, struct hyper_buf**);
+/*
+ An async context for a task that contains the related waker.
+ */
+typedef Context hyper_context;
+
+typedef int (*hyper_body_data_callback)(void*, hyper_context*, struct hyper_buf**);
typedef void (*hyper_request_on_informational_callback)(void*, struct hyper_response*);
typedef int (*hyper_headers_foreach_callback)(void*, const uint8_t*, size_t, const uint8_t*, size_t);
-typedef size_t (*hyper_io_read_callback)(void*, struct hyper_context*, uint8_t*, size_t);
+typedef size_t (*hyper_io_read_callback)(void*, hyper_context*, uint8_t*, size_t);
-typedef size_t (*hyper_io_write_callback)(void*, struct hyper_context*, const uint8_t*, size_t);
+typedef size_t (*hyper_io_write_callback)(void*, hyper_context*, const uint8_t*, size_t);
#ifdef __cplusplus
extern "C" {
@@ -743,7 +743,7 @@
/*
Copies a waker out of the task context.
*/
-struct hyper_waker *hyper_context_waker(struct hyper_context *cx);
+struct hyper_waker *hyper_context_waker(hyper_context *cx);
/*
Free a waker that hasn't been woken. And if we try replacing it with |
The default representation does not guarantee the absence of initial padding, which is necessary for the transmute to be sound.
…m#3191)" (hyperium#3193) This reverts commit 187b8f2.
The default representation does not guarantee the absence of initial padding, which is necessary for the transmute to be sound. Signed-off-by: Sven Pfennig <[email protected]>
…m#3191)" (hyperium#3193) This reverts commit 187b8f2. Signed-off-by: Sven Pfennig <[email protected]>
The default representation does not guarantee the absence of initial padding, which is necessary for the transmute to be sound.