Skip to content

Commit 92a0cbd

Browse files
committed
Remove Compiler::compile().
`Compiler::compile()` is different to all the other `Compiler` methods because it lacks a `Queries` entry. It only has one call site, which is in a test that doesn't need its specific characteristics. This patch removes `Compile::compile()` and replaces the call to it in the test with a call to `Compile::codegen_and_link()`, which is similar enough for the test's purposes.
1 parent df952ca commit 92a0cbd

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

src/librustc_interface/queries.rs

+3-20
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ use crate::interface::{Compiler, Result};
22
use crate::passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo};
33

44
use rustc_incremental::DepGraphFuture;
5-
use rustc::session::config::{OutputFilenames, OutputType};
5+
use rustc::session::config::OutputFilenames;
66
use rustc::util::common::{time, ErrorReported};
77
use rustc::hir;
88
use rustc::hir::def_id::LOCAL_CRATE;
99
use rustc::ty::steal::Steal;
1010
use rustc::dep_graph::DepGraph;
11+
use std::any::Any;
1112
use std::cell::{Ref, RefMut, RefCell};
13+
use std::mem;
1214
use std::rc::Rc;
1315
use std::sync::mpsc;
14-
use std::any::Any;
15-
use std::mem;
1616
use syntax::{self, ast};
1717

1818
/// Represent the result of a query.
@@ -268,21 +268,4 @@ impl Compiler {
268268
Ok(())
269269
})
270270
}
271-
272-
pub fn compile(&self) -> Result<()> {
273-
self.prepare_outputs()?;
274-
275-
if self.session().opts.output_types.contains_key(&OutputType::DepInfo)
276-
&& self.session().opts.output_types.len() == 1
277-
{
278-
return Ok(())
279-
}
280-
281-
self.global_ctxt()?;
282-
283-
// Drop AST after creating GlobalCtxt to free memory
284-
mem::drop(self.expansion()?.take());
285-
286-
self.codegen_and_link().map(|_| ())
287-
}
288271
}

src/test/run-make-fulldeps/issue-19371/foo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
6262
};
6363

6464
interface::run_compiler(config, |compiler| {
65-
compiler.compile().ok();
65+
compiler.codegen_and_link().ok();
6666
});
6767
}

0 commit comments

Comments
 (0)