Rollup merge of #125082 - kpreid:const-uninit, r=dtolnay
Remove `MaybeUninit::uninit_array()` and replace it with inline const blocks. \[This PR originally contained the changes in #125995 too. See edit history for the original PR description.] The documentation of `MaybeUninit::uninit_array()` says: > Note: in a future Rust version this method may become unnecessary when Rust allows [inline const expressions](https://github.com/rust-lang/rust/issues/76001). The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`. The PR adding it also said: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a standard library method that will be replaceable with `let buffer = [MaybeUninit::<T>::uninit(); $N];` That time has come to pass — inline const expressions are stable — so `MaybeUninit::uninit_array()` is now unnecessary. The only remaining question is whether it is an important enough *convenience* to keep it around. I believe it is net good to remove this function, on the principle that it is better to compose two orthogonal features (`MaybeUninit` and array construction) than to have a specific function for the specific combination, now that that is possible.
This commit is contained in:
commit
c77dc28f87
22 changed files with 32 additions and 38 deletions
|
@ -27,7 +27,6 @@
|
|||
#![feature(lint_reasons)]
|
||||
#![feature(macro_metavar_expr)]
|
||||
#![feature(map_try_insert)]
|
||||
#![feature(maybe_uninit_uninit_array)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(negative_impls)]
|
||||
#![feature(never_type)]
|
||||
|
|
|
@ -188,7 +188,7 @@ impl SipHasher128 {
|
|||
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher128 {
|
||||
let mut hasher = SipHasher128 {
|
||||
nbuf: 0,
|
||||
buf: MaybeUninit::uninit_array(),
|
||||
buf: [MaybeUninit::uninit(); BUFFER_WITH_SPILL_CAPACITY],
|
||||
state: State {
|
||||
v0: key0 ^ 0x736f6d6570736575,
|
||||
// The XOR with 0xee is only done on 128-bit algorithm version.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue