Skip to content

Commit

Permalink
Remove some unused return values.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Apr 25, 2019
1 parent 68f5101 commit 91d5b76
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions src/librustc_codegen_ssa/back/link.rs
Expand Up @@ -46,11 +46,10 @@ pub fn remove(sess: &Session, path: &Path) {
/// Performs the linkage portion of the compilation phase. This will generate all
/// of the requested outputs for this compilation session.
pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
codegen_results: &CodegenResults,
outputs: &OutputFilenames,
crate_name: &str,
target_cpu: &str) -> Vec<PathBuf> {
let mut out_filenames = Vec::new();
codegen_results: &CodegenResults,
outputs: &OutputFilenames,
crate_name: &str,
target_cpu: &str) {
for &crate_type in sess.crate_types.borrow().iter() {
// Ignore executable crates if we have -Z no-codegen, as they will error.
let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata);
Expand All @@ -64,13 +63,12 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
bug!("invalid output type `{:?}` for target os `{}`",
crate_type, sess.opts.target_triple);
}
let out_files = link_binary_output::<B>(sess,
codegen_results,
crate_type,
outputs,
crate_name,
target_cpu);
out_filenames.extend(out_files);
link_binary_output::<B>(sess,
codegen_results,
crate_type,
outputs,
crate_name,
target_cpu);
}

// Remove the temporary object file and metadata if we aren't saving temps
Expand All @@ -97,22 +95,18 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
}
}
}

out_filenames
}

fn link_binary_output<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
codegen_results: &CodegenResults,
crate_type: config::CrateType,
outputs: &OutputFilenames,
crate_name: &str,
target_cpu: &str) -> Vec<PathBuf> {
codegen_results: &CodegenResults,
crate_type: config::CrateType,
outputs: &OutputFilenames,
crate_name: &str,
target_cpu: &str) {
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
check_file_is_writeable(obj, sess);
}

let mut out_filenames = vec![];

if outputs.outputs.contains_key(&OutputType::Metadata) {
let out_filename = filename_for_metadata(sess, crate_name, outputs);
// To avoid races with another rustc process scanning the output directory,
Expand All @@ -128,7 +122,6 @@ fn link_binary_output<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
if let Err(e) = fs::rename(metadata, &out_filename) {
sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
}
out_filenames.push(out_filename);
}

let tmpdir = TempFileBuilder::new().prefix("rustc").tempdir().unwrap_or_else(|err|
Expand Down Expand Up @@ -158,14 +151,11 @@ fn link_binary_output<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
);
}
}
out_filenames.push(out_filename);
}

if sess.opts.cg.save_temps {
let _ = tmpdir.into_path();
}

out_filenames
}

// The third parameter is for env vars, used on windows to set up the
Expand Down

0 comments on commit 91d5b76

Please sign in to comment.