]> git.lizzy.rs Git - rust.git/blob - src/test/ui/conditional-compilation/cfg_accessible.rs
Rollup merge of #93112 - pietroalbini:pa-cve-2022-21658-nightly, r=pietroalbini
[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 #[cfg_accessible(m::ExistingPublic)]
9 struct ExistingPublic;
10
11 // FIXME: Not implemented yet.
12 #[cfg_accessible(m::ExistingPrivate)] //~ ERROR not sure whether the path is accessible or not
13 struct ExistingPrivate;
14
15 // FIXME: Not implemented yet.
16 #[cfg_accessible(m::NonExistent)] //~ ERROR not sure whether the path is accessible or not
17 struct ExistingPrivate;
18
19 #[cfg_accessible(n::AccessibleExpanded)] // OK, `cfg_accessible` can wait and retry.
20 struct AccessibleExpanded;
21
22 macro_rules! generate_accessible_expanded {
23     () => {
24         mod n {
25             pub struct AccessibleExpanded;
26         }
27     };
28 }
29
30 generate_accessible_expanded!();
31
32 struct S {
33     field: u8,
34 }
35
36 // FIXME: Not implemented yet.
37 #[cfg_accessible(S::field)] //~ ERROR not sure whether the path is accessible or not
38 struct Field;
39
40 fn main() {
41     ExistingPublic;
42     AccessibleExpanded;
43 }