-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Rename, clarify, and document code for "erasing" query values #151565
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
Conversation
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find these changes to be useful or clarifying.
This comment has been minimized.
This comment has been minimized.
|
Addressed some feedback and added a few more comments and FIXMEs (diff) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
|
@bors r+ |
…uwer Rollup of 8 pull requests Successful merges: - #147387 (hir_owner_parent optimized to inlined call for non-incremental build) - #150271 (Move struct placeholder pt2) - #151283 (Suggest ignore returning value inside macro for unused_must_use lint) - #151565 (Rename, clarify, and document code for "erasing" query values) - #149482 (thread::scope: document how join interacts with TLS destructors) - #151827 (Use `Rustc` prefix for `rustc` attrs in `AttributeKind`) - #151833 (Treat unions as 'data types' in attr parsing diagnostics) - #151834 (Update `askama` version to `0.15.4`)
Rollup merge of #151565 - Zalathar:erase, r=petrochenkov Rename, clarify, and document code for "erasing" query values In order to reduce compile times and code size for the compiler itself, the query system has a mechanism for “erasing” and ”restoring” query values in certain contexts. See #109333 for the original implementation. Unfortunately, the erasure system has very little documentation, and involves a dizzying assortment of similarly-named types, traits, and functions. This PR therefore renames several parts of the erasure API and implementation to hopefully be clearer, and adds comments to better explain the purpose and mechanism behind value erasure. Summary of renames: - fn `erase` → `erase_val` (avoiding ambiguity with module `erase`) - fn `restore` → `restore_val` - type `Erase<T>` → `Erased<T>` (for actual erased values of `T`) - trait `EraseType` → `Erasable` (for types that can be erased and restored) - associated type `EraseType::Result` → `Erasable::Storage` - implementation-detail struct `Erased<T>` → `ErasedData<Storage>` There should be no change to compiler behaviour.
In order to reduce compile times and code size for the compiler itself, the query system has a mechanism for “erasing” and ”restoring” query values in certain contexts. See #109333 for the original implementation.
Unfortunately, the erasure system has very little documentation, and involves a dizzying assortment of similarly-named types, traits, and functions.
This PR therefore renames several parts of the erasure API and implementation to hopefully be clearer, and adds comments to better explain the purpose and mechanism behind value erasure.
Summary of renames:
erase→erase_val(avoiding ambiguity with moduleerase)restore→restore_valErase<T>→Erased<T>(for actual erased values ofT)EraseType→Erasable(for types that can be erased and restored)EraseType::Result→Erasable::StorageErased<T>→ErasedData<Storage>There should be no change to compiler behaviour.