Skip to content

Conversation

edwloef
Copy link
Contributor

@edwloef edwloef commented Oct 1, 2025

Tracking issue: #147212

I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@edwloef edwloef mentioned this pull request Oct 1, 2025
4 tasks
@rust-lang rust-lang deleted a comment from bors Oct 1, 2025
Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

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

The current wording is great! I'd maybe add a note (and a line in the example) about using Box::write to reinitialise the Box, as these functions are meant to be used together.

View changes since this review

let (raw, alloc) = Box::into_raw_with_allocator(boxed);
let value = raw.read();
let uninit = Box::from_raw_in(raw.cast::<mem::MaybeUninit<T>>(), alloc);
(value, uninit)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use Box::into_non_null_with_allocator and NonNull::cast_uninit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! However since this has already been r+'ed, I think I'll save that change for the inevitable renaming of the function, since as far as I can tell the semantics are identical from the outside.

@joboet
Copy link
Member

joboet commented Oct 1, 2025

Thanks!
@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 1, 2025

📌 Commit 8dfea22 has been approved by joboet

It is now in the queue for this repository.

@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 Oct 1, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 2, 2025
implement `Box::take`

Tracking issue: rust-lang#147212

I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)
bors added a commit that referenced this pull request Oct 2, 2025
Rollup of 10 pull requests

Successful merges:

 - #146281 (Support `#[rustc_align_static]` inside `thread_local!`)
 - #146535 (mbe: Implement `unsafe` attribute rules)
 - #146585 (indexing: reword help)
 - #147004 (Tweak handling of "struct like start" where a struct isn't supported)
 - #147221 (Forbid `//@ compile-flags: -Cincremental=` in tests)
 - #147225 (Don't enable shared memory by default with Wasm atomics)
 - #147227 (implement `Box::take`)
 - #147231 (Extending `#[rustc_force_inline]` to be applicable to inherent methods)
 - #147233 (Initialize llvm submodule if not already the case to run citool)
 - #147236 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 2, 2025
implement `Box::take`

Tracking issue: rust-lang#147212

I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 2, 2025
implement `Box::take`

Tracking issue: rust-lang#147212

I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)
bors added a commit that referenced this pull request Oct 2, 2025
Rollup of 9 pull requests

Successful merges:

 - #146281 (Support `#[rustc_align_static]` inside `thread_local!`)
 - #146535 (mbe: Implement `unsafe` attribute rules)
 - #146585 (indexing: reword help)
 - #147004 (Tweak handling of "struct like start" where a struct isn't supported)
 - #147221 (Forbid `//@ compile-flags: -Cincremental=` in tests)
 - #147225 (Don't enable shared memory by default with Wasm atomics)
 - #147227 (implement `Box::take`)
 - #147233 (Initialize llvm submodule if not already the case to run citool)
 - #147236 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fbe6834 into rust-lang:master Oct 2, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 2, 2025
rust-timer added a commit that referenced this pull request Oct 2, 2025
Rollup merge of #147227 - edwloef:box_take, r=joboet

implement `Box::take`

Tracking issue: #147212

I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)
@edwloef edwloef deleted the box_take branch October 2, 2025 20:47
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Oct 3, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#146281 (Support `#[rustc_align_static]` inside `thread_local!`)
 - rust-lang/rust#146535 (mbe: Implement `unsafe` attribute rules)
 - rust-lang/rust#146585 (indexing: reword help)
 - rust-lang/rust#147004 (Tweak handling of "struct like start" where a struct isn't supported)
 - rust-lang/rust#147221 (Forbid `//@ compile-flags: -Cincremental=` in tests)
 - rust-lang/rust#147225 (Don't enable shared memory by default with Wasm atomics)
 - rust-lang/rust#147227 (implement `Box::take`)
 - rust-lang/rust#147233 (Initialize llvm submodule if not already the case to run citool)
 - rust-lang/rust#147236 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

5 participants