summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2008-non-exhaustive/auxiliary/unstable.rs
blob: 11df44461e36bb36a1f5fc698db649c9b7453c2d (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#![feature(staged_api)]
#![stable(feature = "stable_test_feature", since = "1.0.0")]

#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[non_exhaustive]
pub enum UnstableEnum {
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    Stable,
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    Stable2,
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    Unstable,
}

#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[non_exhaustive]
pub enum OnlyUnstableEnum {
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    Unstable,
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    Unstable2,
}

impl OnlyUnstableEnum {
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    pub fn new() -> Self {
        Self::Unstable
    }
}

#[derive(Default)]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[non_exhaustive]
pub struct UnstableStruct {
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    pub stable: bool,
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    pub stable2: usize,
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    pub unstable: u8,
}

#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[non_exhaustive]
pub struct OnlyUnstableStruct {
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    pub unstable: u8,
    #[unstable(feature = "unstable_test_feature", issue = "none")]
    pub unstable2: bool,
}

impl OnlyUnstableStruct {
    #[stable(feature = "stable_test_feature", since = "1.0.0")]
    pub fn new() -> Self {
        Self {
            unstable: 0,
            unstable2: false,
        }
    }
}