]> git.lizzy.rs Git - rust.git/blob - src/test/ui/conditional-compilation/cfg_accessible.rs
Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett
[rust.git] / src / test / ui / conditional-compilation / cfg_accessible.rs
1 #![feature(cfg_accessible)]
2
3 mod m {
4     pub struct ExistingPublic;
5     struct ExistingPrivate;
6 }
7
8 trait Trait {
9     type Assoc;
10 }
11
12 enum Enum {
13     Existing,
14 }
15
16 #[cfg_accessible(Enum)]
17 struct ExistingResolved;
18
19 #[cfg_accessible(Enum::Existing)]
20 struct ExistingResolvedVariant;
21
22 #[cfg_accessible(m::ExistingPublic)]
23 struct ExistingPublic;
24
25 #[cfg_accessible(m::ExistingPrivate)]
26 struct ExistingPrivate;
27
28 #[cfg_accessible(m::NonExistent)]
29 struct NonExistingPrivate;
30
31 #[cfg_accessible(n::AccessibleExpanded)] // OK, `cfg_accessible` can wait and retry.
32 struct AccessibleExpanded;
33
34 #[cfg_accessible(Trait::Assoc)]
35 struct AccessibleTraitAssoc;
36
37 macro_rules! generate_accessible_expanded {
38     () => {
39         mod n {
40             pub struct AccessibleExpanded;
41         }
42     };
43 }
44
45 generate_accessible_expanded!();
46
47 fn main() {
48     ExistingPublic;
49     AccessibleExpanded;
50     AccessibleTraitAssoc;
51
52     ExistingPrivate; //~ ERROR cannot find
53     NonExistingPrivate; //~ ERROR cannot find
54     NonExistingTraitAlias; //~ ERROR cannot find
55 }