@@ -11,9 +11,11 @@ If parsing the output with Rust, the
11
11
[ ` cargo_metadata ` ] ( https://crates.io/crates/cargo_metadata ) crate provides
12
12
some support for parsing the messages.
13
13
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.
17
19
18
20
## Diagnostics
19
21
@@ -29,6 +31,8 @@ Diagnostics have the following format:
29
31
30
32
``` javascript
31
33
{
34
+ /* Type of this message */
35
+ " type" : " diagnostic" ,
32
36
/* The primary message. */
33
37
" message" : " unused variable: `x`" ,
34
38
/* The diagnostic code.
@@ -217,6 +221,8 @@ flag][option-emit] documentation.
217
221
218
222
``` javascript
219
223
{
224
+ /* Type of this message */
225
+ " type" : " artifact" ,
220
226
/* The filename that was generated. */
221
227
" artifact" : " libfoo.rlib" ,
222
228
/* 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
239
245
240
246
``` javascript
241
247
{
248
+ /* Type of this message */
249
+ " type" : " future_incompat" ,
242
250
/* An array of objects describing a warning that will become a hard error
243
251
in the future.
244
252
*/
0 commit comments