Skip to content

Commit a6e8496

Browse files
committed
Deduplicate --crate-type arguments
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.
1 parent 0ba9e1f commit a6e8496

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/librustc/session/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,9 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
10611061
part));
10621062
}
10631063
};
1064-
crate_types.push(new_part)
1064+
if !crate_types.contains(&new_part) {
1065+
crate_types.push(new_part)
1066+
}
10651067
}
10661068
}
10671069

src/test/run-make/duplicate-output-flavors/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ include ../tools.mk
22

33
all:
44
$(RUSTC) --crate-type=rlib foo.rs
5+
$(RUSTC) --crate-type=rlib,rlib foo.rs

0 commit comments

Comments
 (0)