Tracking Issue for const_destruct · Issue #133214 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@compiler-errors

Description

@compiler-errors

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

Unresolved Questions

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.

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html