Skip to content

New zeroed slice #75171

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

Merged
merged 3 commits into from
Aug 22, 2020
Merged

New zeroed slice #75171

merged 3 commits into from
Aug 22, 2020

Conversation

amosonn
Copy link
Contributor

@amosonn amosonn commented Aug 5, 2020

Add to #63291 the methods

impl<T> Box<[T]> { pub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]> {} }
impl<T> Rc<[T]> { pub fn new_zeroed_slice(len: usize) -> Rc<[MaybeUninit<T>]> {} }
impl<T> Arc<[T]> { pub fn new_zeroed_slice(len: usize) -> Arc<[MaybeUninit<T>]> {} }

as suggested in #63291 (comment) .

Also optimize {Rc, Arc}::new_zeroed to use alloc_zeroed, otherwise they are no more efficient than using new_uninit and zeroing the memory manually (which was the original implementation).

@rust-highfive
Copy link
Contributor

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 5, 2020
@amosonn
Copy link
Contributor Author

amosonn commented Aug 5, 2020

r? @SimonSapin

@rust-highfive rust-highfive assigned SimonSapin and unassigned sfackler Aug 5, 2020
@bors
Copy link
Collaborator

bors commented Aug 5, 2020

@amosonn: 🔑 Insufficient privileges: not in try users

1 similar comment
@bors
Copy link
Collaborator

bors commented Aug 5, 2020

@amosonn: 🔑 Insufficient privileges: not in try users

@amosonn amosonn force-pushed the new_zeroed_slice branch 3 times, most recently from b2eebb5 to f75f492 Compare August 5, 2020 03:49
@bors
Copy link
Collaborator

bors commented Aug 5, 2020

☔ The latest upstream changes (presumably #75174) made this pull request unmergeable. Please resolve the merge conflicts.

@amosonn amosonn force-pushed the new_zeroed_slice branch 2 times, most recently from a41071d to ab204c5 Compare August 5, 2020 06:31
@crlf0710 crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2020
@Dylan-DPC-zz
Copy link

r? @Amanieu

@rust-highfive rust-highfive assigned Amanieu and unassigned SimonSapin Aug 21, 2020
@Amanieu
Copy link
Member

Amanieu commented Aug 21, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Collaborator

bors commented Aug 21, 2020

⌛ Trying commit ab204c5 with merge c7bc9915d37800e60ddf1d2cc573758c724395c3...

@Amanieu
Copy link
Member

Amanieu commented Aug 21, 2020

@bors try

@bors
Copy link
Collaborator

bors commented Aug 21, 2020

⌛ Trying commit 5aba816 with merge f3a9871a4972d9c4fe07f70e3e5aa63d6bdb6577...

@bors
Copy link
Collaborator

bors commented Aug 21, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: f3a9871a4972d9c4fe07f70e3e5aa63d6bdb6577 (f3a9871a4972d9c4fe07f70e3e5aa63d6bdb6577)

@rust-timer
Copy link
Collaborator

Queued f3a9871a4972d9c4fe07f70e3e5aa63d6bdb6577 with parent de521cb, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (f3a9871a4972d9c4fe07f70e3e5aa63d6bdb6577): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@Amanieu
Copy link
Member

Amanieu commented Aug 22, 2020

@bors r+ rollup-

@bors
Copy link
Collaborator

bors commented Aug 22, 2020

📌 Commit 5aba816 has been approved by Amanieu

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2020
@bors
Copy link
Collaborator

bors commented Aug 22, 2020

⌛ Testing commit 5aba816 with merge 663d2f5...

@bors
Copy link
Collaborator

bors commented Aug 22, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Amanieu
Pushing 663d2f5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 22, 2020
@bors bors merged commit 663d2f5 into rust-lang:master Aug 22, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants