Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Jan 29, 2018
1 parent ba76092 commit d97da7d
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/librustc_driver/driver.rs
Expand Up @@ -145,26 +145,23 @@ pub fn compile_input(trans: Box<TransCrate>,
let output_paths = generated_output_paths(sess, &outputs, &crate_name);

// Ensure the source file isn't accidentally overwritten during compilation.
match *input_path {
Some(ref input_path) => {
if sess.opts.will_create_output_file() {
if output_contains_path(&output_paths, input_path) {
sess.err(&format!(
"the input file \"{}\" would be overwritten by the generated \
executable",
input_path.display()));
return Err(CompileIncomplete::Stopped);
}
if let Some(dir_path) = output_conflicts_with_dir(&output_paths) {
sess.err(&format!(
"the generated executable for the input file \"{}\" conflicts with the \
existing directory \"{}\"",
input_path.display(), dir_path.display()));
return Err(CompileIncomplete::Stopped);
}
if let Some(ref input_path) = *input_path {
if sess.opts.will_create_output_file() {
if output_contains_path(&output_paths, input_path) {
sess.err(&format!(
"the input file \"{}\" would be overwritten by the generated \
executable",
input_path.display()));
return Err(CompileIncomplete::Stopped);
}
},
None => {}
if let Some(dir_path) = output_conflicts_with_dir(&output_paths) {
sess.err(&format!(
"the generated executable for the input file \"{}\" conflicts with the \
existing directory \"{}\"",
input_path.display(), dir_path.display()));
return Err(CompileIncomplete::Stopped);
}
}
}

write_out_deps(sess, &outputs, &output_paths);
Expand Down

0 comments on commit d97da7d

Please sign in to comment.