]>
git.proxmox.com Git - rustc.git/blob - tests/ui/hygiene/wrap_unhygienic_example.rs
2 // ignore-pretty pretty-printing is unhygienic
4 // aux-build:my_crate.rs
5 // aux-build:unhygienic_example.rs
7 #![feature(decl_macro)]
9 extern crate unhygienic_example
;
10 extern crate my_crate
; // (b)
12 // Hygienic version of `unhygienic_macro`.
13 pub macro hygienic_macro() {
15 ::unhygienic_example
::unhygienic_macro
!();
16 // ^ Even though we invoke an unhygienic macro, `hygienic_macro` remains hygienic.
17 // In the above expansion:
18 // (1) `my_crate` always resolves to (b) regardless of invocation site.
19 // (2) The defined function `f` is only usable inside this macro definition.
20 // (3) `g` always resolves to (c) regardless of invocation site.
21 // (4) `$crate::g` remains hygienic and continues to resolve to (a).
27 fn test_hygienic_macro() {
30 fn f() {}
// (d) no conflict
31 f(); // resolves to (d)