-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
~const Drop
bounds are broken / wrong / unsound
#94803
Comments
FWIW I agree. I brought some of this up in https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.22implicit.22.20const-if-const.20Drop We can't automatically require all generic params to be const droppable, as that would make |
@oli-obk Looking at the linked discussion I don’t see where this brings up the same point. Maybe I’m missing something. In my mind, there should be a trait I.e. for a type with no drop glue at all, the destructor invokes no
The necessary bound for dropping some type Obviously, this approach would also get rid of the limitation under the current rules that Footnotes
|
Rename `~const Drop` to `~const Destruct` r? `@oli-obk` Completely switching to `~const Destructible` would be rather complicated, so it seems best to add it for now and wait for it to be backported to beta in the next release. The rationale is to prevent complications such as rust-lang#92149 and rust-lang#94803 by introducing an entirely new trait. And `~const Destructible` reads a bit better than `~const Drop`. Name Bikesheddable.
Issue seems to be resolved after #94901. |
(playground)
@rustbot label requires-nightly, I-unsound, T-compiler, F-const_trait_impl, A-const-fn
By the way, even if this worked “correctly” (i.e. soundly) I really hate the fact that this feature is using a sort of
T: Drop
bound; thedrop_bounds
warning exists for a reason, using theDrop
trait in bounds is discouraged for a reason, abusing it as in the feature that allows “T: ~const Drop
” makes everything just sooo much more confusing and inconsistent.The text was updated successfully, but these errors were encountered: