-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
RFC: Limit what types can have destructors #4301
Comments
I vote for trying the "extreme" rule first (destructors can only access owned memory), and loosening it if it turns out to be too restrictive in practice. |
Note that I think this kills the |
Yes, I think the extended version we talked about was somehow limiting non-sendable types with dtors from being placed into |
Can this be closed given d4fee24? |
Yes. |
We need some limits on destructors to prevent bugs like bugs like #3167, #3039, #4170. Also to address the various challenges of destructors and finalizers that have been uncovered in other languages.
My current preference is to say that destructors can only be created for sendable types. Or, put another way, destructors should only be able to access owned content. Perhaps this is too extreme, but it's a nice simple rule.
Anyway, I wanted to open a blanket bug for those other bugs, and perhaps to spark some discussion and thought.
The text was updated successfully, but these errors were encountered: