Skip to content

Commit 56cc061

Browse files
committed
---
yaml --- r: 53946 b: refs/heads/dist-snap c: 5820991 h: refs/heads/master v: v3
1 parent 4938227 commit 56cc061

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 3c84bac9462ae853b32f55fcaca2613a7e392d41
10+
refs/heads/dist-snap: 58209910bd70512e4a880bb25ed296dddc48e0b7
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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)