diff options
| author | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-02-17 16:46:51 +0100 |
|---|---|---|
| committer | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-02-17 16:46:53 +0100 |
| commit | ee064befa06ad54193786c9169672f9349d0bfaf (patch) | |
| tree | 047db13ab08d762806bd433b35bda40612e1b598 | |
| parent | 7ac4154643a952fed1d942adcb78e27b17ad41dd (diff) | |
| download | rust-ee064befa06ad54193786c9169672f9349d0bfaf.tar.gz rust-ee064befa06ad54193786c9169672f9349d0bfaf.zip | |
Ensure diagnostics are printed in the correct order
Even when buffered. Ideally we would flush only when the emitter is done, but that requires larger changes. This gives most of the benefit of buffering in any case.
| -rw-r--r-- | src/librustc_errors/json.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_errors/json.rs b/src/librustc_errors/json.rs index f0cfd815a2c..97b9ca924bb 100644 --- a/src/librustc_errors/json.rs +++ b/src/librustc_errors/json.rs @@ -104,7 +104,8 @@ impl Emitter for JsonEmitter { writeln!(&mut self.dst, "{}", as_pretty_json(&data)) } else { writeln!(&mut self.dst, "{}", as_json(&data)) - }; + } + .and_then(|_| self.dst.flush()); if let Err(e) = result { panic!("failed to print diagnostics: {:?}", e); } @@ -116,7 +117,8 @@ impl Emitter for JsonEmitter { writeln!(&mut self.dst, "{}", as_pretty_json(&data)) } else { writeln!(&mut self.dst, "{}", as_json(&data)) - }; + } + .and_then(|_| self.dst.flush()); if let Err(e) = result { panic!("failed to print notification: {:?}", e); } |
