-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Make def_path_hash_to_def_id
not panic when passed an invalid hash
#147075
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
rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
03de83d
to
c0e0d4b
Compare
Seems reasonable considering that |
Well, there's always |
…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.
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
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
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.
does this mean we can close most of these ice reports? |
Yeah, that fixes the ice at the |
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 aDefId
and its implementation usesdef_path_hash_to_def_index
which is internal and which is where the panic happens.