diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-03-14 15:05:49 -0700 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2019-03-14 15:06:12 -0700 |
| commit | fa8fd3daa7efefd4036a377f48f755be0b6952ee (patch) | |
| tree | d8cad48db82111ed58301845a94edf3a16374cb5 /src | |
| parent | bc44841ad2a2ad5f6c5e67b9e35ed8e7e71d4dc7 (diff) | |
| download | rust-fa8fd3daa7efefd4036a377f48f755be0b6952ee.tar.gz rust-fa8fd3daa7efefd4036a377f48f755be0b6952ee.zip | |
Add support for comma-separated option lists
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/session/config.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 55c4b0e54b8..d39057cbf92 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -800,6 +800,7 @@ macro_rules! options { pub const parse_opt_pathbuf: Option<&str> = Some("a path"); pub const parse_list: Option<&str> = Some("a space-separated list of strings"); pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings"); + pub const parse_opt_comma_list: Option<&str> = Some("a comma-separated list of strings"); pub const parse_uint: Option<&str> = Some("a number"); pub const parse_passes: Option<&str> = Some("a space-separated list of passes, or `all`"); @@ -926,6 +927,18 @@ macro_rules! options { } } + fn parse_opt_comma_list(slot: &mut Option<Vec<String>>, v: Option<&str>) + -> bool { + match v { + Some(s) => { + let v = s.split(',').map(|s| s.to_string()).collect(); + *slot = Some(v); + true + }, + None => false, + } + } + fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool { match v.and_then(|s| s.parse().ok()) { Some(i) => { *slot = i; true }, |
