Skip to content

Reduce pointer casts in Box::into_boxed_slice #73459

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 1 commit into from
Jun 19, 2020

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jun 17, 2020

We only need to cast the pointer once to change Box<T> to an array
Box<[T; 1]>, then we can let unsized coercion return Box<[T]>.

We only need to cast the pointer once to change `Box<T>` to an array
`Box<[T; 1]>`, then we can let unsized coercion return `Box<[T]>`.
@rust-highfive
Copy link
Contributor

r? @withoutboats

(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 Jun 17, 2020
@cuviper
Copy link
Member Author

cuviper commented Jun 17, 2020

cc @shepmaster, as discussed in #71421 (review)

@dtolnay dtolnay added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 19, 2020
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks @cuviper!

@dtolnay
Copy link
Member

dtolnay commented Jun 19, 2020

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 19, 2020

📌 Commit a7c2cf8 has been approved by dtolnay

@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 Jun 19, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 19, 2020
Rollup of 13 pull requests

Successful merges:

 - rust-lang#70740 (Enabling static-pie for musl)
 - rust-lang#72331 (Report error when casting an C-like enum implementing Drop)
 - rust-lang#72486 (Fix asinh of negative values)
 - rust-lang#72497 (tag/niche terminology cleanup)
 - rust-lang#72999 (Create self-contained directory and move there some of external binaries/libs)
 - rust-lang#73130 (Remove const prop for indirects)
 - rust-lang#73142 (Ensure std benchmarks get tested.)
 - rust-lang#73305 (Disallow loading crates with non-ascii identifier name.)
 - rust-lang#73346 (Add rust specific features to print target features)
 - rust-lang#73362 (Test that bounds checks are elided when slice len is checked up-front)
 - rust-lang#73459 (Reduce pointer casts in Box::into_boxed_slice)
 - rust-lang#73464 (Document format correction)
 - rust-lang#73479 (Minor tweaks to liballoc)

Failed merges:

r? @ghost
@bors bors merged commit fc2ce7c into rust-lang:master Jun 19, 2020
@elichai
Copy link
Contributor

elichai commented Jun 21, 2020

Thanks!
the simpler the better :)

@cuviper cuviper deleted the into_boxed_slice-unicast branch August 9, 2020 23:37
@dtolnay dtolnay assigned dtolnay and unassigned withoutboats Mar 24, 2024
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants