diff options
| author | Jing Peng <pj.hades@gmail.com> | 2023-02-26 15:27:27 -0500 |
|---|---|---|
| committer | Jing Peng <pj.hades@gmail.com> | 2023-06-06 17:53:29 -0400 |
| commit | 9b1a1e1d95d1e40bdf57ef9d37ccbac91fc9c280 (patch) | |
| tree | a9dfaf211a9e470ba26b20416916ab214a2be476 /src/doc | |
| parent | 1221e43bdf413f7c405e9b17ef19d76c88222098 (diff) | |
| download | rust-9b1a1e1d95d1e40bdf57ef9d37ccbac91fc9c280.tar.gz rust-9b1a1e1d95d1e40bdf57ef9d37ccbac91fc9c280.zip | |
Write to stdout if `-` is given as output file
If `-o -` or `--emit KIND=-` is provided, output will be written to stdout instead. Binary output (`obj`, `llvm-bc`, `link` and `metadata`) being written this way will result in an error unless stdout is not a tty. Multiple output types going to stdout will trigger an error too, as they will all be mixded together.
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc/src/command-line-arguments.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 3be4382b0a3..2c15d1b1110 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -202,6 +202,12 @@ flag](codegen-options/index.md#extra-filename). The files are written to the current directory unless the [`--out-dir` flag](#option-out-dir) is used. Each emission type may also specify the output filename with the form `KIND=PATH`, which takes precedence over the `-o` flag. +Specifying `-o -` or `--emit KIND=-` asks rustc to emit to stdout. +Text output types (`asm`, `dep-info`, `llvm-ir` and `mir`) can be written to +stdout despite it being a tty or not. This will result in an error if any +binary output type is written to stdout that is a tty. +This will also result in an error if multiple output types +would be written to stdout, because they would be all mixed together. [LLVM bitcode]: https://llvm.org/docs/BitCodeFormat.html [LLVM IR]: https://llvm.org/docs/LangRef.html |
