-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc crash when proc macro panics if compiled with -Cpanic=abort
#82320
Comments
By the way, passing
|
Avoids the rust-lang/rust#82320 rustc crash. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Issue: rust-lang/rust#82320
@rustbot label: +I-crash, -I-ICE |
-Cpanic=abort
-Cpanic=abort
It might be possible to improve the error message here. However, proc macros are loaded into the compiler process via a shared library, so there's no way for us to 'catch' the abort panic without running proc macros in another process. |
We could make the proc macros' panic-abort not actually abort the process, communicating they are "dead" instead to the host process. A user passing |
For context: I ended up seeing this because I used a set of flags which I passed to both rlibs and proc-macros in a custom build system. It was definitely not my intention crashing |
Proc-macros are run as part of the host process on the main compilation thread. Without I think there are only two possible solutions: Ignore/warn on |
…eholk Warn when using panic-strategy abort for proc-macro crates See rust-lang#82320, this simply warns for now as that seems like the best step that can be immediately taken (opposed to straight up rejecting or ignoring)
…eholk Warn when using panic-strategy abort for proc-macro crates See rust-lang#82320, this simply warns for now as that seems like the best step that can be immediately taken (opposed to straight up rejecting or ignoring)
…eholk Warn when using panic-strategy abort for proc-macro crates See rust-lang#82320, this simply warns for now as that seems like the best step that can be immediately taken (opposed to straight up rejecting or ignoring)
@Veykril implemented a warning, so I think this can be closed since it was one of the alternatives. |
Code
Panicking proc macro
p.rs
:User
m.rs
:Then:
Meta
Reproduces in 1.49.0, 1.50.0 as well as nightlies.
Error output
Depends on how the proc macro is compiled. It can range from some output:
To nothing at all:
The text was updated successfully, but these errors were encountered: