core: fix the docs of PanicInfo::location - #162062
Open
valentynkit wants to merge 1 commit into
Open
Conversation
After `core::panic::PanicInfo` and `std::panic::PanicHookInfo` were split, the docs for `location` still showed incorrect usage of `std::panic::set_hook` for `core::panic::PanicInfo` location, leftover from before the split. Also notes for location methods of `PanicInfo` and `PanicHookInfo` were updated, explaining that if it is ever changed to return None, it should be addressed where the location is created and where it's unwrapped, to avoid unexpected behaviour when callers may expect to always receive location. For `PanicInfo`, `panic_fmt` builds it, and `panic_handler` unwraps it. For `PanicHookInfo`, `panic_with_hook` builds it, and `default_hook` unwraps it.
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.
After
core::panic::PanicInfoandstd::panic::PanicHookInfowere split, the docs forlocationstill showed incorrect usage ofstd::panic::set_hookforcore::panic::PanicInfolocation, leftover from before the split.Also notes for location methods of
PanicInfoandPanicHookInfowere updated, explaining that if it is ever changed to return None, it should be addressed where the location is created and where it's unwrapped, to avoid unexpected behavior when callers may expect to always receive location.PanicInfo,panic_fmtbuilds it, andpanic_handlerunwraps it.PanicHookInfo,panic_with_hookbuilds it, anddefault_hookunwraps it.Addresses: #128788
@rustbot label +A-docs
r? libs