-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`PG-const-traitsProject group: Const traitsProject group: Const traitsT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
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
pub trait Destruct { }
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<F> const Drop for DropAndCall<F>
where
F: ~const Fn(),
{
fn drop(&mut self) {
(self.0)(); // This should be allowed.
}
}
This is what is implemented on nightly.
Footnotes
nazar-pc
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`PG-const-traitsProject group: Const traitsProject group: Const traitsT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.