Synthetic Partial Drop Glue #585
Labels
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
Uh oh!
There was an error while loading. Please reload this page.
Proposal
Currently
core::mem::drop_in_place
requires types which are fully initialized. Instead of "calling drop glue", the compiler currently synthesizes drop glue every time when a value is dropped. This is obviously inefficient.This MCP proposes allowing
core::mem::drop_in_place
to accept partially-moved-from types, and synthesizing the drop glue as part of monomorphization. (In other words, this requires typestate-based-ish monomorphization, tho we can still use drop flags to pick the correct typestate at runtime.)This MCP also proposes using
core::mem::drop_in_place
inBox::drop
, and taking theDrop for Box
impl out of the compiler.Note: This MCP is not Partially Initialized Types. It's much more lightweight and doesn't require any syntax changes. It also doesn't introduce anything like
DerefMove
.The main benefits of this MCP are:
Drop for Box
just another impl.This would likely make it less error-prone than having this impl in the compiler. (e.g. maybe reduce the likelihood of allocator_api-related ICEs? tho those seem to be mostly fixed by now, so maybe it isn't worth it...)
ref rust-lang/wg-allocators#103
Mentors or Reviewers
If you have a reviewer or mentor in mind for this work, mention then
here. You can put your own name here if you are planning to mentor the
work.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: