File: stability.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (171 lines) | stat: -rw-r--r-- 6,444 bytes parent folder | download | duplicates (2)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]

#![stable(feature = "core", since = "1.6.0")]

//@ has stability/index.html
//@ has - '//ul[@class="item-table"]/li[1]//a' AaStable
//@ has - '//ul[@class="item-table"]/li[2]//a' ZzStable
//@ has - '//ul[@class="item-table"]/li[3]//a' Unstable

#[stable(feature = "rust2", since = "2.2.2")]
pub struct AaStable;

#[unstable(feature = "test", issue = "none")]
pub struct Unstable {
    //@ has stability/struct.Unstable.html \
    //      '//span[@class="item-info"]//div[@class="stab unstable"]' \
    //      'This is a nightly-only experimental API'
    //@ count stability/struct.Unstable.html '//span[@class="stab unstable"]' 0
    pub foo: u32,
    pub bar: u32,
}

#[stable(feature = "rust2", since = "2.2.2")]
pub struct ZzStable;

#[unstable(feature = "unstable", issue = "none")]
pub mod unstable {
    //@ !hasraw stability/unstable/struct.StableInUnstable.html \
    //      '//div[@class="main-heading"]//span[@class="since"]'
    //@ has - '//div[@class="stab unstable"]' 'experimental'
    #[stable(feature = "rust1", since = "1.0.0")]
    pub struct StableInUnstable;

    #[stable(feature = "rust1", since = "1.0.0")]
    pub mod stable_in_unstable {
        //@ !hasraw stability/unstable/stable_in_unstable/struct.Inner.html \
        //      '//div[@class="main-heading"]//span[@class="since"]'
        //@ has - '//div[@class="stab unstable"]' 'experimental'
        #[stable(feature = "rust1", since = "1.0.0")]
        pub struct Inner;
    }

    //@ has stability/struct.AaStable.html \
    //      '//*[@id="method.foo"]//span[@class="since"]' '2.2.2'
    impl super::AaStable {
        #[stable(feature = "rust2", since = "2.2.2")]
        pub fn foo() {}
    }

    //@ has stability/unstable/struct.StableInUnstable.html \
    //      '//*[@id="method.foo"]//span[@class="since"]' '1.0.0'
    impl StableInUnstable {
        #[stable(feature = "rust1", since = "1.0.0")]
        pub fn foo() {}
    }
}

#[unstable(feature = "unstable", issue = "none")]
#[doc(hidden)]
pub mod unstable_stripped {
    //@ has stability/struct.AaStable.html \
    //      '//*[@id="method.foo"]//span[@class="since"]' '2.2.2'
    impl super::AaStable {
        #[stable(feature = "rust2", since = "2.2.2")]
        pub fn foo() {}
    }
}

#[stable(feature = "rust2", since = "2.2.2")]
pub mod stable_later {
    //@ has stability/stable_later/struct.StableInLater.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '2.2.2'
    #[stable(feature = "rust1", since = "1.0.0")]
    pub struct StableInLater;

    #[stable(feature = "rust1", since = "1.0.0")]
    pub mod stable_in_later {
        //@ has stability/stable_later/stable_in_later/struct.Inner.html \
        //      '//div[@class="main-heading"]//span[@class="since"]' '2.2.2'
        #[stable(feature = "rust1", since = "1.0.0")]
        pub struct Inner;
    }
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_allowed_through_unstable_modules]
pub mod stable_earlier1 {
    //@ has stability/stable_earlier1/struct.StableInUnstable.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
    //@ has - '//*[@id="method.foo"]//span[@class="since"]' '1.0.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::unstable::StableInUnstable;

    //@ has stability/stable_earlier1/stable_in_unstable/struct.Inner.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::unstable::stable_in_unstable;

    //@ has stability/stable_earlier1/struct.StableInLater.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::stable_later::StableInLater;

    //@ has stability/stable_earlier1/stable_in_later/struct.Inner.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::stable_later::stable_in_later;
}

/// These will inherit the crate stability.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod stable_earlier2 {
    //@ has stability/stable_earlier2/struct.StableInUnstable.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.6.0'
    //@ has - '//*[@id="method.foo"]//span[@class="since"]' '1.0.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::unstable::StableInUnstable;

    //@ has stability/stable_earlier2/stable_in_unstable/struct.Inner.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.6.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::unstable::stable_in_unstable;

    //@ has stability/stable_earlier2/struct.StableInLater.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.6.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::stable_later::StableInLater;

    //@ has stability/stable_earlier2/stable_in_later/struct.Inner.html \
    //      '//div[@class="main-heading"]//span[@class="since"]' '1.6.0'
    #[doc(inline)]
    #[stable(feature = "rust1", since = "1.0.0")]
    pub use crate::stable_later::stable_in_later;
}

//@ !hasraw stability/trait.UnstableTraitWithStableMethod.html \
//      '//div[@class="main-heading"]//span[@class="since"]'
//@ has - '//*[@id="tymethod.foo"]//span[@class="since"]' '1.0.0'
//@ has - '//*[@id="method.bar"]//span[@class="since"]' '1.0.0'
#[unstable(feature = "unstable", issue = "none")]
pub trait UnstableTraitWithStableMethod {
    #[stable(feature = "rust1", since = "1.0.0")]
    fn foo();
    #[stable(feature = "rust1", since = "1.0.0")]
    fn bar() {}
}

//@ has stability/primitive.i32.html \
//      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
#[rustc_doc_primitive = "i32"]
//
/// `i32` is always stable in 1.0, even if you look at it from core.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i32 {}

//@ has stability/keyword.if.html \
//      '//div[@class="main-heading"]//span[@class="since"]' '1.0.0'
#[doc(keyword = "if")]
//
/// We currently don't document stability for keywords, but let's test it anyway.
#[stable(feature = "rust1", since = "1.0.0")]
mod if_keyword {}