]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/fields.rs
Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov
[rust.git] / src / test / ui / hygiene / fields.rs
1 // ignore-pretty pretty-printing is unhygienic
2
3 #![feature(decl_macro)]
4
5 mod foo {
6     struct S { x: u32 }
7     struct T(u32);
8
9     pub macro m($S:ident, $x:ident) {{
10         struct $S {
11             $x: u32,
12             x: i32,
13         }
14
15         let s = S { x: 0 }; //~ ERROR type `foo::S` is private
16         let _ = s.x; //~ ERROR type `foo::S` is private
17
18         let t = T(0); //~ ERROR type `T` is private
19         let _ = t.0; //~ ERROR type `T` is private
20
21         let s = $S { $x: 0, x: 1 };
22         assert_eq!((s.$x, s.x), (0, 1));
23         s
24     }}
25 }
26
27 fn main() {
28     let s = foo::m!(S, x);
29     assert_eq!(s.x, 0);
30 }