about summary refs log tree commit diff
path: root/src/librustc_driver/lib.rs
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2017-12-19 01:54:00 +0000
committervarkor <github@varkor.com>2017-12-19 01:54:00 +0000
commitb59fbfdbe1c31768ca12a0f899e6db74396e9ba5 (patch)
treee861c566084c7b8a9031069870eec73368d0ff88 /src/librustc_driver/lib.rs
parentc76cdce3d953759a53d4990af0f5fb472cbc04de (diff)
downloadrust-b59fbfdbe1c31768ca12a0f899e6db74396e9ba5.tar.gz
rust-b59fbfdbe1c31768ca12a0f899e6db74396e9ba5.zip
Move source-output conflict checking into `compile_input`
Diffstat (limited to 'src/librustc_driver/lib.rs')
-rw-r--r--src/librustc_driver/lib.rs15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 2bc0b39dd0d..60857505c7a 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -237,20 +237,6 @@ pub fn run_compiler<'a>(args: &[String],
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
 
-    // Ensure the source file isn't accidentally overwritten during compilation.
-    match input_file_path {
-        Some(input_file_path) => {
-            if driver::build_output_filenames(&input, &odir, &ofile, &[], &sess)
-                .contains_path(&input_file_path) && sess.opts.will_create_output_file() {
-                sess.err(&format!(
-                    "the input file \"{}\" would be overwritten by the generated executable",
-                    input_file_path.display()));
-                return (Err(CompileIncomplete::Stopped), Some(sess));
-            }
-        },
-        None => {}
-    }
-
     let mut cfg = config::build_configuration(&sess, cfg);
     target_features::add_configuration(&mut cfg, &sess);
     sess.parse_sess.config = cfg;
@@ -266,6 +252,7 @@ pub fn run_compiler<'a>(args: &[String],
     let control = callbacks.build_controller(&sess, &matches);
     (driver::compile_input(&sess,
                            &cstore,
+                           &input_file_path,
                            &input,
                            &odir,
                            &ofile,