Skip to content

Commit dcdbdc1

Browse files
committed
Fix rebase fallout
1 parent 65cca7c commit dcdbdc1

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/libsyntax/ext/base.rs

+1-1
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));

src/libsyntax/ext/cfg_attr.rs

+10-12
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,

src/libsyntax/test.rs

+1-1
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)