Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ffi/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct TaskFuture {
/// its only purpose is to provide access to the waker. See `hyper_waker`.
///
/// Corresponding Rust type: <https://doc.rust-lang.org/std/task/struct.Context.html>
#[repr(C)] // we transmute references
pub struct hyper_context<'a>(Context<'a>);

/// A waker that is saved and used to waken a pending task.
Expand Down Expand Up @@ -500,7 +501,7 @@ where

impl hyper_context<'_> {
pub(crate) fn wrap<'a, 'b>(cx: &'a mut Context<'b>) -> &'a mut hyper_context<'b> {
// A struct with only one field has the same layout as that field.
// A repr(C) newtype has the same layout as its only field.
unsafe { std::mem::transmute::<&mut Context<'_>, &mut hyper_context<'_>>(cx) }
}
}
Expand Down
1 change: 1 addition & 0 deletions src/proto/h2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ fn h2_to_io_error(e: h2::Error) -> std::io::Error {
}
}

#[repr(transparent)]
struct UpgradedSendStream<B>(SendStream<SendBuf<Neutered<B>>>);

impl<B> UpgradedSendStream<B>
Expand Down