Skip to content

Commit 562eeda

Browse files
committed
---
yaml --- r: 155437 b: refs/heads/try2 c: dcdbdc1 h: refs/heads/master i: 155435: eb0f1b4 v: v3
1 parent c0d3cf5 commit 562eeda

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 65cca7c8b14e9c5673af4921a57c2ccbac3fc2cb
8+
refs/heads/try2: dcdbdc10036b444ef39c329e9440d4acc6975fda
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ext/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ fn initial_syntax_expander_table() -> SyntaxEnv {
440440
builtin_normal_expander(
441441
ext::cfg::expand_cfg));
442442
syntax_expanders.insert(intern("cfg_attr"),
443-
ItemModifier(ext::cfg_attr::expand));
443+
Modifier(box ext::cfg_attr::expand));
444444
syntax_expanders.insert(intern("trace_macros"),
445445
builtin_normal_expander(
446446
ext::trace_macros::expand_trace_macros));

branches/try2/src/libsyntax/ext/cfg_attr.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,43 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::gc::{Gc, GC};
12-
1311
use ast;
1412
use attr;
1513
use codemap::Span;
1614
use ext::base::ExtCtxt;
1715
use ext::build::AstBuilder;
16+
use ptr::P;
1817

19-
pub fn expand(cx: &mut ExtCtxt, sp: Span, mi: Gc<ast::MetaItem>, it: Gc<ast::Item>)
20-
-> Gc<ast::Item> {
18+
pub fn expand(cx: &mut ExtCtxt, sp: Span, mi: &ast::MetaItem, it: P<ast::Item>) -> P<ast::Item> {
2119
let (cfg, attr) = match mi.node {
22-
ast::MetaList(_, ref mis) if mis.len() == 2 => (mis[0], mis[1]),
20+
ast::MetaList(_, ref mis) if mis.len() == 2 => (&mis[0], &mis[1]),
2321
_ => {
2422
cx.span_err(sp, "expected `#[cfg_attr(<cfg pattern>, <attr>)]`");
2523
return it;
2624
}
2725
};
2826

2927
let mut out = (*it).clone();
30-
if cfg_matches(cx, cfg) {
31-
out.attrs.push(cx.attribute(attr.span, attr));
28+
if cfg_matches(cx, &**cfg) {
29+
out.attrs.push(cx.attribute(attr.span, attr.clone()));
3230
}
3331

34-
box(GC) out
32+
P(out)
3533
}
3634

37-
fn cfg_matches(cx: &mut ExtCtxt, cfg: Gc<ast::MetaItem>) -> bool {
35+
fn cfg_matches(cx: &mut ExtCtxt, cfg: &ast::MetaItem) -> bool {
3836
match cfg.node {
3937
ast::MetaList(ref pred, ref mis) if pred.get() == "any" =>
40-
mis.iter().any(|mi| cfg_matches(cx, *mi)),
38+
mis.iter().any(|mi| cfg_matches(cx, &**mi)),
4139
ast::MetaList(ref pred, ref mis) if pred.get() == "all" =>
42-
mis.iter().all(|mi| cfg_matches(cx, *mi)),
40+
mis.iter().all(|mi| cfg_matches(cx, &**mi)),
4341
ast::MetaList(ref pred, ref mis) if pred.get() == "not" => {
4442
if mis.len() != 1 {
4543
cx.span_err(cfg.span, format!("expected 1 value, got {}",
4644
mis.len()).as_slice());
4745
return false;
4846
}
49-
!cfg_matches(cx, mis[0])
47+
!cfg_matches(cx, &*mis[0])
5048
}
5149
ast::MetaList(ref pred, _) => {
5250
cx.span_err(cfg.span,

branches/try2/src/libsyntax/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ fn is_ignored(cx: &TestCtxt, i: &ast::Item) -> bool {
340340
attr.check_name("ignore") && match attr.meta_item_list() {
341341
Some(ref cfgs) => {
342342
if cfgs.iter().any(|cfg| cfg.check_name("cfg")) {
343-
cx.sess.span_warn(attr.span,
343+
cx.span_diagnostic.span_warn(attr.span,
344344
"The use of cfg filters in #[ignore] is \
345345
deprecated. Use #[cfg_attr(<cfg pattern>, \
346346
ignore)] instead.");

0 commit comments

Comments
 (0)