Jeff Vander Stoep | 956d143 | 2020-09-18 13:46:24 +0200 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: cargo-check |
| 3 | .\" Author: [see the "AUTHOR(S)" section] |
| 4 | .\" Generator: Asciidoctor 2.0.10 |
| 5 | .\" Date: 2019-09-05 |
| 6 | .\" Manual: \ \& |
| 7 | .\" Source: \ \& |
| 8 | .\" Language: English |
| 9 | .\" |
| 10 | .TH "CARGO\-CHECK" "1" "2019-09-05" "\ \&" "\ \&" |
| 11 | .ie \n(.g .ds Aq \(aq |
| 12 | .el .ds Aq ' |
| 13 | .ss \n[.ss] 0 |
| 14 | .nh |
| 15 | .ad l |
| 16 | .de URL |
| 17 | \fI\\$2\fP <\\$1>\\$3 |
| 18 | .. |
| 19 | .als MTO URL |
| 20 | .if \n[.g] \{\ |
| 21 | . mso www.tmac |
| 22 | . am URL |
| 23 | . ad l |
| 24 | . . |
| 25 | . am MTO |
| 26 | . ad l |
| 27 | . . |
| 28 | . LINKSTYLE blue R < > |
| 29 | .\} |
| 30 | .SH "NAME" |
| 31 | cargo\-check \- Check the current package |
| 32 | .SH "SYNOPSIS" |
| 33 | .sp |
| 34 | \fBcargo check [\fIOPTIONS\fP]\fP |
| 35 | .SH "DESCRIPTION" |
| 36 | .sp |
| 37 | Check a local package and all of its dependencies for errors. This will |
| 38 | essentially compile the packages without performing the final step of code |
| 39 | generation, which is faster than running \fBcargo build\fP. The compiler will save |
| 40 | metadata files to disk so that future runs will reuse them if the source has |
| 41 | not been modified. |
| 42 | .SH "OPTIONS" |
| 43 | .SS "Package Selection" |
| 44 | .sp |
| 45 | By default, when no package selection options are given, the packages selected |
| 46 | depend on the selected manifest file (based on the current working directory if |
| 47 | \fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then |
| 48 | the workspaces default members are selected, otherwise only the package defined |
| 49 | by the manifest will be selected. |
| 50 | .sp |
| 51 | The default members of a workspace can be set explicitly with the |
| 52 | \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a |
| 53 | virtual workspace will include all workspace members (equivalent to passing |
| 54 | \fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. |
| 55 | .sp |
| 56 | \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... |
| 57 | .RS 4 |
| 58 | Check only the specified packages. See \fBcargo\-pkgid\fP(1) for the |
| 59 | SPEC format. This flag may be specified multiple times. |
| 60 | .RE |
| 61 | .sp |
| 62 | \fB\-\-workspace\fP |
| 63 | .RS 4 |
| 64 | Check all members in the workspace. |
| 65 | .RE |
| 66 | .sp |
| 67 | \fB\-\-all\fP |
| 68 | .RS 4 |
| 69 | Deprecated alias for \fB\-\-workspace\fP. |
| 70 | .RE |
| 71 | .sp |
| 72 | \fB\-\-exclude\fP \fISPEC\fP... |
| 73 | .RS 4 |
| 74 | Exclude the specified packages. Must be used in conjunction with the |
| 75 | \fB\-\-workspace\fP flag. This flag may be specified multiple times. |
| 76 | .RE |
| 77 | .SS "Target Selection" |
| 78 | .sp |
| 79 | When no target selection options are given, \fBcargo check\fP will check all |
| 80 | binary and library targets of the selected packages. Binaries are skipped if |
| 81 | they have \fBrequired\-features\fP that are missing. |
| 82 | .sp |
| 83 | Passing target selection flags will check only the |
| 84 | specified targets. |
| 85 | .sp |
| 86 | \fB\-\-lib\fP |
| 87 | .RS 4 |
| 88 | Check the package\(cqs library. |
| 89 | .RE |
| 90 | .sp |
| 91 | \fB\-\-bin\fP \fINAME\fP... |
| 92 | .RS 4 |
| 93 | Check the specified binary. This flag may be specified multiple times. |
| 94 | .RE |
| 95 | .sp |
| 96 | \fB\-\-bins\fP |
| 97 | .RS 4 |
| 98 | Check all binary targets. |
| 99 | .RE |
| 100 | .sp |
| 101 | \fB\-\-example\fP \fINAME\fP... |
| 102 | .RS 4 |
| 103 | Check the specified example. This flag may be specified multiple times. |
| 104 | .RE |
| 105 | .sp |
| 106 | \fB\-\-examples\fP |
| 107 | .RS 4 |
| 108 | Check all example targets. |
| 109 | .RE |
| 110 | .sp |
| 111 | \fB\-\-test\fP \fINAME\fP... |
| 112 | .RS 4 |
| 113 | Check the specified integration test. This flag may be specified multiple |
| 114 | times. |
| 115 | .RE |
| 116 | .sp |
| 117 | \fB\-\-tests\fP |
| 118 | .RS 4 |
| 119 | Check all targets in test mode that have the \fBtest = true\fP manifest |
| 120 | flag set. By default this includes the library and binaries built as |
| 121 | unittests, and integration tests. Be aware that this will also build any |
| 122 | required dependencies, so the lib target may be built twice (once as a |
| 123 | unittest, and once as a dependency for binaries, integration tests, etc.). |
| 124 | Targets may be enabled or disabled by setting the \fBtest\fP flag in the |
| 125 | manifest settings for the target. |
| 126 | .RE |
| 127 | .sp |
| 128 | \fB\-\-bench\fP \fINAME\fP... |
| 129 | .RS 4 |
| 130 | Check the specified benchmark. This flag may be specified multiple times. |
| 131 | .RE |
| 132 | .sp |
| 133 | \fB\-\-benches\fP |
| 134 | .RS 4 |
| 135 | Check all targets in benchmark mode that have the \fBbench = true\fP |
| 136 | manifest flag set. By default this includes the library and binaries built |
| 137 | as benchmarks, and bench targets. Be aware that this will also build any |
| 138 | required dependencies, so the lib target may be built twice (once as a |
| 139 | benchmark, and once as a dependency for binaries, benchmarks, etc.). |
| 140 | Targets may be enabled or disabled by setting the \fBbench\fP flag in the |
| 141 | manifest settings for the target. |
| 142 | .RE |
| 143 | .sp |
| 144 | \fB\-\-all\-targets\fP |
| 145 | .RS 4 |
| 146 | Check all targets. This is equivalent to specifying \fB\-\-lib \-\-bins |
| 147 | \-\-tests \-\-benches \-\-examples\fP. |
| 148 | .RE |
| 149 | .SS "Feature Selection" |
| 150 | .sp |
| 151 | The feature flags allow you to control the enabled features for the "current" |
| 152 | package. The "current" package is the package in the current directory, or the |
| 153 | one specified in \fB\-\-manifest\-path\fP. If running in the root of a virtual |
| 154 | workspace, then the default features are selected for all workspace members, |
| 155 | or all features if \fB\-\-all\-features\fP is specified. |
| 156 | .sp |
| 157 | When no feature options are given, the \fBdefault\fP feature is activated for |
| 158 | every selected package. |
| 159 | .sp |
| 160 | \fB\-\-features\fP \fIFEATURES\fP |
| 161 | .RS 4 |
| 162 | Space or comma separated list of features to activate. These features only |
| 163 | apply to the current directory\(cqs package. Features of direct dependencies |
| 164 | may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax. This flag may be |
| 165 | specified multiple times, which enables all specified features. |
| 166 | .RE |
| 167 | .sp |
| 168 | \fB\-\-all\-features\fP |
| 169 | .RS 4 |
| 170 | Activate all available features of all selected packages. |
| 171 | .RE |
| 172 | .sp |
| 173 | \fB\-\-no\-default\-features\fP |
| 174 | .RS 4 |
| 175 | Do not activate the \fBdefault\fP feature of the current directory\(cqs |
| 176 | package. |
| 177 | .RE |
| 178 | .SS "Compilation Options" |
| 179 | .sp |
| 180 | \fB\-\-target\fP \fITRIPLE\fP |
| 181 | .RS 4 |
| 182 | Check for the given architecture. The default is the host |
| 183 | architecture. The general format of the triple is |
| 184 | \fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a |
| 185 | list of supported targets. |
| 186 | .sp |
| 187 | This may also be specified with the \fBbuild.target\fP |
| 188 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 189 | .sp |
| 190 | Note that specifying this flag makes Cargo run in a different mode where the |
| 191 | target artifacts are placed in a separate directory. See the |
| 192 | .URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " " |
| 193 | documentation for more details. |
| 194 | .RE |
| 195 | .sp |
| 196 | \fB\-\-release\fP |
| 197 | .RS 4 |
| 198 | Check optimized artifacts with the \fBrelease\fP profile. See the |
| 199 | PROFILES section for details on how this affects profile selection. |
| 200 | .RE |
| 201 | .sp |
| 202 | \fB\-\-profile\fP \fINAME\fP |
| 203 | .RS 4 |
| 204 | Changes check behavior. Currently only \fBtest\fP is |
| 205 | supported, which will check with the |
| 206 | \fB#[cfg(test)]\fP attribute enabled. This is useful to have it |
| 207 | check unit tests which are usually excluded via |
| 208 | the \fBcfg\fP attribute. This does not change the actual profile used. |
| 209 | .RE |
| 210 | .SS "Output Options" |
| 211 | .sp |
| 212 | \fB\-\-target\-dir\fP \fIDIRECTORY\fP |
| 213 | .RS 4 |
| 214 | Directory for all generated artifacts and intermediate files. May also be |
| 215 | specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the |
| 216 | \fBbuild.target\-dir\fP \c |
| 217 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 218 | Defaults |
| 219 | to \fBtarget\fP in the root of the workspace. |
| 220 | .RE |
| 221 | .SS "Display Options" |
| 222 | .sp |
| 223 | \fB\-v\fP, \fB\-\-verbose\fP |
| 224 | .RS 4 |
| 225 | Use verbose output. May be specified twice for "very verbose" output which |
| 226 | includes extra output such as dependency warnings and build script output. |
| 227 | May also be specified with the \fBterm.verbose\fP |
| 228 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 229 | .RE |
| 230 | .sp |
| 231 | \fB\-q\fP, \fB\-\-quiet\fP |
| 232 | .RS 4 |
| 233 | No output printed to stdout. |
| 234 | .RE |
| 235 | .sp |
| 236 | \fB\-\-color\fP \fIWHEN\fP |
| 237 | .RS 4 |
| 238 | Control when colored output is used. Valid values: |
| 239 | .sp |
| 240 | .RS 4 |
| 241 | .ie n \{\ |
| 242 | \h'-04'\(bu\h'+03'\c |
| 243 | .\} |
| 244 | .el \{\ |
| 245 | . sp -1 |
| 246 | . IP \(bu 2.3 |
| 247 | .\} |
| 248 | \fBauto\fP (default): Automatically detect if color support is available on the |
| 249 | terminal. |
| 250 | .RE |
| 251 | .sp |
| 252 | .RS 4 |
| 253 | .ie n \{\ |
| 254 | \h'-04'\(bu\h'+03'\c |
| 255 | .\} |
| 256 | .el \{\ |
| 257 | . sp -1 |
| 258 | . IP \(bu 2.3 |
| 259 | .\} |
| 260 | \fBalways\fP: Always display colors. |
| 261 | .RE |
| 262 | .sp |
| 263 | .RS 4 |
| 264 | .ie n \{\ |
| 265 | \h'-04'\(bu\h'+03'\c |
| 266 | .\} |
| 267 | .el \{\ |
| 268 | . sp -1 |
| 269 | . IP \(bu 2.3 |
| 270 | .\} |
| 271 | \fBnever\fP: Never display colors. |
| 272 | .RE |
| 273 | .sp |
| 274 | May also be specified with the \fBterm.color\fP |
| 275 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 276 | .RE |
| 277 | .sp |
| 278 | \fB\-\-message\-format\fP \fIFMT\fP |
| 279 | .RS 4 |
| 280 | The output format for diagnostic messages. Can be specified multiple times |
| 281 | and consists of comma\-separated values. Valid values: |
| 282 | .sp |
| 283 | .RS 4 |
| 284 | .ie n \{\ |
| 285 | \h'-04'\(bu\h'+03'\c |
| 286 | .\} |
| 287 | .el \{\ |
| 288 | . sp -1 |
| 289 | . IP \(bu 2.3 |
| 290 | .\} |
| 291 | \fBhuman\fP (default): Display in a human\-readable text format. |
| 292 | .RE |
| 293 | .sp |
| 294 | .RS 4 |
| 295 | .ie n \{\ |
| 296 | \h'-04'\(bu\h'+03'\c |
| 297 | .\} |
| 298 | .el \{\ |
| 299 | . sp -1 |
| 300 | . IP \(bu 2.3 |
| 301 | .\} |
| 302 | \fBshort\fP: Emit shorter, human\-readable text messages. |
| 303 | .RE |
| 304 | .sp |
| 305 | .RS 4 |
| 306 | .ie n \{\ |
| 307 | \h'-04'\(bu\h'+03'\c |
| 308 | .\} |
| 309 | .el \{\ |
| 310 | . sp -1 |
| 311 | . IP \(bu 2.3 |
| 312 | .\} |
| 313 | \fBjson\fP: Emit JSON messages to stdout. See |
| 314 | \c |
| 315 | .URL "https://doc.rust\-lang.org/cargo/reference/external\-tools.html#json\-messages" "the reference" |
| 316 | for more details. |
| 317 | .RE |
| 318 | .sp |
| 319 | .RS 4 |
| 320 | .ie n \{\ |
| 321 | \h'-04'\(bu\h'+03'\c |
| 322 | .\} |
| 323 | .el \{\ |
| 324 | . sp -1 |
| 325 | . IP \(bu 2.3 |
| 326 | .\} |
| 327 | \fBjson\-diagnostic\-short\fP: Ensure the \fBrendered\fP field of JSON messages contains |
| 328 | the "short" rendering from rustc. |
| 329 | .RE |
| 330 | .sp |
| 331 | .RS 4 |
| 332 | .ie n \{\ |
| 333 | \h'-04'\(bu\h'+03'\c |
| 334 | .\} |
| 335 | .el \{\ |
| 336 | . sp -1 |
| 337 | . IP \(bu 2.3 |
| 338 | .\} |
| 339 | \fBjson\-diagnostic\-rendered\-ansi\fP: Ensure the \fBrendered\fP field of JSON messages |
| 340 | contains embedded ANSI color codes for respecting rustc\(cqs default color |
| 341 | scheme. |
| 342 | .RE |
| 343 | .sp |
| 344 | .RS 4 |
| 345 | .ie n \{\ |
| 346 | \h'-04'\(bu\h'+03'\c |
| 347 | .\} |
| 348 | .el \{\ |
| 349 | . sp -1 |
| 350 | . IP \(bu 2.3 |
| 351 | .\} |
| 352 | \fBjson\-render\-diagnostics\fP: Instruct Cargo to not include rustc diagnostics in |
| 353 | in JSON messages printed, but instead Cargo itself should render the |
| 354 | JSON diagnostics coming from rustc. Cargo\(cqs own JSON diagnostics and others |
| 355 | coming from rustc are still emitted. |
| 356 | .RE |
| 357 | .RE |
| 358 | .SS "Manifest Options" |
| 359 | .sp |
| 360 | \fB\-\-manifest\-path\fP \fIPATH\fP |
| 361 | .RS 4 |
| 362 | Path to the \fBCargo.toml\fP file. By default, Cargo searches for the |
| 363 | \fBCargo.toml\fP file in the current directory or any parent directory. |
| 364 | .RE |
| 365 | .sp |
| 366 | \fB\-\-frozen\fP, \fB\-\-locked\fP |
| 367 | .RS 4 |
| 368 | Either of these flags requires that the \fBCargo.lock\fP file is |
| 369 | up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will |
| 370 | exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from |
| 371 | attempting to access the network to determine if it is out\-of\-date. |
| 372 | .sp |
| 373 | These may be used in environments where you want to assert that the |
| 374 | \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network |
| 375 | access. |
| 376 | .RE |
| 377 | .sp |
| 378 | \fB\-\-offline\fP |
| 379 | .RS 4 |
| 380 | Prevents Cargo from accessing the network for any reason. Without this |
| 381 | flag, Cargo will stop with an error if it needs to access the network and |
| 382 | the network is not available. With this flag, Cargo will attempt to |
| 383 | proceed without the network if possible. |
| 384 | .sp |
| 385 | Beware that this may result in different dependency resolution than online |
| 386 | mode. Cargo will restrict itself to crates that are downloaded locally, even |
| 387 | if there might be a newer version as indicated in the local copy of the index. |
| 388 | See the \fBcargo\-fetch\fP(1) command to download dependencies before going |
| 389 | offline. |
| 390 | .sp |
| 391 | May also be specified with the \fBnet.offline\fP \c |
| 392 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 393 | .RE |
| 394 | .SS "Common Options" |
| 395 | .sp |
| 396 | \fB+TOOLCHAIN\fP |
| 397 | .RS 4 |
| 398 | If Cargo has been installed with rustup, and the first argument to \fBcargo\fP |
| 399 | begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such |
| 400 | as \fB+stable\fP or \fB+nightly\fP). |
| 401 | See the \c |
| 402 | .URL "https://github.com/rust\-lang/rustup/" "rustup documentation" |
| 403 | for more information about how toolchain overrides work. |
| 404 | .RE |
| 405 | .sp |
| 406 | \fB\-h\fP, \fB\-\-help\fP |
| 407 | .RS 4 |
| 408 | Prints help information. |
| 409 | .RE |
| 410 | .sp |
| 411 | \fB\-Z\fP \fIFLAG\fP... |
| 412 | .RS 4 |
| 413 | Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for |
| 414 | details. |
| 415 | .RE |
| 416 | .SS "Miscellaneous Options" |
| 417 | .sp |
| 418 | \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP |
| 419 | .RS 4 |
| 420 | Number of parallel jobs to run. May also be specified with the |
| 421 | \fBbuild.jobs\fP \c |
| 422 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 423 | Defaults to |
| 424 | the number of CPUs. |
| 425 | .RE |
| 426 | .SH "PROFILES" |
| 427 | .sp |
| 428 | Profiles may be used to configure compiler options such as optimization levels |
| 429 | and debug settings. See |
| 430 | \c |
| 431 | .URL "https://doc.rust\-lang.org/cargo/reference/profiles.html" "the reference" |
| 432 | for more details. |
| 433 | .sp |
| 434 | Profile selection depends on the target and crate being built. By default the |
| 435 | \fBdev\fP or \fBtest\fP profiles are used. If the \fB\-\-release\fP flag is given, then the |
| 436 | \fBrelease\fP or \fBbench\fP profiles are used. |
| 437 | .TS |
| 438 | allbox tab(:); |
| 439 | lt lt lt. |
| 440 | T{ |
| 441 | .sp |
| 442 | Target |
| 443 | T}:T{ |
| 444 | .sp |
| 445 | Default Profile |
| 446 | T}:T{ |
| 447 | .sp |
| 448 | \fB\-\-release\fP Profile |
| 449 | T} |
| 450 | T{ |
| 451 | .sp |
| 452 | lib, bin, example |
| 453 | T}:T{ |
| 454 | .sp |
| 455 | \fBdev\fP |
| 456 | T}:T{ |
| 457 | .sp |
| 458 | \fBrelease\fP |
| 459 | T} |
| 460 | T{ |
| 461 | .sp |
| 462 | test, bench, or any target |
| 463 | .br |
| 464 | in "test" or "bench" mode |
| 465 | T}:T{ |
| 466 | .sp |
| 467 | \fBtest\fP |
| 468 | T}:T{ |
| 469 | .sp |
| 470 | \fBbench\fP |
| 471 | T} |
| 472 | .TE |
| 473 | .sp |
| 474 | .sp |
| 475 | Dependencies use the \fBdev\fP/\fBrelease\fP profiles. |
| 476 | .SH "ENVIRONMENT" |
| 477 | .sp |
| 478 | See \c |
| 479 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " " |
| 480 | for |
| 481 | details on environment variables that Cargo reads. |
| 482 | .SH "EXIT STATUS" |
| 483 | .sp |
| 484 | 0 |
| 485 | .RS 4 |
| 486 | Cargo succeeded. |
| 487 | .RE |
| 488 | .sp |
| 489 | 101 |
| 490 | .RS 4 |
| 491 | Cargo failed to complete. |
| 492 | .RE |
| 493 | .SH "EXAMPLES" |
| 494 | .sp |
| 495 | .RS 4 |
| 496 | .ie n \{\ |
| 497 | \h'-04' 1.\h'+01'\c |
| 498 | .\} |
| 499 | .el \{\ |
| 500 | . sp -1 |
| 501 | . IP " 1." 4.2 |
| 502 | .\} |
| 503 | Check the local package for errors: |
| 504 | .sp |
| 505 | .if n .RS 4 |
| 506 | .nf |
| 507 | cargo check |
| 508 | .fi |
| 509 | .if n .RE |
| 510 | .RE |
| 511 | .sp |
| 512 | .RS 4 |
| 513 | .ie n \{\ |
| 514 | \h'-04' 2.\h'+01'\c |
| 515 | .\} |
| 516 | .el \{\ |
| 517 | . sp -1 |
| 518 | . IP " 2." 4.2 |
| 519 | .\} |
| 520 | Check all targets, including unit tests: |
| 521 | .sp |
| 522 | .if n .RS 4 |
| 523 | .nf |
| 524 | cargo check \-\-all\-targets \-\-profile=test |
| 525 | .fi |
| 526 | .if n .RE |
| 527 | .RE |
| 528 | .SH "SEE ALSO" |
| 529 | .sp |
| 530 | \fBcargo\fP(1), \fBcargo\-build\fP(1) |