@@ -11,9 +11,11 @@ If parsing the output with Rust, the
1111[ ` cargo_metadata ` ] ( https://crates.io/crates/cargo_metadata ) crate provides
1212some support for parsing the messages.
1313
14- When parsing, care should be taken to be forwards-compatible with future changes
15- to the format. Optional values may be ` null ` . New fields may be added. Enumerated
16- fields like "level" or "suggestion_applicability" may add new values.
14+ Each type of message has a ` type ` field which can be used to distinguish the
15+ different formats. When parsing, care should be taken to be forwards-compatible
16+ with future changes to the format. Optional values may be ` null ` . New fields may
17+ be added. Enumerated fields like "level" or "suggestion_applicability" may add
18+ new values.
1719
1820## Diagnostics
1921
@@ -29,6 +31,8 @@ Diagnostics have the following format:
2931
3032``` javascript
3133{
34+ /* Type of this message */
35+ " type" : " diagnostic" ,
3236 /* The primary message. */
3337 " message" : " unused variable: `x`" ,
3438 /* The diagnostic code.
@@ -217,6 +221,8 @@ flag][option-emit] documentation.
217221
218222``` javascript
219223{
224+ /* Type of this message */
225+ " type" : " artifact" ,
220226 /* The filename that was generated. */
221227 " artifact" : " libfoo.rlib" ,
222228 /* The kind of artifact that was generated. Possible values:
@@ -239,6 +245,8 @@ information, even if the diagnostics have been suppressed (such as with an
239245
240246``` javascript
241247{
248+ /* Type of this message */
249+ " type" : " future_incompat" ,
242250 /* An array of objects describing a warning that will become a hard error
243251 in the future.
244252 */
0 commit comments