Rename, clarify, and document code for "erasing" query values#151565
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Jan 29, 2026
Merged
Rename, clarify, and document code for "erasing" query values#151565rust-bors[bot] merged 1 commit intorust-lang:mainfrom
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
Zalathar
commented
Jan 24, 2026
deltragon
reviewed
Jan 24, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
zetanumbers
suggested changes
Jan 26, 2026
This comment has been minimized.
This comment has been minimized.
Member
Author
|
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.
Zoxc
reviewed
Jan 28, 2026
This comment has been minimized.
This comment has been minimized.
Member
Author
|
This comment has been minimized.
This comment has been minimized.
Collaborator
|
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. |
Member
Author
|
@rustbot ready |
Contributor
|
@bors r+ |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Jan 29, 2026
…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`)
rust-timer
added a commit
that referenced
this pull request
Jan 29, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.