rustc invocation does not work with panic=abort configurations
Wilfred opened this issue · comments
I have a rust project that contains the following in its Cargo.toml:
# Allow unwinding in functions called from C. See
# https://www.reddit.com/r/rust/comments/565q1f/wrote_a_blogpost_from_my_experiences_the_arduous/d8h053m/
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
The command that gets run is:
$ cargo rustc --lib -- -Z no-trans -Z unstable-options --error-format=json --test
Compiling remacs v0.1.0 (file:///home/wilfred/projects/remacs/rust_src)
{"message":"the linked panic runtime `panic_unwind` is not compiled with this crate's panic strategy `abort`","code":null,"level":"error","spans":[],"children":[],"rendered":null}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":null}
error: Could not compile `remacs`.
To learn more, run the command again with --verbose.
This can't be parsed by flycheck:
Suspicious state from syntax checker rust-cargo: Flycheck checker rust-cargo returned non-zero exit code 101, but its output contained no errors:
When I try the above settings on a test crate, I can indeed reproduce the issue. Thanks for the report 👍
cargo build
reports no error. And removing the --test
flag to cargo rustc
makes the error go away. I don't really understand why rustc reports an error here, but I haven't looked into custom panic handles in Rust.
Regardless, we should be able to report the error as-is in Flycheck. It seems the suspicious state stems from not collecting errors that have empty spans (no filename info).
I've sent a PR which should fix this issue.
Fixed in flycheck/flycheck#1182.