Skip to content

Commit 0c00f46

Browse files
brsonalexcrichton
authored andcommitted
---
yaml --- r: 126655 b: refs/heads/snap-stage3 c: 1c3655b h: refs/heads/master i: 126653: 86a54a6 126651: 91354cd 126647: 1396d47 126639: 1f837da 126623: ee4bc2e 126591: a095654 v: v3
1 parent 21c5dbb commit 0c00f46

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7be8f0af0393dcdb077c2f6b1653836fd3fba235
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9631bf2e2526173b21070eb532c6cb590c5869b8
4+
refs/heads/snap-stage3: 1c3655bed192e31bdf649ed5f4e728201ede17b2
55
refs/heads/try: 502e4c045236682e9728539dc0d2b3d0b237f55c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/driver/config.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -593,24 +593,10 @@ fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
593593
}
594594

595595
pub fn build_session_options(matches: &getopts::Matches) -> Options {
596-
let mut crate_types: Vec<CrateType> = Vec::new();
596+
597597
let unparsed_crate_types = matches.opt_strs("crate-type");
598-
for unparsed_crate_type in unparsed_crate_types.iter() {
599-
for part in unparsed_crate_type.as_slice().split(',') {
600-
let new_part = match part {
601-
"lib" => default_lib_output(),
602-
"rlib" => CrateTypeRlib,
603-
"staticlib" => CrateTypeStaticlib,
604-
"dylib" => CrateTypeDylib,
605-
"bin" => CrateTypeExecutable,
606-
_ => {
607-
early_error(format!("unknown crate type: `{}`",
608-
part).as_slice())
609-
}
610-
};
611-
crate_types.push(new_part)
612-
}
613-
}
598+
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
599+
.unwrap_or_else(|e| early_error(e.as_slice()));
614600

615601
let parse_only = matches.opt_present("parse-only");
616602
let no_trans = matches.opt_present("no-trans");
@@ -804,6 +790,29 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
804790
}
805791
}
806792

793+
pub fn parse_crate_types_from_list(crate_types_list_list: Vec<String>) -> Result<Vec<CrateType>, String> {
794+
795+
let mut crate_types: Vec<CrateType> = Vec::new();
796+
for unparsed_crate_type in crate_types_list_list.iter() {
797+
for part in unparsed_crate_type.as_slice().split(',') {
798+
let new_part = match part {
799+
"lib" => default_lib_output(),
800+
"rlib" => CrateTypeRlib,
801+
"staticlib" => CrateTypeStaticlib,
802+
"dylib" => CrateTypeDylib,
803+
"bin" => CrateTypeExecutable,
804+
_ => {
805+
return Err(format!("unknown crate type: `{}`",
806+
part));
807+
}
808+
};
809+
crate_types.push(new_part)
810+
}
811+
}
812+
813+
return Ok(crate_types);
814+
}
815+
807816
impl fmt::Show for CrateType {
808817
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
809818
match *self {

0 commit comments

Comments
 (0)