about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_interface/queries.rs9
-rw-r--r--src/test/run-make-fulldeps/issue-19371/foo.rs3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs
index e056d3feb66..ff5cd8b8c69 100644
--- a/src/librustc_interface/queries.rs
+++ b/src/librustc_interface/queries.rs
@@ -275,6 +275,11 @@ impl Compiler {
         })
     }
 
+    // This method is different to all the other methods in `Compiler` because
+    // it lacks a `Queries` entry. It's also not currently used. It does serve
+    // as an example of how `Compiler` can be used, with additional steps added
+    // between some passes. And see `rustc_driver::run_compiler` for a more
+    // complex example.
     pub fn compile(&self) -> Result<()> {
         self.prepare_outputs()?;
 
@@ -286,12 +291,12 @@ impl Compiler {
 
         self.global_ctxt()?;
 
-        // Drop AST after creating GlobalCtxt to free memory
+        // Drop AST after creating GlobalCtxt to free memory.
         mem::drop(self.expansion()?.take());
 
         self.ongoing_codegen()?;
 
-        // Drop GlobalCtxt after starting codegen to free memory
+        // Drop GlobalCtxt after starting codegen to free memory.
         mem::drop(self.global_ctxt()?.take());
 
         self.link().map(|_| ())
diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs
index afc92638fda..e290f7fa6b1 100644
--- a/src/test/run-make-fulldeps/issue-19371/foo.rs
+++ b/src/test/run-make-fulldeps/issue-19371/foo.rs
@@ -62,6 +62,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
     };
 
     interface::run_compiler(config, |compiler| {
-        compiler.compile().ok();
+        // This runs all the passes prior to linking, too.
+        compiler.link().ok();
     });
 }