cargo-msrv 0.19.3

Find your minimum supported Rust version (MSRV)!
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# Output format: json

The `json` output format is intended to be used as a machine-readable output, to be interpreted by tooling, although
humans may also use it, as it provides the most detailed output of all supported output formats.

As described on the [output-formats](index.md) page, `cargo-msrv` reports the status of the program via
events. A processor transforms these events into their output-format. In case of the `json` output format,
events are almost 1-on-1 serialized to json (there are a few exceptions), and then printed to `stderr`.
Each json serialized event ends with a newline. Each line thus represents a single serialized event.

To use the `json` output format, run `cargo-msrv` with the `--output-format json` option.
For example, if you want to find the MSRV, you could run `cargo msrv find --output-format json`.

In the next section, you can find a description of the common fields of events.
The section thereafter gives an overview of each of the supported events, with for each event its event specific fields.

# Events and scope

Cargo MSRV currently reports two types of events: unscoped and scoped events. Unscoped events report about an action
on a certain point in time, while scoped events report about an action which took place over a period of time.

In the context of the `json` output format, an unscoped event will print a single json-line to the stderr, while
a scoped event will print two json-lines to the stderr (one prior to starting the action, and one after the action has
been completed).

# Common fields on events

| name         | optional | values           | description                                                                                                                                                   |
|--------------|----------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| type         | no       |                  | Identifies a specific event.                                                                                                                                  |
| scope        | yes      |                  | A pair of events which mark the start and end of an action. Together these two individual events are called a scoped event.                                   |
| scope.id     | no       |                  | A unique id to match up the two events marking the begin and end of an action. The current incremental nature is an implementation detail and not guaranteed. |
| scope.marker | no       | "start" or "end" | Whether the event marks the beginning or the end of the action                                                                                                |

The **type** field can be used to identify a specific event.

The **scope** field is only present for scoped events. The `start` value (on the `marker` subfield) marks the start of a
scoped event, while `end`
marks the end of a scoped event.

# List of events

## Event: `Meta`

**type:** meta

**description:** Reports metadata about the currently running `cargo-msrv` program instance.

**fields:**

| name           | description                                                                                             |
|----------------|---------------------------------------------------------------------------------------------------------|
| instance       | Name of the running `cargo-msrv` program as defined on compile time. This will usually be `cargo-msrv`. |
| version        | Version of the running `cargo-msrv` program as defined on compile time.                                 |
| sha_short      | Short SHA hash of the git commit used to compile and build `cargo-msrv`.                                |
| target_triple  | Target triple of toolchain used to compile and build `cargo-msrv`.                                      |
| cargo_features | Features which were enabled during the compilation of `cargo-msrv`.                                     |
| rustc          | Version of `rustc` used to compile `cargo-msrv`.                                                        |

**example:**

```json lines
{
  "type": "meta",
  "instance": "cargo-msrv",
  "version": "0.15.1",
  "sha_short": "79582b6",
  "target_triple": "x86_64-pc-windows-msvc",
  "cargo_features": "default,rust_releases_dist_source",
  "rustc": "1.62.0"
}
```

## Event: `FetchIndex`

**type:** fetch_index

