]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/fields-definition.rs
Rollup merge of #49767 - ecstatic-morse:ptr-docs, r=steveklabnik
[rust.git] / src / test / ui / hygiene / fields-definition.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 #![feature(decl_macro)]
12
13 macro modern($a: ident) {
14     struct Modern {
15         a: u8,
16         $a: u8, // OK
17     }
18 }
19
20 macro_rules! legacy {
21     ($a: ident) => {
22         struct Legacy {
23             a: u8,
24             $a: u8, //~ ERROR field `a` is already declared
25         }
26     }
27 }
28
29 modern!(a);
30 legacy!(a);
31
32 fn main() {}