about summary refs log tree commit diff
path: root/src/librustc/back
diff options
context:
space:
mode:
authorStuart Pernsteiner <spernsteiner@mozilla.com>2014-08-27 14:49:17 -0700
committerStuart Pernsteiner <spernsteiner@mozilla.com>2014-09-05 09:18:57 -0700
commit1b676fb7603cd2aa4e0506cb5b67d48c9da1123f (patch)
tree3d0ed78979ca00ee66dce2b5aab6a1ab3c0a39ef /src/librustc/back
parentb5a0b700c64639043bce0a2ba0a8b40dd853d469 (diff)
downloadrust-1b676fb7603cd2aa4e0506cb5b67d48c9da1123f.tar.gz
rust-1b676fb7603cd2aa4e0506cb5b67d48c9da1123f.zip
don't leave unwanted temporary files with --emit=ir/asm
Diffstat (limited to 'src/librustc/back')
-rw-r--r--src/librustc/back/write.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc/back/write.rs b/src/librustc/back/write.rs
index 2760ae80110..d87dd84bb32 100644
--- a/src/librustc/back/write.rs
+++ b/src/librustc/back/write.rs
@@ -588,12 +588,15 @@ pub fn run_passes(sess: &Session,
             //    to copy `foo.0.x` to `foo.x`.
             fs::copy(&crate_output.with_extension(ext),
                      &crate_output.path(output_type)).unwrap();
+            if !sess.opts.cg.save_temps {
+                // The user just wants `foo.x`, not `foo.0.x`.
+                remove(sess, &crate_output.with_extension(ext));
+            }
         } else {
             if crate_output.single_output_file.is_some() {
                 // 2) Multiple codegen units, with `-o some_name`.  We have
                 //    no good solution for this case, so warn the user.
-                sess.warn(format!("ignoring specified output filename \
-                                   because multiple .{} files were produced",
+                sess.warn(format!("ignoring -o because multiple .{} files were produced",
                                   ext).as_slice());
             } else {
                 // 3) Multiple codegen units, but no `-o some_name`.  We
@@ -670,7 +673,7 @@ pub fn run_passes(sess: &Session,
     //  - crate.metadata.bc
     //  - crate.metadata.o
     //  - crate.o (linked from crate.##.o)
-    //  - crate.bc (copied from crate.0.bc, or an empty bitcode file)
+    //  - crate.bc (copied from crate.0.bc)
     // We may create additional files if requested by the user (through
     // `-C save-temps` or `--emit=` flags).