@@ -213,21 +213,39 @@ The valid emit kinds are:
213
213
` CRATE_NAME.o ` .
214
214
215
215
The output filename can be set with the [ ` -o ` flag] ( #option-o-output ) . A
216
- suffix may be added to the filename with the [ ` -C extra-filename `
217
- flag] ( codegen-options/index.md#extra-filename ) . The files are written to the
218
- current directory unless the [ ` --out-dir ` flag] ( #option-out-dir ) is used. Each
219
- emission type may also specify the output filename with the form ` KIND=PATH ` ,
220
- which takes precedence over the ` -o ` flag.
221
- Specifying ` -o - ` or ` --emit KIND=- ` asks rustc to emit to stdout.
222
- Text output types (` asm ` , ` dep-info ` , ` llvm-ir ` and ` mir ` ) can be written to
223
- stdout despite it being a tty or not. This will result in an error if any
224
- binary output type is written to stdout that is a tty.
225
- This will also result in an error if multiple output types
226
- would be written to stdout, because they would be all mixed together.
216
+ suffix may be added to the filename with the
217
+ [ ` -C extra-filename ` flag] ( codegen-options/index.md#extra-filename ) .
218
+
219
+ Output files are written to the current directory unless the
220
+ [ ` --out-dir ` flag] ( #option-out-dir ) is used.
227
221
228
222
[ LLVM bitcode ] : https://llvm.org/docs/BitCodeFormat.html
229
223
[ LLVM IR ] : https://llvm.org/docs/LangRef.html
230
224
225
+ ### Custom paths for individual emit kinds
226
+
227
+ Each emit type can optionally be followed by ` = ` to specify an explicit output
228
+ path that only applies to the output of that type. For example:
229
+
230
+ - ` --emit=link,dep-info=/path/to/dep-info.d `
231
+ - Emit the crate itself as normal,
232
+ and also emit dependency info to the specified path.
233
+ - ` --emit=llvm-ir=-,mir `
234
+ - Emit MIR to the default filename (based on crate name),
235
+ and emit LLVM IR to stdout.
236
+
237
+ ### Emitting to stdout
238
+
239
+ When using ` --emit ` or [ ` -o ` ] ( #option-o-output ) , output can be sent to stdout
240
+ by specifying ` - ` as the path (e.g. ` -o - ` ).
241
+
242
+ Binary output types can only be written to stdout if it is not a tty.
243
+ Text output types (` asm ` , ` dep-info ` , ` llvm-ir ` and ` mir ` ) can be written to
244
+ stdout regardless of whether it is a tty or not.
245
+
246
+ Only one type of output can be written to stdout. Attempting to write multiple
247
+ types to stdout at the same time will result in an error.
248
+
231
249
<a id =" option-print " ></a >
232
250
## ` --print ` : print compiler information
233
251
0 commit comments