Skip to content

Cannot automatically derive equality for structures implementing the drop trait. #6341

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

Closed
mstewartgallus opened this issue May 8, 2013 · 1 comment

Comments

@mstewartgallus
Copy link
Contributor

In the latest incoming (last commit 270b508) the compiler gives an error when one tries to automatically derive equality for structures implementing the Drop trait. This error is:

error: deconstructing struct not allowed in pattern (it has a destructor)

@huonw
Copy link
Member

huonw commented May 8, 2013

Hm, I caused this, and I know what the problem is (the deriving code performs a match on every argument).

bors added a commit that referenced this issue May 11, 2013
**Caveat**: With the current commit, this check only works for `match`s, the checks (incorrectly) do not run for patterns in `let`s, and invalid/unsafe code compiles.

I don't know how to fix this, I experimented with some things to try to make let patterns and match patterns run on the same code (since this would presumably fix many of the other unsoundness issues of let-patterns, e.g. #6225), but I don't understand enough of the code. (I think I heard someone talking about a fix for `let` being in progress?)

Fixes #6344 and #6341.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants