Add index/iter methods for MaybeUninit<[T; N]>#88837
Add index/iter methods for MaybeUninit<[T; N]>#88837kpp wants to merge 1 commit intorust-lang:masterfrom
MaybeUninit<[T; N]>#88837Conversation
|
r? @yaahc (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
da09dd0 to
6318b9a
Compare
This comment has been minimized.
This comment has been minimized.
|
That seems redundant with uninit_array and array_assume_init. Maybe conversions between |
|
I agree with @the8472 that this is redundant, and Plus, implementation of stable trait of stable type is insta-stable. The unstable annotation has no effect. Therefore this would need libs team signoff. |
|
I guess you are right. |
|
What code would benefit from the transpose method? |
|
Same as assume_init_ref/mut. This can be useful when we want to access it but don’t have ownership of the MaybeUninit. |
|
No new method is needed, two |
|
@kpp Ping from triage, seems CI is still red here. |
6318b9a to
a6e1974
Compare
This comment has been minimized.
This comment has been minimized.
Add impl IndexMut for `MaybeUninit<[T; N]>` Add impl IntoIterator for `&mut MaybeUninit<[T; N]>` Add `MaybeUninit<[T; N]>::iter_mut` method
a6e1974 to
2419cb5
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
I can't fight with |
|
The impl block for a trait needs a stability attribute, not the methods. But it must be |
|
Ping from triage: |
|
☔ The latest upstream changes (presumably #91311) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Ping from triage: |
While it's possible to create a
MaybeUninit::<[T; N]>there is no way to index elements to initialize them other than to call.as_mut_ptr()and index over a raw pointer. I added several methods to make life a little bit easier. The idea is to get&[mut] MaybeUninit<T>fromMaybeUninit<[T; N]>either through index or iter methods.Use cases