Remove the RustcDefaultCalls struct

It is a leftover from before the introduction of rustc_interface
This commit is contained in:
bjorn3 2021-06-25 12:49:29 +02:00
parent 9cdefd763b
commit bb45f5db78

View File

@ -263,7 +263,7 @@ fn run_compiler(
describe_lints(compiler.session(), &lint_store, registered_lints);
return;
}
let should_stop = RustcDefaultCalls::print_crate_info(
let should_stop = print_crate_info(
&***compiler.codegen_backend(),
compiler.session(),
None,
@ -292,7 +292,7 @@ fn run_compiler(
interface::run_compiler(config, |compiler| {
let sess = compiler.session();
let should_stop = RustcDefaultCalls::print_crate_info(
let should_stop = print_crate_info(
&***compiler.codegen_backend(),
sess,
Some(compiler.input()),
@ -301,13 +301,9 @@ fn run_compiler(
compiler.temps_dir(),
)
.and_then(|| {
RustcDefaultCalls::list_metadata(
sess,
&*compiler.codegen_backend().metadata_loader(),
compiler.input(),
)
list_metadata(sess, &*compiler.codegen_backend().metadata_loader(), compiler.input())
})
.and_then(|| RustcDefaultCalls::try_process_rlink(sess, compiler));
.and_then(|| try_process_rlink(sess, compiler));
if should_stop == Compilation::Stop {
return sess.compile_status();
@ -512,10 +508,6 @@ impl Compilation {
}
}
/// CompilerCalls instance for a regular rustc build.
#[derive(Copy, Clone)]
pub struct RustcDefaultCalls;
fn handle_explain(registry: Registry, code: &str, output: ErrorOutputType) {
let upper_cased_code = code.to_ascii_uppercase();
let normalised = if upper_cased_code.starts_with('E') {
@ -588,7 +580,6 @@ fn show_content_with_pager(content: &str) {
}
}
impl RustcDefaultCalls {
pub fn try_process_rlink(sess: &Session, compiler: &interface::Compiler) -> Compilation {
if sess.opts.debugging_opts.link_only {
if let Input::File(file) = compiler.input() {
@ -599,8 +590,7 @@ impl RustcDefaultCalls {
sess.fatal(&format!("failed to read rlink file: {}", err));
});
let mut decoder = rustc_serialize::opaque::Decoder::new(&rlink_data, 0);
let codegen_results: CodegenResults =
rustc_serialize::Decodable::decode(&mut decoder);
let codegen_results: CodegenResults = rustc_serialize::Decodable::decode(&mut decoder);
let result = compiler.codegen_backend().link(sess, codegen_results, &outputs);
abort_on_err(result, sess);
} else {
@ -622,8 +612,7 @@ impl RustcDefaultCalls {
Input::File(ref ifile) => {
let path = &(*ifile);
let mut v = Vec::new();
locator::list_file_metadata(&sess.target, path, metadata_loader, &mut v)
.unwrap();
locator::list_file_metadata(&sess.target, path, metadata_loader, &mut v).unwrap();
println!("{}", String::from_utf8(v).unwrap());
}
Input::Str { .. } => {
@ -667,8 +656,7 @@ impl RustcDefaultCalls {
for req in &sess.opts.prints {
match *req {
TargetList => {
let mut targets =
rustc_target::spec::TARGETS.iter().copied().collect::<Vec<_>>();
let mut targets = rustc_target::spec::TARGETS.iter().copied().collect::<Vec<_>>();
targets.sort_unstable();
println!("{}", targets.join("\n"));
}
@ -744,7 +732,6 @@ impl RustcDefaultCalls {
}
Compilation::Stop
}
}
/// Prints version information
pub fn version(binary: &str, matches: &getopts::Matches) {