Do you have a tool which parses error messages?

The Rust compiler can now (well, when the PR lands) emit error and warning messages in JSON format. If you have a tool which parses error messages, you should use this format rather than the human-readable output. It should be more stable in the long run, give you more information, and be easier to handle.

To get errors in this format, use -Zunstable-options --output=json (the option might change name before landing, I’ll update here).

PR: https://github.com/rust-lang/rust/pull/30711

7 Likes

What would be the preferred way to use this option with cargo? Something like this cargo rustc -- -Zunstable-options --output=json ?

Yes, that should work. It will only apply those options to the last crate to be compiled, unfortunately.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.