Skip to content

Commit 8f2172d

Browse files
author
Elliott Slaughter
committed
---
yaml --- r: 32216 b: refs/heads/dist-snap c: 0031617 h: refs/heads/master v: v3
1 parent 83b9998 commit 8f2172d

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: adf9fa229fbf9da048c766ec966d6d7c0babb5c9
10+
refs/heads/dist-snap: 0031617f30f159df2cef301c9d574cd219e16b16
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/rustc/driver/driver.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,29 @@ fn default_configuration(sess: session, argv0: ~str, input: input) ->
6262
mk(~"build_input", source_name(input))];
6363
}
6464

65+
fn append_configuration(cfg: ast::crate_cfg, name: ~str) -> ast::crate_cfg {
66+
if attr::contains_name(cfg, name) {
67+
return cfg;
68+
} else {
69+
return vec::append_one(cfg, attr::mk_word_item(name));
70+
}
71+
}
72+
6573
fn build_configuration(sess: session, argv0: ~str, input: input) ->
6674
ast::crate_cfg {
6775
// Combine the configuration requested by the session (command line) with
6876
// some default and generated configuration items
6977
let default_cfg = default_configuration(sess, argv0, input);
7078
let user_cfg = sess.opts.cfg;
7179
// If the user wants a test runner, then add the test cfg
72-
let gen_cfg =
73-
{
74-
if sess.opts.test && !attr::contains_name(user_cfg, ~"test") {
75-
~[attr::mk_word_item(~"test")]
76-
} else {
77-
~[attr::mk_word_item(~"notest")]
78-
}
79-
};
80-
return vec::append(vec::append(user_cfg, gen_cfg), default_cfg);
80+
let user_cfg = append_configuration(
81+
user_cfg,
82+
if sess.opts.test { ~"test" } else { ~"notest" });
83+
// If the user requested GC, then add the GC cfg
84+
let user_cfg = append_configuration(
85+
user_cfg,
86+
if sess.opts.gc { ~"gc" } else { ~"nogc" });
87+
return vec::append(user_cfg, default_cfg);
8188
}
8289

8390
// Convert strings provided as --cfg [cfgspec] into a crate_cfg

0 commit comments

Comments
 (0)