Remove the RustcDefaultCalls struct
It is a leftover from before the introduction of rustc_interface
This commit is contained in:
parent
9cdefd763b
commit
bb45f5db78
1 changed files with 151 additions and 164 deletions
|
@ -263,7 +263,7 @@ fn run_compiler(
|
||||||
describe_lints(compiler.session(), &lint_store, registered_lints);
|
describe_lints(compiler.session(), &lint_store, registered_lints);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let should_stop = RustcDefaultCalls::print_crate_info(
|
let should_stop = print_crate_info(
|
||||||
&***compiler.codegen_backend(),
|
&***compiler.codegen_backend(),
|
||||||
compiler.session(),
|
compiler.session(),
|
||||||
None,
|
None,
|
||||||
|
@ -292,7 +292,7 @@ fn run_compiler(
|
||||||
|
|
||||||
interface::run_compiler(config, |compiler| {
|
interface::run_compiler(config, |compiler| {
|
||||||
let sess = compiler.session();
|
let sess = compiler.session();
|
||||||
let should_stop = RustcDefaultCalls::print_crate_info(
|
let should_stop = print_crate_info(
|
||||||
&***compiler.codegen_backend(),
|
&***compiler.codegen_backend(),
|
||||||
sess,
|
sess,
|
||||||
Some(compiler.input()),
|
Some(compiler.input()),
|
||||||
|
@ -301,13 +301,9 @@ fn run_compiler(
|
||||||
compiler.temps_dir(),
|
compiler.temps_dir(),
|
||||||
)
|
)
|
||||||
.and_then(|| {
|
.and_then(|| {
|
||||||
RustcDefaultCalls::list_metadata(
|
list_metadata(sess, &*compiler.codegen_backend().metadata_loader(), compiler.input())
|
||||||
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 {
|
if should_stop == Compilation::Stop {
|
||||||
return sess.compile_status();
|
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) {
|
fn handle_explain(registry: Registry, code: &str, output: ErrorOutputType) {
|
||||||
let upper_cased_code = code.to_ascii_uppercase();
|
let upper_cased_code = code.to_ascii_uppercase();
|
||||||
let normalised = if upper_cased_code.starts_with('E') {
|
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 {
|
pub fn try_process_rlink(sess: &Session, compiler: &interface::Compiler) -> Compilation {
|
||||||
if sess.opts.debugging_opts.link_only {
|
if sess.opts.debugging_opts.link_only {
|
||||||
if let Input::File(file) = compiler.input() {
|
if let Input::File(file) = compiler.input() {
|
||||||
|
@ -599,8 +590,7 @@ impl RustcDefaultCalls {
|
||||||
sess.fatal(&format!("failed to read rlink file: {}", err));
|
sess.fatal(&format!("failed to read rlink file: {}", err));
|
||||||
});
|
});
|
||||||
let mut decoder = rustc_serialize::opaque::Decoder::new(&rlink_data, 0);
|
let mut decoder = rustc_serialize::opaque::Decoder::new(&rlink_data, 0);
|
||||||
let codegen_results: CodegenResults =
|
let codegen_results: CodegenResults = rustc_serialize::Decodable::decode(&mut decoder);
|
||||||
rustc_serialize::Decodable::decode(&mut decoder);
|
|
||||||
let result = compiler.codegen_backend().link(sess, codegen_results, &outputs);
|
let result = compiler.codegen_backend().link(sess, codegen_results, &outputs);
|
||||||
abort_on_err(result, sess);
|
abort_on_err(result, sess);
|
||||||
} else {
|
} else {
|
||||||
|
@ -622,8 +612,7 @@ impl RustcDefaultCalls {
|
||||||
Input::File(ref ifile) => {
|
Input::File(ref ifile) => {
|
||||||
let path = &(*ifile);
|
let path = &(*ifile);
|
||||||
let mut v = Vec::new();
|
let mut v = Vec::new();
|
||||||
locator::list_file_metadata(&sess.target, path, metadata_loader, &mut v)
|
locator::list_file_metadata(&sess.target, path, metadata_loader, &mut v).unwrap();
|
||||||
.unwrap();
|
|
||||||
println!("{}", String::from_utf8(v).unwrap());
|
println!("{}", String::from_utf8(v).unwrap());
|
||||||
}
|
}
|
||||||
Input::Str { .. } => {
|
Input::Str { .. } => {
|
||||||
|
@ -667,8 +656,7 @@ impl RustcDefaultCalls {
|
||||||
for req in &sess.opts.prints {
|
for req in &sess.opts.prints {
|
||||||
match *req {
|
match *req {
|
||||||
TargetList => {
|
TargetList => {
|
||||||
let mut targets =
|
let mut targets = rustc_target::spec::TARGETS.iter().copied().collect::<Vec<_>>();
|
||||||
rustc_target::spec::TARGETS.iter().copied().collect::<Vec<_>>();
|
|
||||||
targets.sort_unstable();
|
targets.sort_unstable();
|
||||||
println!("{}", targets.join("\n"));
|
println!("{}", targets.join("\n"));
|
||||||
}
|
}
|
||||||
|
@ -744,7 +732,6 @@ impl RustcDefaultCalls {
|
||||||
}
|
}
|
||||||
Compilation::Stop
|
Compilation::Stop
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Prints version information
|
/// Prints version information
|
||||||
pub fn version(binary: &str, matches: &getopts::Matches) {
|
pub fn version(binary: &str, matches: &getopts::Matches) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue