Skip to content

Unhelful error message when proc macro fails #1174

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

Closed
vi opened this issue May 23, 2021 · 4 comments
Closed

Unhelful error message when proc macro fails #1174

vi opened this issue May 23, 2021 · 4 comments
Labels
A-unwind Area: Unwinding

Comments

@vi
Copy link
Contributor

vi commented May 23, 2021

With cargo build --release I get:

error: proc-macro derive panicked
 --> websocat-syncnodes/src/net.rs:2:22
  |
2 | #[derive(Debug,Clone,websocat_derive::WebsocatNode)]
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Set exactly one of official_name or no_class

But when using cg_clif's cargo wrapper, I get:

error: could not compile `websocat-syncnodes`

Caused by:
  process didn't exit successfully: `/home/vi/src/rustc_codegen_cranelift/build/bin/cg_clif --crate-name  ...
@vi
Copy link
Contributor Author

vi commented May 23, 2021

It also shows error: internal compiler error: unexpected panic with an invitation to file a bug when a proc macro panics and the error message is actually visible.

     Running `/home/vi/src/rustc_codegen_cranelift/build/bin/cg_clif --crate-name websocat_basic --edition=2018 websocat-basic/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="fs"' --cfg 'feature="io-std"' --cfg 'feature="net"' --cfg 'feature="process"' --cfg 'feature="race"' -C metadata=89e2211acced995a -C extra-filename=-89e2211acced995a --out-dir /mnt/bkel/vi/code/websocat3/target/debug/deps -C incremental=/mnt/bkel/vi/code/websocat3/target/debug/incremental -L dependency=/mnt/bkel/vi/code/websocat3/target/debug/deps --extern tokio=/mnt/bkel/vi/code/websocat3/target/debug/deps/libtokio-34da4925dae4dbdd.rmeta --extern tracing=/mnt/bkel/vi/code/websocat3/target/debug/deps/libtracing-fbdb7778389c6803.rmeta --extern websocat_api=/mnt/bkel/vi/code/websocat3/target/debug/deps/libwebsocat_api-804d017780e84ed0.rmeta --extern websocat_derive=/mnt/bkel/vi/code/websocat3/target/debug/deps/libwebsocat_derive-df994aa862cead6a.so`
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: MissingField("official_name"), locations: [], span: None }', websocat-derive/src/lib.rs:168:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (3e99439f4 2021-05-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `websocat-basic`

@bjorn3
Copy link
Member

bjorn3 commented May 24, 2021

cg_clif doesn't yet support unwinding on panics and as such the whole rustc process aborts on a panic.

@vi
Copy link
Contributor Author

vi commented May 24, 2021

Maybe some short-term changes can be done easily?

  1. Remove or change "we would appreciate a bug report:", so that would warn about using cg_clif and/or point to this issue tracker, not rust-lang/rust's. Maybe this can even be done in Cargo wrapper shell script, not from within cg_clif.
  2. Make it output longer error message (like in the second comment), not just error: could not compile crate-name (like in the first one)

@bjorn3
Copy link
Member

bjorn3 commented May 24, 2021

rust-lang/rust#85640 will change the bug report url to cg_clif's issue tracker. As for the second point I am not sure why it doesn't show anything other than that compilation failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-unwind Area: Unwinding
Projects
None yet
Development

No branches or pull requests

2 participants