about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back/write.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-04-15 08:26:08 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2019-04-30 08:51:57 +1000
commit7bcb0cffb61d5e1e4fbe08a51d92883556daed04 (patch)
tree5967374e659ac96d365d8d3b381af68ccea38d53 /src/librustc_codegen_ssa/back/write.rs
parent91d5b764ea1e717641b146d5c3169058a18f3919 (diff)
downloadrust-7bcb0cffb61d5e1e4fbe08a51d92883556daed04.tar.gz
rust-7bcb0cffb61d5e1e4fbe08a51d92883556daed04.zip
In JSON output, emit a directive after metadata is generated.
To implement pipelining, Cargo needs to know when metadata generation is
finished. This commit adds code to do that. Unfortunately, metadata file
writing currently occurs very late during compilation, so pipelining
won't produce a speed-up. Moving metadata file writing earlier will be a
follow-up.

The change involves splitting the existing `Emitter::emit` method in
two: `Emitter::emit_diagnostic` and `Emitter::emit_directive`.

The JSON directives look like this:
```
{"directive":"metadata file written: liba.rmeta"}
```
The functionality is behind the `-Z emit-directives` option, and also
requires `--error-format=json`.
Diffstat (limited to 'src/librustc_codegen_ssa/back/write.rs')
-rw-r--r--src/librustc_codegen_ssa/back/write.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs
index 88a5e5a1aec..576bcc8f38e 100644
--- a/src/librustc_codegen_ssa/back/write.rs
+++ b/src/librustc_codegen_ssa/back/write.rs
@@ -1726,7 +1726,7 @@ impl SharedEmitter {
 }
 
 impl Emitter for SharedEmitter {
-    fn emit(&mut self, db: &DiagnosticBuilder<'_>) {
+    fn emit_diagnostic(&mut self, db: &DiagnosticBuilder<'_>) {
         drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
             msg: db.message(),
             code: db.code.clone(),
@@ -1865,7 +1865,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
         self.wait_for_signal_to_codegen_item();
         self.check_for_errors(tcx.sess);
 
-        // These are generally cheap and won't through off scheduling.
+        // These are generally cheap and won't throw off scheduling.
         let cost = 0;
         submit_codegened_module_to_llvm(&self.backend, tcx, module, cost);
     }