rust/library/std/src
Michael Goulet c77dc28f87
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.
2024-06-24 15:51:01 -04:00
..
backtrace remove redundant imports 2023-12-10 10:56:22 +08:00
collections Fix typo in the docs of HashMap::raw_entry_mut 2024-06-03 17:35:58 +01:00
env remove redundant imports 2023-12-10 10:56:22 +08:00
error core/any: remove Provider trait 2023-08-13 13:07:53 -06:00
f16 Add basic f16 and f128 modules 2024-04-10 13:50:27 -04:00
f32 Add gamma and ln_gamma functions to f32 and f64 2023-07-31 07:41:50 -07:00
f64 Add gamma and ln_gamma functions to f32 and f64 2023-07-31 07:41:50 -07:00
f128 Add basic f16 and f128 modules 2024-04-10 13:50:27 -04:00
ffi fixed memory leaks in PathBuf::leak & OsString::leak tests 2024-06-06 23:18:01 +01:00
fs Replace MaybeUninit::uninit_array() with array repeat expression. 2024-06-24 10:23:50 -07:00
hash Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
io Convert some module-level // and /// comments to //!. 2024-06-20 09:23:18 +10:00
net Replace MaybeUninit::uninit_array() with array repeat expression. 2024-06-24 10:23:50 -07:00
num removed nonfunctioning benchmark 2024-01-11 11:30:12 -05:00
os to extract a pidfd we must consume the child 2024-06-22 00:46:55 +02:00
panic
path fixed memory leaks in PathBuf::leak & OsString::leak tests 2024-06-06 23:18:01 +01:00
prelude replace version placeholder 2024-06-11 16:52:02 +02:00
process Replace MaybeUninit::uninit_array() with array repeat expression. 2024-06-24 10:23:50 -07:00
sync Replace move|| with move || in compiler/ and library/ 2024-06-18 23:25:08 +08:00
sys Rollup merge of #125082 - kpreid:const-uninit, r=dtolnay 2024-06-24 15:51:01 -04:00
sys_common Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum 2024-06-24 15:55:28 +00:00
thread Replace move|| with move || in compiler/ and library/ 2024-06-18 23:25:08 +08:00
time Rollup merge of #103056 - beetrees:timespec-bug-fix, r=thomcc 2023-05-05 18:40:32 +05:30
alloc.rs Unify guarantees about the default allocator 2024-06-11 17:13:26 +02:00
ascii.rs Add the basic ascii::Char type 2023-05-03 22:09:33 -07:00
backtrace.rs std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02:00
env.rs Auto merge of #126273 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum 2024-06-12 18:15:32 +00:00
error.rs std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02:00
f16.rs Add powi to f16 and f128 2024-05-16 15:41:06 -05:00
f32.rs variable-precision float operations behave non-deterministically 2024-05-02 18:57:30 +02:00
f64.rs variable-precision float operations behave non-deterministically 2024-05-02 18:57:30 +02:00
f128.rs Add powi to f16 and f128 2024-05-16 15:41:06 -05:00
fs.rs Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu 2024-06-22 19:33:55 +02:00
keyword_docs.rs Mention labelled blocks in break docs 2024-03-15 10:51:57 -07:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Replace MaybeUninit::uninit_array() with array repeat expression. 2024-06-24 10:23:50 -07:00
macros.rs added column number to dbg!() 2023-12-12 18:12:23 +08:00
num.rs Replace version placeholders for 1.79 2024-05-01 21:01:51 -04:00
panic.rs Use payload_as_str instead of two downcasts. 2024-06-12 13:15:29 +02:00
panicking.rs Add PanicMessage type for PanicInfo::message(). 2024-06-17 20:44:55 +02:00
pat.rs Add pattern types to parser 2024-04-08 11:57:17 +00:00
path.rs Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu 2024-06-22 19:33:55 +02:00
process.rs Clarify Command::new behavior if passed programs with arguments 2024-06-10 12:25:05 +00:00
rt.rs std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02:00
time.rs Rust is a proper name: rust → Rust 2024-03-07 07:49:22 +01:00