Skip to content

Box is missing try_new_uninit_slice_in #130

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
AljoschaMeyer opened this issue Jul 5, 2024 · 4 comments
Open

Box is missing try_new_uninit_slice_in #130

AljoschaMeyer opened this issue Jul 5, 2024 · 4 comments

Comments

@AljoschaMeyer
Copy link

Hi,

while Box has both try_new_uninit_slice and new_uninit_slice_in, it lacks try_new_uninit_slice_in to fallibly allocate a slice of uninitialized memory with a given allocator. Is this deliberate or an oversight? What could be a good workaround for implementing this oneself?

Apologies if this is not the appropriate repo for this sort of question/feature suggestion.

Cheers,
Aljoscha

@Amanieu
Copy link
Member

Amanieu commented Jul 5, 2024

This is an oversight, a PR to add it is welcome.

@AljoschaMeyer
Copy link
Author

AljoschaMeyer commented Jul 6, 2024

Would be happy to make a PR. Please tell me if a PR to the main branch of https://github.com/rust-lang/rust is not what to do here. Done! rust-lang/rust#127415

Random piece of feedback: https://std-dev-guide.rust-lang.org/about.html never tells the reader which repository, branches, directories, etc to interact with.

AljoschaMeyer added a commit to AljoschaMeyer/rust that referenced this issue Jul 6, 2024
The methods for fallible slice allocation in a given allocator were missing, which was an oversight according to rust-lang/wg-allocators#130

This PR adds them as `try_new_uninit_slice_in` and `try_new_zeroed_slice_in`.

Also adds missing punctuation to the doc comments of ` try_new_uninit_slice` and `try_new_zeroed_slice`
@AljoschaMeyer
Copy link
Author

Here we go: rust-lang/rust#127415

@Amanieu
Copy link
Member

Amanieu commented Jul 6, 2024

That's perfect thank you.

jieyouxu added a commit to jieyouxu/rust that referenced this issue Jul 22, 2024
Add missing try_new_uninit_slice_in and try_new_zeroed_slice_in

The methods for fallible slice allocation in a given allocator were missing from `Box`, which was an oversight according to rust-lang/wg-allocators#130

This PR adds them as `try_new_uninit_slice_in` and `try_new_zeroed_slice_in`. I simply copy-pasted the implementations of `try_new_uninit_slice` and `try_new_zeroed_slice` and adusted doc comment, typings, and the allocator it uses internally.

Also adds missing punctuation to the doc comments of `try_new_uninit_slice` and `try_new_zeroed_slice`.

Related issue is rust-lang#32838 (Allocator traits and std::heap) *I think*. Also relevant is rust-lang#63291, but I did not add the corresponding `#[unstable]` proc macro, since `try_new_uninit_slice` and `try_new_zeroed_slice` are also not annotated with it.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 22, 2024
Rollup merge of rust-lang#127415 - AljoschaMeyer:master, r=dtolnay

Add missing try_new_uninit_slice_in and try_new_zeroed_slice_in

The methods for fallible slice allocation in a given allocator were missing from `Box`, which was an oversight according to rust-lang/wg-allocators#130

This PR adds them as `try_new_uninit_slice_in` and `try_new_zeroed_slice_in`. I simply copy-pasted the implementations of `try_new_uninit_slice` and `try_new_zeroed_slice` and adusted doc comment, typings, and the allocator it uses internally.

Also adds missing punctuation to the doc comments of `try_new_uninit_slice` and `try_new_zeroed_slice`.

Related issue is rust-lang#32838 (Allocator traits and std::heap) *I think*. Also relevant is rust-lang#63291, but I did not add the corresponding `#[unstable]` proc macro, since `try_new_uninit_slice` and `try_new_zeroed_slice` are also not annotated with it.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants