Skip to content

Commit

Permalink
Remove Compiler::compile().
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
nnethercote committed Sep 1, 2019
1 parent df952ca commit 92a0cbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
23 changes: 3 additions & 20 deletions src/librustc_interface/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ use crate::interface::{Compiler, Result};
use crate::passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo};

use rustc_incremental::DepGraphFuture;
use rustc::session::config::{OutputFilenames, OutputType};
use rustc::session::config::OutputFilenames;
use rustc::util::common::{time, ErrorReported};
use rustc::hir;
use rustc::hir::def_id::LOCAL_CRATE;
use rustc::ty::steal::Steal;
use rustc::dep_graph::DepGraph;
use std::any::Any;
use std::cell::{Ref, RefMut, RefCell};
use std::mem;
use std::rc::Rc;
use std::sync::mpsc;
use std::any::Any;
use std::mem;
use syntax::{self, ast};

/// Represent the result of a query.
Expand Down Expand Up @@ -268,21 +268,4 @@ impl Compiler {
Ok(())
})
}

pub fn compile(&self) -> Result<()> {
self.prepare_outputs()?;

if self.session().opts.output_types.contains_key(&OutputType::DepInfo)
&& self.session().opts.output_types.len() == 1
{
return Ok(())
}

self.global_ctxt()?;

// Drop AST after creating GlobalCtxt to free memory
mem::drop(self.expansion()?.take());

self.codegen_and_link().map(|_| ())
}
}
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/issue-19371/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
};

interface::run_compiler(config, |compiler| {
compiler.compile().ok();
compiler.codegen_and_link().ok();
});
}

0 comments on commit 92a0cbd

Please sign in to comment.