Skip to content

Tracking Issue for maybe_uninit_write_slice #79995

Closed

Description

@beepster4096

Feature gate: #![feature(maybe_uninit_write_slice)]

This is a tracking issue for MaybeUninit::copy_from_slice and MaybeUninit::clone_from_slice.

These methods are the equivalents of [T]::copy_from_slice and [T]::clone_from_slice for uninitialized slices.

Public API

impl<T> [MaybeUninit<T>] {
    pub fn write_copy_of_slice(&mut self, src: &[T]) -> &mut [T]
    where
        T: Copy;

    pub fn write_clone_of_slice(&mut self, src: &[T]) -> &mut [T]
    where
        T: Clone;
}

Steps / History

Unresolved Questions

Activity

  1. beepster4096 commented on Dec 13, 2020

    @beepster4096
    Author
  2. added
    A-raw-pointersArea: raw pointers, MaybeUninit, NonNull
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-libs-api[DEPRECATED; DO NOT USE]
    on Dec 13, 2020
  3. added
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Dec 16, 2020
  4. Thomasdezeeuw commented on Jan 30, 2021

    @Thomasdezeeuw
    Contributor

    These functions are great additions to the MaybeUninit API.

    But if may open the bikeshed, should be renamed to copy_slice and clone_slice to more closely match what the functions are actually doing? The current names are a little confusing/misleading. For example let's look at a similarly named function: MaybeUninit::write, it takes ownership of the value it writes and moves the value into the MaybeUninit. However write_slice and write_slice_cloned don't do this as they copy/clone, so I think the "write" terminology can be a bit misleading.

  5. SimonSapin commented on Jun 1, 2021

    @SimonSapin
    Contributor

    These methods are the equivalents of [T]::copy_from_slice and [T]::clone_from_slice for uninitialized slices.

    This seems like a great reason to name these methods MaybeUninit::copy_from_slice and MaybeUninit::clone_from_slice

  6. veber-alex commented on Jan 28, 2022

    @veber-alex
    Contributor

    is it possible to add this as methods on impl<T> [MaybeUninit<T>] ?

  7. s1ck commented on Sep 9, 2022

    @s1ck

    @drmeepster what are the plans on getting this stabilized?

  8. Noah-Kennedy commented on Sep 9, 2022

    @Noah-Kennedy

    I'm pretty interested in seeing this stabilized as well.

  9. Kixunil commented on Sep 12, 2022

    @Kixunil
    Contributor

    I think it just needs an ACP and approval.

  10. SUPERCILEX commented on Oct 17, 2022

    @SUPERCILEX
    Contributor

    Regarding the naming, I also think they should be called {copy,clone}_from_slice for consistency and ease of finding. The original reasoning for their current name is to indicate that the cloned values will NOT be dropped. However, I'd argue most people don't even realize that value replacement causes the old values to be dropped (I know I didn't until I thought about it). If you think about it for a bit it's obvious, but I don't think people associate "clone_from_slice" with "old stuff dropped". Instead, I think the docs can be a bit louder about the fact that old data won't be dropped.

  11. added a commit that references this issue on Nov 11, 2023
  12. bend-n commented on Jan 22, 2024

    @bend-n
    Contributor

    These methods are the equivalents of [T]::copy_from_slice and [T]::clone_from_slice for uninitialized slices.

    Then why is the api so different?

  13. added a commit that references this issue on Feb 16, 2024
  14. 23 remaining items

  15. joshtriplett commented on Oct 28, 2025

    @joshtriplett
    Member

    We discussed these in today's @rust-lang/libs-api meeting, and we were happy with the curent names, both for clarity and for consistency with other APIs.

  16. added
    to-announceAnnounce this issue on triage meeting
    and removed
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Nov 1, 2025
  17. rust-rfcbot commented on Nov 1, 2025

    @rust-rfcbot
    Collaborator

    The final comment period, with a disposition to merge, as per the review above, is now complete.

    As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

    This will be merged soon.

  18. added 4 commits that reference this issue on Nov 26, 2025
  19. added a commit that references this issue on Nov 27, 2025
  20. added this to the 1.93.0 milestone on Jan 8, 2026
  21. added a commit that references this issue on Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-raw-pointersArea: raw pointers, MaybeUninit, NonNullC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-radarLibs issues that are tracked on the team's radar.T-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions