]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-fulldeps/proc-macro/modify-ast.rs
0b584fdd44d478c8194d489a56e4f1b4f254bcf0
[rust.git] / src / test / run-pass-fulldeps / proc-macro / modify-ast.rs
1 // Copyright 2018 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 // aux-build:modify-ast.rs
12
13 #![feature(use_extern_macros)]
14
15 extern crate modify_ast;
16
17 use modify_ast::*;
18
19 #[derive(Foo)]
20 pub struct MyStructc {
21     #[cfg_attr(my_cfg, foo)]
22     _a: i32,
23 }
24
25 macro_rules! a {
26     ($i:item) => ($i)
27 }
28
29 a! {
30     #[assert1]
31     pub fn foo() {}
32 }
33
34 fn main() {
35     let _a = MyStructc { _a: 0 };
36     foo();
37 }