Skip to content

Commit

Permalink
Ensure diagnostics are printed in the correct order
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Markus Westerlind committed Feb 17, 2020
1 parent 7ac4154 commit ee064be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_errors/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit ee064be

Please sign in to comment.