**description:** Prior to determining the MSRV of a crate, we have to figure out which Rust versions are available.
We obtain those using the [rust-releases](https://crates.io/crates/rust-releases) library. The `FetchIndex` event
reports that the index is being fetched, and details which source is used.

**fields:**

| name   | description                                               |
|--------|-----------------------------------------------------------|
| source | Place from where the available Rust releases are obtained |

**example:**

```json lines
{
  "type": "fetch_index",
  "source": "rust_changelog",
  "scope": "start"
}
{
  "type": "fetch_index",
  "source": "rust_changelog",
  "scope": "end"
}
```

## Event: `CheckToolchain`

**type:** check_toolchain

**description:** The primary way for `cargo-msrv` to determine whether a given Rust toolchain is compatible with your
crate, is by installing a toolchain and using it to check a crate for compatibility with this toolchain. The
`CheckToolchain` event is wrapped around this process and notifies you about the start and end of this process.
This event is called as a scoped event, and within it's scope, you'll find the following events: `setup_toolchain`,
`check_method` and `check_result`, which are described in more detail below.

**fields:**

| name              | description                              |
|-------------------|------------------------------------------|
| toolchain         | The toolchain to be located or installed |
| toolchain.version | The Rust version of the toolchain        |
| toolchain.target  | The target-triple of the toolchain       |

**example:**

```json lines
{
  "type": "check_toolchain",
  "toolchain": {
    "version": "1.35.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "start"
}
{
  "type": "check_toolchain",
  "toolchain": {
    "version": "1.35.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "end"
}
```

## Event: `SetupToolchain`

**type:** setup_toolchain

**description:** The primary way for `cargo-msrv` to determine whether a given Rust toolchain is compatible with your
crate, is by installing a toolchain and using it to check a crate for compatibility with this toolchain. The
`SetupToolchain` event reports about the process of locating or installing a given toolchain.

**fields:**

| name              | description                              |
|-------------------|------------------------------------------|
| toolchain         | The toolchain to be located or installed |
| toolchain.version | The Rust version of the toolchain        |
| toolchain.target  | The target-triple of the toolchain       |

**example:**

```json lines
{
  "type": "setup_toolchain",
  "toolchain": {
    "version": "1.47.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "start"
}
{
  "type": "setup_toolchain",
  "toolchain": {
    "version": "1.47.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "end"
}
```

## Event: `CheckMethod`

**type:** check_method

**description:** Reports which method has been used to check whether a toolchain is compatible with a crate.

**fields:**

| name              | optional | condition                  | description                                |
|-------------------|----------|----------------------------|--------------------------------------------|
| toolchain         | no       |                            | The toolchain to be located or installed   |
| toolchain.version | no       |                            | The Rust version of the toolchain          |
| toolchain.target  | no       |                            | The target-triple of the toolchain         |
| method            | no       |                            | The method used to check for compatibility |
| method.type       | no       |                            | The type of method                         |
| method.args       | no       | method.type = `rustup_run` | The arguments provided to rustup           |
| method.path       | yes      | method.type = `rustup_run` | The path provided to rustup, if any        |

**example:**

```json lines
{
  "type": "check_method",
  "toolchain": {
    "version": "1.37.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "method": {
    "rustup_run": {
      "args": [
        "1.37.0-x86_64-pc-windows-msvc",
        "cargo",
        "check"
      ],
      "path": "..\\air3\\"
    }
  }
}
```

## Event: `CheckResult`

**type:** check_result

**description:** Reports the result of a `cargo-msrv` compatibility check.

**fields:**

| name              | optional | condition               | description                                           |
|-------------------|----------|-------------------------|-------------------------------------------------------|
| toolchain         | no       |                         | The toolchain to be located or installed              |
| toolchain.version | no       |                         | The Rust version of the toolchain                     |
| toolchain.target  | no       |                         | The target-triple of the toolchain                    |
| is_compatible     | no       |                         | Boolean value stating compatibility                   |
| error             | yes      | is_compatible = `false` | Error message of a failed compatibility check, if any |

**example:**

```json lines
{
  "type": "check_result",
  "toolchain": {
    "version": "1.38.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "is_compatible": true
}
```

```json lines
{
  "type": "check_result",
  "toolchain": {
    "version": "1.37.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "is_compatible": false,
  "error": "error: failed to parse lock file at: .\\air3\\Cargo.lock\n\nCaused by:\ninvalid serialized PackageId for key `package.dependencies`\n"
}
```

## Event: `AuxiliaryOutput`

**type:** auxiliary_output

**description:** Reports about additional output written by `cargo-msrv` when applicable. For example, if the
`--write-msrv` or `--write-toolchain-file` flag is provided, the MSRV will be written to the Cargo manifest or the
Rust toolchain file respectively. The act of writing this (additional) output is reported by this event.

**fields:**

| name             | optional | condition                       | description                                                                                      |
|------------------|----------|---------------------------------|--------------------------------------------------------------------------------------------------|
| destination      | no       |                                 | The destination of the auxiliary output                                                          |
| destination.type | no       |                                 | Type of destination, currently only "file"                                                       |
| destination.path | no       | if destination.type = `file`    | Path of the written or amended file                                                              |
| item             | no       |                                 | What kind of output is written                                                                   |
| item.type        | no       |                                 | Type of output item                                                                              |
| item.kind        | no       | if item.type = `msrv`           | To which field the MSRV was written in the Cargo manifest, "rust-version" or "metadata_fallback" |
| item.kind        | no       | if item.type = `toolchain_file` | Which toolchain file kind was written, "legacy" or "toml"                                        |

**example:**

```json lines
{
  "type": "auxiliary_output",
  "destination": {
    "type": "file",
    "path": "..\\air3\\Cargo.toml"
  },
  "item": {
    "type": "msrv",
    "kind": "rust_version"
  }
}
```

## Event: `Progress`

**type:** progress

**description:** Reports on the progress of an ongoing MSRV search.

**fields:**

| name              | optional | condition | description                                                                                           |
|-------------------|----------|-----------|-------------------------------------------------------------------------------------------------------|
| current           | no       |           | Index of the currently running check into the sorted search space. Starts at `0`.                     |
| search_space_size | no       |           | The size of the search space.                                                                         |
| iteration         | no       |           | How many iterations have been completed, plus one for the currently running iteration. Starts at `1`. |

<!-- Future: add length of reduced set size -->

## Event: `SubcommandInit`

**type:** subcommand_init

**description:** Reports the start of a subcommand flow.

**fields:**

| name          | optional | condition | description                       |
|---------------|----------|-----------|-----------------------------------|
| subcommand_id | no       |           | A name identifying the subcommand |

## Event: `SubcommandResult`

**type:** subcommand_result

**description:** Reports the outcome of a subcommand flow.

**fields:**

| name                     | optional | condition                                                     | description                                                               |
|--------------------------|----------|---------------------------------------------------------------|---------------------------------------------------------------------------|
| subcommand_id            | no       |                                                               | A name identifying the subcommand                                         |
|                          |          |                                                               |                                                                           |
| result                   | no       | subcommand_id = `find`                                        | Result of find command                                                    |
| result.success           | no       | subcommand_id = `find`                                        | Whether the MSRV was found or not                                         |
| result.version           | no       | subcommand_id = `find` and result.success = `true`            | The Minimum Supported Rust Version (MSRV)                                 |
|                          |          |                                                               |                                                                           |
| result                   | no       | subcommand_id = `list`                                        | Result of list command                                                    |
| result.variant           | no       | subcommand_id = `list`                                        | Type of list output. Either `direct-deps` or `ordered-by-msrv`.           |
| result.list              | no       | subcommand_id = `list` and result.variant = `direct-deps`     | List of direct dependencies of the selected crate                         |
| result.list.name         | no       | subcommand_id = `list` and result.variant = `direct-deps`     | Name of the crate                                                         |
| result.list.version      | no       | subcommand_id = `list` and result.variant = `direct-deps`     | Version of the crate                                                      |
| result.list.msrv         | no       | subcommand_id = `list` and result.variant = `direct-deps`     | MSRV of the crate if any, `null` if the MSRV is not set                   |
| result.list.dependencies | no       | subcommand_id = `list` and result.variant = `direct-deps`     | Dependencies of the given crate, relevant for the MSRV                    |
| result.list              | no       | subcommand_id = `list` and result.variant = `ordered-by-msrv` | List of all dependencies relevant for the MSRV, categorised by their MSRV |
| result.list.msrv         | no       | subcommand_id = `list` and result.variant = `ordered-by-msrv` | A value for the MSRV specified by at least one crate                      |
| result.list.dependencies | no       | subcommand_id = `list` and result.variant = `ordered-by-msrv` | List of dependencies which specified the same value for the MSRV          |
|                          |          |                                                               |                                                                           |
| result                   | no       | subcommand_id = `set`                                         | Result of set command                                                     |
| result.version           | no       | subcommand_id = `set`                                         | Which version was set as MSRV                                             |
| result.manifest_path     | no       | subcommand_id = `set`                                         | Relative path of file where the MSRV was written to                       |
|                          |          |                                                               |                                                                           |
| result                   | no       | subcommand_id = `show`                                        | Result of show command                                                    |
| result.version           | no       | subcommand_id = `show`                                        | MSRV as set for the given crate                                           |
| result.manifest_path     | no       | subcommand_id = `show`                                        | Relative path of file where the MSRV was read from                        |
|                          |          |                                                               |                                                                           |
| result                   | no       | subcommand_id = `verify`                                      | Result of verify command                                                  ||
| result.toolchain         | no       | subcommand_id = `verify`                                      | The toolchain to be located or installed                                  |
| result.toolchain.version | no       | subcommand_id = `verify`                                      | The Rust version of the verified toolchain                                |
| result.toolchain.target  | no       | subcommand_id = `verify`                                      | The target-triple of the verified toolchain                               |
| result.is_compatible     | no       | subcommand_id = `verify`                                      | Boolean value stating compatibility                                       |
| result.error             | yes      | subcommand_id = `verify` and result.is_compatible = `false`   | Error message of a failed verify check, if any                            |

**example 1: find**

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "find",
  "result": {
    "version": "1.38.0",
    "success": true
  }
}
```

**example 2: list with direct-deps**

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "direct-deps",
    "list": [
      {
        "name": "crossbeam-channel",
        "version": "0.5.4",
        "msrv": "1.36.0",
        "dependencies": [
          "cfg-if",
          "crossbeam-utils",
          "num_cpus",
          "rand",
          "signal-hook"
        ]
      }
    ]
  }
}
```

