Skip to content

implement into_array for Vec<T>#156234

Open
bend-n wants to merge 1 commit intorust-lang:mainfrom
bend-n:into_array_for_vec_t_via_boxed_array
Open

implement into_array for Vec<T>#156234
bend-n wants to merge 1 commit intorust-lang:mainfrom
bend-n:into_array_for_vec_t_via_boxed_array

Conversation

@bend-n
Copy link
Copy Markdown
Contributor

@bend-n bend-n commented May 6, 2026

for more into_array coverage and to avoid harmful obtuse opaque try_into calls

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 6, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 6, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, nia-e

@rust-log-analyzer

This comment has been minimized.

@bend-n bend-n force-pushed the into_array_for_vec_t_via_boxed_array branch from 09b6441 to 12ff256 Compare May 6, 2026 11:55
#[cfg(not(no_global_oom_handling))]
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
#[must_use]
pub fn into_array<const N: usize>(self) -> Option<Box<[T; N], A>> {
Copy link
Copy Markdown
Contributor

@tbu- tbu- May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably return Result<_, Self>.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every into_array is like this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tracking issue that you link (#148082) says it should be a Result. It also makes sense for this to be a Result: This way, you can recover the allocation if the conversion fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tracking issue doesn't say that, some random person says that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants