Skip to content

Commit

Permalink
Add documentation for -Z terminal-width
Browse files Browse the repository at this point in the history
This commit adds relevant documentation for the `-Z terminal-width`
flag.

Signed-off-by: David Wood <[email protected]>
  • Loading branch information
davidtwco committed Jul 8, 2020
1 parent 6d740aa commit 4177f66
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bin/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Available unstable (nightly-only) flags:
-Z timings -- Display concurrency information
-Z doctest-xcompile -- Compile and run doctests for non-host target using runner config
-Z crate-versions -- Add crate versions to generated docs
-Z terminal-width -- Provide a terminal width to rustc for error truncation
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
);
Expand Down
34 changes: 34 additions & 0 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,37 @@ sysroot. If you are using rustup, this documentation can be installed with
The default value is `"remote"`.

The value may also take a URL for a custom location.

### terminal-width
This feature provides a new flag, `-Z terminal-width`, which is used to pass
a terminal width to `rustc` so that error messages containing long lines
can be intelligently truncated.

For example, passing `-Z terminal-width=20` (an arbitrarily low value) might
produce the following error:

```text
error[E0308]: mismatched types
--> src/main.rs:2:17
|
2 | ..._: () = 42;
| -- ^^ expected `()`, found integer
| |
| expected due to this
error: aborting due to previous error
```

In contrast, without `-Z terminal-width`, the error would look as shown below:

```text
error[E0308]: mismatched types
--> src/main.rs:2:17
|
2 | let _: () = 42;
| -- ^^ expected `()`, found integer
| |
| expected due to this
error: aborting due to previous error
```

0 comments on commit 4177f66

Please sign in to comment.