implement into_array for Vec<T>#156234
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
09b6441 to
12ff256
Compare
| #[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>> { |
There was a problem hiding this comment.
Should probably return Result<_, Self>.
There was a problem hiding this comment.
every into_array is like this.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
the tracking issue doesn't say that, some random person says that.
There was a problem hiding this comment.
upon further review the tracking issue does say so, and the others are to be changed in the future... but that can happen to this too, i think.
for more into_array coverage and to avoid harmful obtuse opaque try_into calls