E0493 emitted without drop when destructuring #86897
Labels
A-const-fn
Area: const fn foo(..) {..}. Pure functions which can be applied at compile time.
A-destructors
Area: Destructors (`Drop`, …)
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
The current output is:
This error is clearly wrong:
self
is not dropped, as it's been moved out of. In fact, no destructors are run, so this should be able to compile. If it shouldn't compile, the error should be changed to not be incorrect.This seems to be an issue in the drop suppression when moving out field-wise; using e.g.
mem::forget
works to suppress the destructor and allow the function to compile. I was unable to trick the compiler to accept the function withManuallyDrop
, as extracting the wrapped value requires manifesting a wrapper again, which triggers E0493 "destructors cannot be evaluated at compile-time".@rustbot label: +A-const-fn +A-destructors
The text was updated successfully, but these errors were encountered: