about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-10 08:42:57 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-10 08:42:57 -0800
commitc33acf658a5b6e14d57016ea5a455277f7e0c966 (patch)
treebe6ce2be87591db0949ca0dd07d1a2fe05f11c19
parentb6e5f1bfe8f10ad457237c08c8e4c346eac9bf07 (diff)
parenta6e8496601767e59acce010531f8e4dfb40c7c0a (diff)
downloadrust-c33acf658a5b6e14d57016ea5a455277f7e0c966.tar.gz
rust-c33acf658a5b6e14d57016ea5a455277f7e0c966.zip
rollup merge of #22115: nagisa/dedupe-cratetypes
Crate types from multiple sources appear to be deduplicated properly, but not
deduplicated if they come from the command line arguments. At worst, this used
to cause compiler failures when `--crate-type=lib,rlib` (the same as
`--crate-type=rlib,rlib`, at least at the time of this commit) is provided and
generate the output multiple times otherwise.

r? @alexcrichton
-rw-r--r--src/librustc/session/config.rs4
-rw-r--r--src/test/run-make/duplicate-output-flavors/Makefile1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 7ee8401655c..949fee45517 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1076,7 +1076,9 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
                                        part));
                 }
             };
-            crate_types.push(new_part)
+            if !crate_types.contains(&new_part) {
+                crate_types.push(new_part)
+            }
         }
     }
 
diff --git a/src/test/run-make/duplicate-output-flavors/Makefile b/src/test/run-make/duplicate-output-flavors/Makefile
index d40b6862a01..e33279966c9 100644
--- a/src/test/run-make/duplicate-output-flavors/Makefile
+++ b/src/test/run-make/duplicate-output-flavors/Makefile
@@ -2,3 +2,4 @@ include ../tools.mk
 
 all:
 	$(RUSTC) --crate-type=rlib foo.rs
+	$(RUSTC) --crate-type=rlib,rlib foo.rs