Make def_path_hash_to_def_id not panic when passed an invalid hash#147075
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 28, 2025
Merged
Make def_path_hash_to_def_id not panic when passed an invalid hash#147075bors merged 1 commit intorust-lang:masterfrom
def_path_hash_to_def_id not panic when passed an invalid hash#147075bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
03de83d to
c0e0d4b
Compare
Contributor
|
Seems reasonable considering that |
Collaborator
Contributor
Well, there's always |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Sep 27, 2025
…etrochenkov Make `def_path_hash_to_def_id` not panic when passed an invalid hash I'm using this function in a third-party application (Creusot) to access private items (by reverse engineering their hash). This works in the happy path, but it panics when an item does not exist. There is no way to hack it downstream because the hook `def_path_hash_to_def_id_extern` must always return a `DefId` and its implementation uses `def_path_hash_to_def_index` which is internal and which is where the panic happens.
bors
added a commit
that referenced
this pull request
Sep 27, 2025
Rollup of 9 pull requests Successful merges: - #140482 (std::net: update tcp deferaccept delay type to Duration.) - #146037 (Introduce CoerceShared lang item and trait, and basic Reborrow tests) - #146732 (tests: relax expectations after llvm change 902ddda120a5) - #147018 (re-order normalizations in run-make linker-warning test) - #147032 (Fix doctest compilation time display) - #147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`) - #147050 (PassWrapper: update for new PGOOptions args in LLVM 22) - #147075 (Make `def_path_hash_to_def_id` not panic when passed an invalid hash) - #147076 (update issue number for more_float_constants) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Sep 27, 2025
Rollup of 8 pull requests Successful merges: - #146037 (Introduce CoerceShared lang item and trait, and basic Reborrow tests) - #146732 (tests: relax expectations after llvm change 902ddda120a5) - #147018 (re-order normalizations in run-make linker-warning test) - #147032 (Fix doctest compilation time display) - #147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`) - #147050 (PassWrapper: update for new PGOOptions args in LLVM 22) - #147075 (Make `def_path_hash_to_def_id` not panic when passed an invalid hash) - #147076 (update issue number for more_float_constants) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Sep 28, 2025
Rollup merge of #147075 - Lysxia:no-panic-def-path-hash, r=petrochenkov Make `def_path_hash_to_def_id` not panic when passed an invalid hash I'm using this function in a third-party application (Creusot) to access private items (by reverse engineering their hash). This works in the happy path, but it panics when an item does not exist. There is no way to hack it downstream because the hook `def_path_hash_to_def_id_extern` must always return a `DefId` and its implementation uses `def_path_hash_to_def_index` which is internal and which is where the panic happens.
Member
|
does this mean we can close most of these ice reports? |
Contributor
Author
|
Yeah, that fixes the ice at the |
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.
I'm using this function in a third-party application (Creusot) to access private items (by reverse engineering their hash). This works in the happy path, but it panics when an item does not exist. There is no way to hack it downstream because the hook
def_path_hash_to_def_id_externmust always return aDefIdand its implementation usesdef_path_hash_to_def_indexwhich is internal and which is where the panic happens.