Skip to content

Reduce pointer casts in Box::into_boxed_slice - #73459

Merged
bors merged 1 commit into
rust-lang:masterfrom
cuviper:into_boxed_slice-unicast
Jun 19, 2020
Merged

Reduce pointer casts in Box::into_boxed_slice#73459
bors merged 1 commit into
rust-lang:masterfrom
cuviper:into_boxed_slice-unicast

Conversation

@cuviper

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

r? @withoutboats

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 17, 2020
@cuviper

Copy link
Copy Markdown
MemberAuthor

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

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

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Jun 19, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit a7c2cf8 has been approved by dtolnay

@borsbors 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
@RalfJungRalfJung mentioned this pull request 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:masterJun 19, 2020
@elichai

Copy link
Copy Markdown
Contributor

Thanks!
the simpler the better :)

@cuviper
cuviper deleted the into_boxed_slice-unicast branch August 9, 2020 23:37
@dtolnaydtolnay assigned dtolnay and unassigned withoutboatsMar 24, 2024
@cuvipercuviper added this to the 1.46 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant 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

@cuviper@rust-highfive@dtolnay@bors@elichai@withoutboats