Skip to content

Commit 406c08b

Browse files
committed
---
yaml --- r: 48810 b: refs/heads/snap-stage3 c: 5820991 h: refs/heads/master v: v3
1 parent 69e1859 commit 406c08b

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
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: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3c84bac9462ae853b32f55fcaca2613a7e392d41
4+
refs/heads/snap-stage3: 58209910bd70512e4a880bb25ed296dddc48e0b7
55
refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ pub fn build_configuration(sess: Session, +argv0: ~str, input: input) ->
132132
}
133133

134134
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
135-
pub fn parse_cfgspecs(cfgspecs: ~[~str]) -> ast::crate_cfg {
136-
// FIXME (#2399): It would be nice to use the parser to parse all
137-
// varieties of meta_item here. At the moment we just support the
138-
// meta_word variant.
139-
let mut words = ~[];
135+
fn parse_cfgspecs(cfgspecs: ~[~str],
136+
demitter: diagnostic::Emitter) -> ast::crate_cfg {
137+
let mut meta = ~[];
140138
for cfgspecs.each |s| {
141-
words.push(attr::mk_word_item(@/*bad*/copy *s));
139+
let sess = parse::new_parse_sess(Some(demitter));
140+
let m = parse::parse_meta_from_source_str(~"cfgspec", @/*bad*/ copy *s, ~[], sess);
141+
meta.push(m)
142142
}
143-
return words;
143+
return meta;
144144
}
145145

146146
pub enum input {
@@ -639,7 +639,7 @@ pub fn build_session_options(+binary: ~str,
639639
let addl_lib_search_paths =
640640
getopts::opt_strs(matches, ~"L")
641641
.map(|s| Path(*s));
642-
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"));
642+
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"), demitter);
643643
let test = opt_present(matches, ~"test");
644644
let android_cross_path = getopts::opt_maybe_str(
645645
matches, ~"android-cross-path");

branches/snap-stage3/src/libsyntax/parse/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ pub fn parse_item_from_source_str(
139139
maybe_aborted(p.parse_item(attrs),p)
140140
}
141141

142+
pub fn parse_meta_from_source_str(
143+
name: ~str,
144+
source: @~str,
145+
+cfg: ast::crate_cfg,
146+
sess: @mut ParseSess
147+
) -> @ast::meta_item {
148+
let p = new_parser_from_source_str(
149+
sess,
150+
cfg,
151+
/*bad*/ copy name,
152+
codemap::FssNone,
153+
source
154+
);
155+
maybe_aborted(p.parse_meta_item(),p)
156+
}
157+
142158
pub fn parse_stmt_from_source_str(
143159
name: ~str,
144160
source: @~str,

0 commit comments

Comments
 (0)