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).