]> git.lizzy.rs Git - rust.git/commitdiff
Deduplicate --crate-type arguments
authorSimonas Kazlauskas <git@kazlauskas.me>
Mon, 9 Feb 2015 17:30:22 +0000 (19:30 +0200)
committerSimonas Kazlauskas <git@kazlauskas.me>
Mon, 9 Feb 2015 17:51:21 +0000 (19:51 +0200)
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.

src/librustc/session/config.rs
src/test/run-make/duplicate-output-flavors/Makefile

index efd2392e453ed65a8018bc59095a92485b441d8f..6d09b8b09e706eab402eba87de3e0c8938808213 100644 (file)
@@ -1061,7 +1061,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)
+            }
         }
     }
 
index d40b6862a0143dbfe2c5f2b3178700e118fa5e91..e33279966c97187be0c905c72e015b60c66345ce 100644 (file)
@@ -2,3 +2,4 @@ include ../tools.mk
 
 all:
        $(RUSTC) --crate-type=rlib foo.rs
+       $(RUSTC) --crate-type=rlib,rlib foo.rs