Tracking Issue for const_destruct
· Issue #133214 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Feature gate: #![feature(const_destruct)]
This is a tracking issue for const_destruct
, which enables the naming of the Destruct
trait and its use in ~const
bounds to allow dropping values in const contexts.
Public API
Steps / History
- Implementation: It was already implemented, but it's getting a new feature gate in Implement ~const Destruct effect goal in the new solver #132329.
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Do we want to allow
~const
bounds onconst Drop
impls?
I think we do, and sorely need them for const drop to ever be useful. See my justification in #132329 (comment). We want to be able to implement a conditional drop impl like:
struct DropAndCall<F: Fn()>(F);
impl const Drop for DropAndCall where F: ~const Fn(), { fn drop(&mut self) { (self.0)(); // This should be allowed. } }
This is what is implemented on nightly.