Skip to content

Commit ccd1cda

Browse files
committed
Ignore #[phase] on use view items
Closes #11806
1 parent 47ab5d2 commit ccd1cda

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

src/libsyntax/ext/expand.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,20 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
394394
pub fn expand_view_item(vi: &ast::ViewItem,
395395
fld: &mut MacroExpander)
396396
-> ast::ViewItem {
397-
let should_load = vi.attrs.iter().any(|attr| {
398-
attr.name().get() == "phase" &&
399-
attr.meta_item_list().map_or(false, |phases| {
400-
attr::contains_name(phases, "syntax")
401-
})
402-
});
397+
match vi.node {
398+
ast::ViewItemExternMod(..) => {
399+
let should_load = vi.attrs.iter().any(|attr| {
400+
attr.name().get() == "phase" &&
401+
attr.meta_item_list().map_or(false, |phases| {
402+
attr::contains_name(phases, "syntax")
403+
})
404+
});
403405

404-
if should_load {
405-
load_extern_macros(vi, fld);
406+
if should_load {
407+
load_extern_macros(vi, fld);
408+
}
409+
}
410+
ast::ViewItemUse(_) => {}
406411
}
407412

408413
noop_fold_view_item(vi, fld)
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//xfail-fast
12+
13+
#[feature(phase)];
14+
15+
#[phase(syntax)]
16+
use std::mem;
17+
18+
fn main() {}
19+

0 commit comments

Comments
 (0)