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
{{ message }}
Repository navigation
Replace usage of mem::uninitialized with MaybeUninit #2532
// `mem::uninitialized` replaced with `mem::MaybeUninit`,
// can't upgrade yet
#![allow(deprecated)]
which I assume is why std::mem::MaybeUninit, stabilized in 1.36.0, could not be used yet. Today, hyper's MSRV is 1.46.0, so it should now be possible to investigate removing the #![allow(deprecated)].
One problem with refactoring the code is that httparse::Request::new accepts &mut [Header], so it is assumed that they are initialized. It would need to accept &mut [MaybeUninit<Header>]
Otherwise MaybeUninit::uninit().assume_init() (like it is done here) gives the same problems as mem::uninitialized
Activity
seanmonstar commentedon May 4, 2021
Good call!
mohsen-alizadeh commentedon May 4, 2021
Refactored the code.
Soveu commentedon May 4, 2021
One problem with refactoring the code is that httparse::Request::new accepts
&mut [Header], so it is assumed that they are initialized. It would need to accept&mut [MaybeUninit<Header>]Otherwise
MaybeUninit::uninit().assume_init()(like it is done here) gives the same problems asmem::uninitializedRalfJung commentedon Jul 21, 2021
FYI, this seems to be one of the major sources of regressions in rust-lang/rust#87041.
refactor(http1): use MaybeUninit for parsing with uninitialized heade…