Uh oh!
There was an error while loading. Please reload this page.
implement Box::take - #147227
Merged
Merged
Conversation
rustbot
commented
Oct 1, 2025
Collaborator
joboet
reviewed
Oct 1, 2025
| 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) |
Contributor
There was a problem hiding this comment.
Could you use Box::into_non_null_with_allocator and NonNull::cast_uninit?
ContributorAuthor
There was a problem hiding this comment.
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
commented
Oct 1, 2025
Member
Thanks! |
bors
commented
Oct 1, 2025
Collaborator
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
Uh oh!
There was an error while loading. Please reload this page.
github-actionsBot
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
github-actionsBot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Oct 9, 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 :)
rust-cloud-vmsBot
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Oct 12, 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
flip1995 pushed a commit
to flip1995/rust-clippy
that referenced
this pull request
Oct 18, 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
makai410 pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 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 :)
makai410 pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 2025
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#146281 (Support `#[rustc_align_static]` inside `thread_local!`) - rust-lang#146535 (mbe: Implement `unsafe` attribute rules) - rust-lang#146585 (indexing: reword help) - rust-lang#147004 (Tweak handling of "struct like start" where a struct isn't supported) - rust-lang#147221 (Forbid `//@ compile-flags: -Cincremental=` in tests) - rust-lang#147225 (Don't enable shared memory by default with Wasm atomics) - rust-lang#147227 (implement `Box::take`) - rust-lang#147233 (Initialize llvm submodule if not already the case to run citool) - rust-lang#147236 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
makai410 pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 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 :)
makai410 pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 2025
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#146281 (Support `#[rustc_align_static]` inside `thread_local!`) - rust-lang#146535 (mbe: Implement `unsafe` attribute rules) - rust-lang#146585 (indexing: reword help) - rust-lang#147004 (Tweak handling of "struct like start" where a struct isn't supported) - rust-lang#147221 (Forbid `//@ compile-flags: -Cincremental=` in tests) - rust-lang#147225 (Don't enable shared memory by default with Wasm atomics) - rust-lang#147227 (implement `Box::take`) - rust-lang#147233 (Initialize llvm submodule if not already the case to run citool) - rust-lang#147236 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
Merged
Zalathar added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2025
Refactor `Box::take` as per rust-lang#147227 (comment)
Zalathar added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2025
Refactor `Box::take` as per rust-lang#147227 (comment)
Zalathar added a commit
to Zalathar/rust
that referenced
this pull request
Nov 14, 2025
Refactor `Box::take` as per rust-lang#147227 (comment)
Zalathar added a commit
to Zalathar/rust
that referenced
this pull request
Nov 14, 2025
Refactor `Box::take` as per rust-lang#147227 (comment)
rust-timer added a commit
that referenced
this pull request
Nov 14, 2025
Rollup merge of #148867 - edwloef:refactor-box-take, r=joboet Refactor `Box::take` as per #147227 (comment)
makai410 pushed a commit
to makai410/rustc_public
that referenced
this pull request
Nov 16, 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
github-actionsBot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Nov 30, 2025
Refactor `Box::take` as per rust-lang#147227 (comment)
makai410 pushed a commit
to makai410/rustc_public
that referenced
this pull request
Mar 27, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking issue: #147212
I'm not entirely sure about the wording of the doc comment, if anyone has any suggestions that'd be great :)