rust/library/std/src
Matthias Krüger d46cc71f54
Rollup merge of #135394 - clarfonthey:uninit-slices-part-2, r=tgross35
`MaybeUninit` inherent slice methods part 2

These were moved out of #129259 since they require additional libs-api approval. Tracking issue: #117428.

New API surface:

```rust
impl<T> [MaybeUninit<T>] {
    // replacing fill; renamed to avoid conflict
    pub fn write_filled(&mut self, value: T) -> &mut [T] where T: Clone;

    // replacing fill_with; renamed to avoid conflict
    pub fn write_with<F>(&mut self, value: F) -> &mut [T] where F: FnMut() -> T;

    // renamed to remove "fill" terminology, since this is closer to the write_*_of_slice methods
    pub fn write_iter<I>(&mut self, iter: I) -> (&mut [T], &mut Self) where I: Iterator<Item = T>;
}
```

Relevant motivation for these methods; see #129259 for earlier methods' motiviations.

* I chose `write_filled` since `filled` is being used as an object here, whereas it's being used as an action in `fill`.
* I chose `write_with` instead of `write_filled_with` since it's shorter and still matches well.
* I chose `write_iter` because it feels completely different from the fill methods, and still has the intent clear.

In all of the methods, it felt appropriate to ensure that they contained `write` to clarify that they are effectively just special ways of doing `MaybeUninit::write` for each element of a slice.

Tracking issue: https://github.com/rust-lang/rust/issues/117428

r? libs-api
2025-03-19 16:52:52 +01:00
..
backtrace remove redundant imports 2023-12-10 10:56:22 +08:00
collections Rollup merge of #137870 - karolzwolak:lazylock-const-hashmaps-137566, r=cuviper 2025-03-14 01:37:30 -04:00
ffi Specialize constructing OsString from strings 2025-02-28 13:50:31 -08:00
fs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
hash remove const_hash feature leftovers 2024-11-02 11:27:14 +01:00
io Rollup merge of #135394 - clarfonthey:uninit-slices-part-2, r=tgross35 2025-03-19 16:52:52 +01:00
net Rollup merge of #136842 - randomPoison:trusty-libstd-v3, r=ChrisDenton 2025-03-13 10:58:17 +01:00
os Rollup merge of #137793 - NobodyXu:stablise-annoymous-pipe, r=joshtriplett 2025-03-17 05:47:50 -04:00
prelude Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
process std: Apply deprecated_safe_2024 2025-02-13 13:10:28 -08:00
sync Auto merge of #137237 - cuviper:stage0, r=Mark-Simulacrum 2025-02-23 11:12:56 +00:00
sys Auto merge of #138653 - matthiaskrgr:rollup-fwwqmr7, r=matthiaskrgr 2025-03-19 09:28:24 +00:00
sys_common Move fs into sys 2025-03-08 16:22:37 -08:00
thread library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
alloc.rs Mark imports of #[rustc_std_internal_symbol] items with this attribute 2025-03-17 14:06:56 +00:00
ascii.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
backtrace.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
bstr.rs Implement ByteStr and ByteString types 2025-01-11 06:35:21 +02:00
env.rs Rollup merge of #136320 - RalfJung:exit, r=the8472 2025-03-18 10:09:28 +01:00
error.rs Move std::error unit tests to integration tests 2025-01-26 10:28:04 +00:00
f16.rs Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35 2025-02-23 14:30:25 -05:00
f32.rs Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35 2025-02-23 14:30:25 -05:00
f64.rs Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35 2025-02-23 14:30:25 -05:00
f128.rs Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35 2025-02-23 14:30:25 -05:00
fs.rs Disable unsupported tests 2025-03-10 10:00:25 -07:00
keyword_docs.rs Migrate std to Rust 2024 2025-03-11 09:46:34 -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 Rollup merge of #137492 - nabijaczleweli:master, r=thomcc 2025-03-16 13:19:52 +08:00
macros.rs fix doc path in std::fmt macro 2025-02-25 09:08:22 +05:30
num.rs Move std::num unit tests to integration tests 2025-01-26 10:28:04 +00:00
panic.rs add last std diagnostic items for clippy 2025-02-18 10:54:37 +01:00
panicking.rs Mark imports of #[rustc_std_internal_symbol] items with this attribute 2025-03-17 14:06:56 +00:00
pat.rs Add pattern types to parser 2024-04-08 11:57:17 +00:00
path.rs Remove has_redox_scheme 2025-03-13 20:09:07 +00:00
process.rs Rollup merge of #136320 - RalfJung:exit, r=the8472 2025-03-18 10:09:28 +01:00
random.rs Unify cygwin & horizon random impl 2025-03-10 21:23:32 +08:00
rt.rs Rollup merge of #135446 - klensy:panic_immediate_abort_ext, r=Mark-Simulacrum 2025-01-20 12:38:32 +08:00
test_helpers.rs std: get rid of sys_common::io 2025-02-07 16:54:07 +01:00
time.rs Rollup merge of #136301 - hkBst:patch-33, r=thomcc 2025-02-19 18:52:04 +01:00