Skip to content

core: fix the docs of PanicInfo::location - #162062

Open
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:docs/panic-info-location
Open

core: fix the docs of PanicInfo::location#162062
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:docs/panic-info-location

Conversation

@valentynkit

@valentynkit valentynkit commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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 behavior 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.

Addresses: #128788
@rustbot label +A-docs
r? libs

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.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants