Skip to content

Document that ManuallyDrop's Box interaction has been fixed#155750

Open
WaffleLapkin wants to merge 2 commits intorust-lang:mainfrom
WaffleLapkin:manually-drop-unbox
Open

Document that ManuallyDrop's Box interaction has been fixed#155750
WaffleLapkin wants to merge 2 commits intorust-lang:mainfrom
WaffleLapkin:manually-drop-unbox

Conversation

@WaffleLapkin
Copy link
Copy Markdown
Member

@WaffleLapkin WaffleLapkin commented Apr 24, 2026

View all comments

Both #150447 and #150446 has been merged in 1.96.0, fixing the unfortunate ManuallyDrop<Box<_>> behavior.

cc @RalfJung

@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 Apr 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 24, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented Apr 26, 2026

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

📌 Commit 8520b8e has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Apr 26, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 26, 2026
…r=jhpratt

Document that `ManuallyDrop`'s `Box` interaction has been fixed

Both rust-lang#150447 and rust-lang#150446 has been merged in `1.96.0`, fixing the unfortunate `ManuallyDrop<Box<_>>` behavior.

cc @RalfJung
rust-bors Bot pushed a commit that referenced this pull request Apr 26, 2026
Rollup of 2 pull requests

Successful merges:

 - #155750 (Document that `ManuallyDrop`'s `Box` interaction has been fixed)
 - #155774 (std: maintain `CStringArray` null-termination even if `Vec::push` panics)
@RalfJung
Copy link
Copy Markdown
Member

@bors r-

Uh no we can't yet make this a stable guarantee I don't think.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 26, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

This pull request was unapproved.

This PR was contained in a rollup (#155807), which was unapproved.

View changes since this unapproval

///
/// Note that this could also have happen with a generic type where the user of
/// the library providing it could substitute the generic for a `Box<_>` and
/// then move the library type:
Copy link
Copy Markdown
Member

@RalfJung RalfJung Apr 26, 2026

Choose a reason for hiding this comment

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

We don't usually document the behavior of past versions of Rust in the current docs, do we? I guess the point is that people should be aware that there's a sort of MSRV effect by relying on this behavior?

And you even added new examples, making the docs more extensive than they were when this affected latest stable Rust.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The idea is indeed that there is an MSRV effect to this behavior (or luck of the footgun...)

I did not add examples, only move existing ones around (GitHub diff is being very unhelpful here)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think people usually just go to doc.rust-lang.org/stable for docs, rather than checking for docs of their MSRV, so keeping the warning seems like a good idea to be.

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.

Oh right I misread the diff.

@RalfJung
Copy link
Copy Markdown
Member

If we make this a stable guarantee then even if MaybeDangling ends up getting rejected, we are committing to having something like this in the language permanently. This should hence go through FCP, for both lang and libs-api I assume.

@RalfJung RalfJung added I-lang-nominated Nominated for discussion during a lang team meeting. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Apr 26, 2026
@nia-e
Copy link
Copy Markdown
Member

nia-e commented Apr 28, 2026

This definitely requires signoff from lang, but if they are willing to preserve MaybeDangling or similar semantics into the future we're happy making the API guarantee on the libs-api side per today's meeting ^^

@nia-e nia-e removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Apr 28, 2026
@traviscross traviscross added P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang T-lang Relevant to the language team T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. labels Apr 29, 2026
@traviscross
Copy link
Copy Markdown
Contributor

Thanks @WaffleLapkin. Sounds right to me. This is a kind of partial stabilization of RFC 3336.

@rfcbot fcp merge libs-api

@rust-rfcbot

This comment was marked as outdated.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 29, 2026
@traviscross

This comment was marked as outdated.

@rust-rfcbot

This comment was marked as outdated.

@rust-rfcbot rust-rfcbot removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 29, 2026
@traviscross
Copy link
Copy Markdown
Contributor

@rfcbot fcp merge lang,libs-api

@rust-rfcbot
Copy link
Copy Markdown
Collaborator

rust-rfcbot commented Apr 29, 2026

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 29, 2026
@RalfJung
Copy link
Copy Markdown
Member

This is a kind of partial stabilization of RFC 3336.

Exactly. It stabilizes the ManuallyDrop effects described there, without (for now) making those effects available as their own type.

@tmandry
Copy link
Copy Markdown
Member

tmandry commented Apr 29, 2026

Hypothetically, someone might want ManuallyDrop without MaybeDangling for optimization purposes, but that is less important than making more uses of ManuallyDrop sound. We can expose a more fundamental feature in the future that one could use to implement ManuallyDrop; see e.g. the proposals in https://rust-lang.github.io/rust-project-goals/2026/manually-drop-attr.html.

@rfcbot reviewed

Comment thread library/core/src/mem/manually_drop.rs Outdated
@WaffleLapkin WaffleLapkin added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 1, 2026
@WaffleLapkin WaffleLapkin force-pushed the manually-drop-unbox branch from 8520b8e to 10eb877 Compare May 1, 2026 10:45
@WaffleLapkin WaffleLapkin added the relnotes Marks issues that should be documented in the release notes of the next release. label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-lang Relevant to the language team T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants