From 9b1a1e1d95d1e40bdf57ef9d37ccbac91fc9c280 Mon Sep 17 00:00:00 2001 From: Jing Peng Date: Sun, 26 Feb 2023 15:27:27 -0500 Subject: 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. --- compiler/rustc_interface/src/errors.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/rustc_interface/src/errors.rs') diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs index 0eedee25026..a9ab2720d89 100644 --- a/compiler/rustc_interface/src/errors.rs +++ b/compiler/rustc_interface/src/errors.rs @@ -108,3 +108,7 @@ pub struct IgnoringExtraFilename; #[derive(Diagnostic)] #[diag(interface_ignoring_out_dir)] pub struct IgnoringOutDir; + +#[derive(Diagnostic)] +#[diag(interface_multiple_output_types_to_stdout)] +pub struct MultipleOutputTypesToStdout; -- cgit 1.4.1-3-g733a5