Formatted:

```json
{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "direct-deps",
    "list": [
      {
        "name": "crossbeam-channel",
        "version": "0.5.4",
        "msrv": "1.36.0",
        "dependencies": [
          "cfg-if",
          "crossbeam-utils",
          "num_cpus",
          "rand",
          "signal-hook"
        ]
      }
    ]
  }
}
```

**example 3: list with ordered-by-msrv**

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "ordered-by-msrv",
    "list": [
      {
        "msrv": "1.38.0",
        "dependencies": [
          "storyteller"
        ]
      },
      {
        "msrv": "1.36.0",
        "dependencies": [
          "crossbeam-channel",
          "crossbeam-utils"
        ]
      },
      {
        "msrv": null,
        "dependencies": [
          "cfg-if",
          "lazy_static"
        ]
      }
    ]
  }
}
```

Formatted:

```json
{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "ordered-by-msrv",
    "list": [
      {
        "msrv": "1.38.0",
        "dependencies": [
          "storyteller"
        ]
      },
      {
        "msrv": "1.36.0",
        "dependencies": [
          "crossbeam-channel",
          "crossbeam-utils"
        ]
      },
      {
        "msrv": null,
        "dependencies": [
          "cfg-if",
          "lazy_static"
        ]
      }
    ]
  }
}
```

**example 5: set**:

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "set",
  "result": {
    "version": "1.38.0",
    "manifest_path": "..\\air3\\Cargo.toml"
  }
}
```

**example 6: show**:

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "show",
  "result": {
    "version": "1.38.0",
    "manifest_path": "..\\air3\\Cargo.toml"
  }
}
```

**example 7: verify**:

```json lines
{
  "type": "subcommand_result",
  "subcommand_id": "verify",
  "result": {
    "toolchain": {
      "version": "1.38.0",
      "target": "x86_64-pc-windows-msvc"
    },
    "is_compatible": true
  }
}
```

## Event: `TerminateWithFailure`

**type:** terminate_with_failure

**description:** Reports about failure which led to program termination with a non-zero exit code.

**fields:**

| name               | optional | description                                                       |
|--------------------|----------|-------------------------------------------------------------------|
| reason             | no       | Reason of failure                                                 |
| reason.description | no       | Describes why cargo-msrv will terminate with a non-zero exit code |

**example:**

```json lines
{
  "type": "terminate_with_failure",
  "reason": {
    "description": "MSRV was not specified in Cargo manifest at '..\\air\\Cargo.toml'"
  }
}
```