]> git.proxmox.com Git - rustc.git/blob - src/test/ui/rust-2018/uniform-paths/macro-rules.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / rust-2018 / uniform-paths / macro-rules.rs
1 // edition:2018
2
3 #![feature(decl_macro)]
4
5 mod m1 {
6 // Non-exported legacy macros are treated as `pub(crate)`.
7 macro_rules! legacy_macro { () => () }
8
9 use legacy_macro as _; // OK
10 pub(crate) use legacy_macro as _; // OK
11 pub use legacy_macro as _; //~ ERROR `legacy_macro` is only public within the crate, and cannot be re-exported outside
12 }
13
14 mod m2 {
15 macro_rules! legacy_macro { () => () }
16
17 #[allow(non_camel_case_types)]
18 type legacy_macro = u8;
19
20 // Legacy macro imports don't prevent names from other namespaces from being imported.
21 use legacy_macro as _; // OK
22 }
23
24 mod m3 {
25 macro legacy_macro() {}
26
27 fn f() {
28 macro_rules! legacy_macro { () => () }
29
30 // Legacy macro imports create ambiguities with other names in the same namespace.
31 use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous
32 }
33 }
34
35 mod exported {
36 // Exported legacy macros are treated as `pub`.
37 #[macro_export]
38 macro_rules! legacy_macro { () => () }
39
40 pub use legacy_macro as _; // OK
41 }
42
43 fn main() {}