-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove Freeze #12683
Comments
Copying tags and labels from #11781. I can mentor. |
cc @flaper87 |
Since I'm working on the |
Some more details and differences from today:
|
I believe that to remain sound we will have to simultaneously change the |
Maybe we should have both a shallow Freeze and a deep Freeze? A deep Freeze trait is essential if one wants to have enforced pure functions (along with a way to dynamically disable TLS and global state). Also, maybe HashMap should require keys to be deeply Freeze, since otherwise their hash might change unexpectedly (theoretically, another kind might be best here, but Freeze should work in practice). But OTOH a shallow Freeze is useful for optimization and allowing to place data in read-only memory. |
If you're not allowed to hide internal mutation as an implementation detail, then reference counting isn't the only thing you're unable to do. You can't use memory allocation at all. There's no working around the fact that |
@thestinger @nikomatsakis's proposed definition (or my interpretation thereof) is fairly narrow. |
What's a use case of Deep immutability seems almost meaningless, as I/O and memory allocation break the invariant. The concept does not exist in GCC or LLVM. It doesn't seem useful for enforcing purity, because the methods would already need to be marked as pure or they might be performing I/O without a handle from the object. |
I think the major one was the initialization of static variables, and the aforementioned optimizations. |
Today we decided to kill Freeze and instead rely on an |
…l, r=Manishearth [`non_canonical_partial_ord_impl`]: Fix emitting warnings which conflict with `needless_return` fixes rust-lang#12683 --- changelog: fix [`non_canonical_partial_ord_impl`] emitting warnings which conflict with `needless_return`
In the discussion on #11781, it has become clear that there is still a role for Freeze, but likely not the Freeze kind we have today. Today Freeze is a property based on reachability, but this should likely change.
See comment here for details:
#11781 (comment)
The text was updated successfully, but these errors were encountered: