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