Skip to content

Reflect code renames and API changes in panic docs#2853

Merged
reddevilmidzy merged 1 commit intorust-lang:mainfrom
reddevilmidzy:panic
Apr 24, 2026
Merged

Reflect code renames and API changes in panic docs#2853
reddevilmidzy merged 1 commit intorust-lang:mainfrom
reddevilmidzy:panic

Conversation

@reddevilmidzy
Copy link
Copy Markdown
Member

r? ghost

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Apr 24, 2026
}
```

The special `panic_handler` attribute is resolved via `compiler/rustc_middle/src/middle/lang_items`.
Copy link
Copy Markdown
Member Author

@reddevilmidzy reddevilmidzy Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

through the same process as the `extern { fn panic_impl }` definition in `core`, ending
up with a symbol name of `rust_begin_unwind`. At link time, the symbol reference in `core`
will be resolved to the definition of `std` (the function called `begin_panic_handler` in the
will be resolved to the definition of `std` (the function called `panic_handler` in the
Copy link
Copy Markdown
Member Author

@reddevilmidzy reddevilmidzy Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The special `panic_handler` attribute is resolved via `compiler/rustc_middle/src/middle/lang_items`.
The `extract` function converts the `panic_handler` attribute to a `panic_impl` lang item.
The special `panic_handler` attribute is resolved via [`compiler/rustc_passes/src/lang_items.rs`].
The [`extract_ast`] function converts the `panic_handler` attribute to a `panic_impl` lang item.
Copy link
Copy Markdown
Member Author

@reddevilmidzy reddevilmidzy Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the actual panic-related logic begins. In `library/std/src/panicking.rs`,
control passes to `rust_panic_with_hook`. This method is responsible
This is where the actual panic-related logic begins. In [`library/std/src/panicking.rs`],
control passes to `panic_with_hook`. This method is responsible
Copy link
Copy Markdown
Member Author

@reddevilmidzy reddevilmidzy Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reddevilmidzy reddevilmidzy merged commit 843b603 into rust-lang:main Apr 24, 2026
1 check passed
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Apr 24, 2026
@reddevilmidzy reddevilmidzy deleted the panic branch April 24, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants