File tree 2 files changed +3
-1
lines changed
2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ struct TaskFuture {
127
127
/// its only purpose is to provide access to the waker. See `hyper_waker`.
128
128
///
129
129
/// Corresponding Rust type: <https://doc.rust-lang.org/std/task/struct.Context.html>
130
+ #[ repr( transparent) ] // we transmute references
130
131
pub struct hyper_context < ' a > ( Context < ' a > ) ;
131
132
132
133
/// A waker that is saved and used to waken a pending task.
@@ -500,7 +501,7 @@ where
500
501
501
502
impl hyper_context < ' _ > {
502
503
pub ( crate ) fn wrap < ' a , ' b > ( cx : & ' a mut Context < ' b > ) -> & ' a mut hyper_context < ' b > {
503
- // A struct with only one field has the same layout as that field.
504
+ // A repr(transparent) struct has the same layout its dataful field.
504
505
unsafe { std:: mem:: transmute :: < & mut Context < ' _ > , & mut hyper_context < ' _ > > ( cx) }
505
506
}
506
507
}
Original file line number Diff line number Diff line change @@ -386,6 +386,7 @@ fn h2_to_io_error(e: h2::Error) -> std::io::Error {
386
386
}
387
387
}
388
388
389
+ #[ repr( transparent) ]
389
390
struct UpgradedSendStream < B > ( SendStream < SendBuf < Neutered < B > > > ) ;
390
391
391
392
impl < B > UpgradedSendStream < B >
You can’t perform that action at this time.
0 commit comments