summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs
blob: ef89e31d8429da4d0ac2cdcf5f6f24507be47f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// check-pass

// Here we check that a `:vis` macro matcher subsititued for the empty visibility
// (`VisibilityKind::Inherited`) is accepted when used before an enum variant.

fn main() {}

macro_rules! mac_variant {
    ($vis:vis MARKER) => {
        enum Enum {
            $vis Unit,

            $vis Tuple(u8, u16),

            $vis Struct { f: u8 },
        }
    }
}

mac_variant!(MARKER);

// We also accept visibilities on variants syntactically but not semantically.
#[cfg(FALSE)]
enum E {
    pub U,
    pub(crate) T(u8),
    pub(super) T { f: String }
}