Skip to content

Commit fa8fd3d

Browse files
committed
Add support for comma-separated option lists
1 parent bc44841 commit fa8fd3d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/librustc/session/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ macro_rules! options {
800800
pub const parse_opt_pathbuf: Option<&str> = Some("a path");
801801
pub const parse_list: Option<&str> = Some("a space-separated list of strings");
802802
pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings");
803+
pub const parse_opt_comma_list: Option<&str> = Some("a comma-separated list of strings");
803804
pub const parse_uint: Option<&str> = Some("a number");
804805
pub const parse_passes: Option<&str> =
805806
Some("a space-separated list of passes, or `all`");
@@ -926,6 +927,18 @@ macro_rules! options {
926927
}
927928
}
928929

930+
fn parse_opt_comma_list(slot: &mut Option<Vec<String>>, v: Option<&str>)
931+
-> bool {
932+
match v {
933+
Some(s) => {
934+
let v = s.split(',').map(|s| s.to_string()).collect();
935+
*slot = Some(v);
936+
true
937+
},
938+
None => false,
939+
}
940+
}
941+
929942
fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool {
930943
match v.and_then(|s| s.parse().ok()) {
931944
Some(i) => { *slot = i; true },

0 commit comments

Comments
 (0)