]>
Commit | Line | Data |
---|---|---|
c34b1796 | 1 | // aux-build:lint_stability_fields.rs |
476ff2be | 2 | #![allow(deprecated)] |
c34b1796 AL |
3 | #![allow(dead_code)] |
4 | #![feature(staged_api)] | |
92a42be0 SL |
5 | |
6 | #![stable(feature = "rust1", since = "1.0.0")] | |
c34b1796 AL |
7 | |
8 | mod cross_crate { | |
9 | extern crate lint_stability_fields; | |
10 | ||
94b46f34 XL |
11 | mod reexport { |
12 | #[stable(feature = "rust1", since = "1.0.0")] | |
13 | pub use super::lint_stability_fields::*; | |
14 | } | |
15 | ||
c34b1796 AL |
16 | use self::lint_stability_fields::*; |
17 | ||
18 | pub fn foo() { | |
19 | let x = Stable { | |
20 | inherit: 1, | |
21 | override1: 2, //~ ERROR use of unstable | |
476ff2be | 22 | override2: 3, //~ ERROR use of unstable |
c34b1796 AL |
23 | }; |
24 | ||
25 | let _ = x.inherit; | |
26 | let _ = x.override1; //~ ERROR use of unstable | |
476ff2be | 27 | let _ = x.override2; //~ ERROR use of unstable |
c34b1796 AL |
28 | |
29 | let Stable { | |
30 | inherit: _, | |
31 | override1: _, //~ ERROR use of unstable | |
476ff2be | 32 | override2: _ //~ ERROR use of unstable |
c34b1796 AL |
33 | } = x; |
34 | // all fine | |
35 | let Stable { .. } = x; | |
36 | ||
37 | let x = Stable2(1, 2, 3); | |
38 | ||
39 | let _ = x.0; | |
40 | let _ = x.1; //~ ERROR use of unstable | |
476ff2be | 41 | let _ = x.2; //~ ERROR use of unstable |
c34b1796 AL |
42 | |
43 | let Stable2(_, | |
44 | _, //~ ERROR use of unstable | |
476ff2be | 45 | _) //~ ERROR use of unstable |
c34b1796 AL |
46 | = x; |
47 | // all fine | |
48 | let Stable2(..) = x; | |
49 | ||
50 | ||
51 | let x = Unstable { //~ ERROR use of unstable | |
52 | inherit: 1, //~ ERROR use of unstable | |
53 | override1: 2, | |
476ff2be | 54 | override2: 3, //~ ERROR use of unstable |
c34b1796 AL |
55 | }; |
56 | ||
57 | let _ = x.inherit; //~ ERROR use of unstable | |
58 | let _ = x.override1; | |
476ff2be | 59 | let _ = x.override2; //~ ERROR use of unstable |
c34b1796 AL |
60 | |
61 | let Unstable { //~ ERROR use of unstable | |
62 | inherit: _, //~ ERROR use of unstable | |
63 | override1: _, | |
476ff2be | 64 | override2: _ //~ ERROR use of unstable |
c34b1796 AL |
65 | } = x; |
66 | ||
67 | let Unstable //~ ERROR use of unstable | |
68 | // the patterns are all fine: | |
69 | { .. } = x; | |
70 | ||
94b46f34 XL |
71 | // Unstable items are still unstable even when used through a stable "pub use". |
72 | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable | |
c34b1796 AL |
73 | |
74 | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable | |
75 | ||
76 | let _ = x.0; //~ ERROR use of unstable | |
77 | let _ = x.1; | |
476ff2be | 78 | let _ = x.2; //~ ERROR use of unstable |
c34b1796 AL |
79 | |
80 | let Unstable2 //~ ERROR use of unstable | |
81 | (_, //~ ERROR use of unstable | |
82 | _, | |
476ff2be | 83 | _) //~ ERROR use of unstable |
c34b1796 AL |
84 | = x; |
85 | let Unstable2 //~ ERROR use of unstable | |
86 | // the patterns are all fine: | |
87 | (..) = x; | |
88 | ||
89 | ||
476ff2be SL |
90 | let x = Deprecated { //~ ERROR use of unstable |
91 | inherit: 1, //~ ERROR use of unstable | |
c34b1796 | 92 | override1: 2, |
476ff2be | 93 | override2: 3, //~ ERROR use of unstable |
c34b1796 AL |
94 | }; |
95 | ||
476ff2be | 96 | let _ = x.inherit; //~ ERROR use of unstable |
c34b1796 | 97 | let _ = x.override1; |
476ff2be | 98 | let _ = x.override2; //~ ERROR use of unstable |
c34b1796 | 99 | |
476ff2be SL |
100 | let Deprecated { //~ ERROR use of unstable |
101 | inherit: _, //~ ERROR use of unstable | |
c34b1796 | 102 | override1: _, |
476ff2be | 103 | override2: _ //~ ERROR use of unstable |
c34b1796 AL |
104 | } = x; |
105 | ||
476ff2be | 106 | let Deprecated //~ ERROR use of unstable |
c34b1796 AL |
107 | // the patterns are all fine: |
108 | { .. } = x; | |
109 | ||
476ff2be | 110 | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable |
c34b1796 | 111 | |
476ff2be | 112 | let _ = x.0; //~ ERROR use of unstable |
c34b1796 | 113 | let _ = x.1; |
476ff2be | 114 | let _ = x.2; //~ ERROR use of unstable |
c34b1796 | 115 | |
476ff2be SL |
116 | let Deprecated2 //~ ERROR use of unstable |
117 | (_, //~ ERROR use of unstable | |
c34b1796 | 118 | _, |
476ff2be | 119 | _) //~ ERROR use of unstable |
c34b1796 | 120 | = x; |
476ff2be | 121 | let Deprecated2 //~ ERROR use of unstable |
c34b1796 AL |
122 | // the patterns are all fine: |
123 | (..) = x; | |
124 | } | |
125 | } | |
126 | ||
127 | mod this_crate { | |
128 | #[stable(feature = "rust1", since = "1.0.0")] | |
129 | struct Stable { | |
130 | inherit: u8, | |
dfeec247 | 131 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 | 132 | override1: u8, |
92a42be0 | 133 | #[rustc_deprecated(since = "1.0.0", reason = "text")] |
dfeec247 | 134 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 AL |
135 | override2: u8, |
136 | } | |
137 | ||
138 | #[stable(feature = "rust1", since = "1.0.0")] | |
139 | struct Stable2(u8, | |
140 | #[stable(feature = "rust1", since = "1.0.0")] u8, | |
dfeec247 | 141 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
92a42be0 | 142 | #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); |
c34b1796 | 143 | |
dfeec247 | 144 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 AL |
145 | struct Unstable { |
146 | inherit: u8, | |
147 | #[stable(feature = "rust1", since = "1.0.0")] | |
148 | override1: u8, | |
92a42be0 | 149 | #[rustc_deprecated(since = "1.0.0", reason = "text")] |
dfeec247 | 150 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 AL |
151 | override2: u8, |
152 | } | |
153 | ||
dfeec247 | 154 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 AL |
155 | struct Unstable2(u8, |
156 | #[stable(feature = "rust1", since = "1.0.0")] u8, | |
dfeec247 | 157 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
92a42be0 | 158 | #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); |
c34b1796 | 159 | |
dfeec247 | 160 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
92a42be0 | 161 | #[rustc_deprecated(since = "1.0.0", reason = "text")] |
c34b1796 AL |
162 | struct Deprecated { |
163 | inherit: u8, | |
164 | #[stable(feature = "rust1", since = "1.0.0")] | |
165 | override1: u8, | |
dfeec247 | 166 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
c34b1796 AL |
167 | override2: u8, |
168 | } | |
169 | ||
dfeec247 | 170 | #[unstable(feature = "unstable_test_feature", issue = "none")] |
92a42be0 | 171 | #[rustc_deprecated(since = "1.0.0", reason = "text")] |
c34b1796 AL |
172 | struct Deprecated2(u8, |
173 | #[stable(feature = "rust1", since = "1.0.0")] u8, | |
dfeec247 | 174 | #[unstable(feature = "unstable_test_feature", issue = "none")] u8); |
c34b1796 AL |
175 | |
176 | pub fn foo() { | |
177 | let x = Stable { | |
178 | inherit: 1, | |
179 | override1: 2, | |
180 | override2: 3, | |
c34b1796 AL |
181 | }; |
182 | ||
183 | let _ = x.inherit; | |
184 | let _ = x.override1; | |
185 | let _ = x.override2; | |
c34b1796 AL |
186 | |
187 | let Stable { | |
188 | inherit: _, | |
189 | override1: _, | |
190 | override2: _ | |
c34b1796 AL |
191 | } = x; |
192 | // all fine | |
193 | let Stable { .. } = x; | |
194 | ||
195 | let x = Stable2(1, 2, 3); | |
196 | ||
197 | let _ = x.0; | |
198 | let _ = x.1; | |
199 | let _ = x.2; | |
c34b1796 AL |
200 | |
201 | let Stable2(_, | |
202 | _, | |
203 | _) | |
c34b1796 AL |
204 | = x; |
205 | // all fine | |
206 | let Stable2(..) = x; | |
207 | ||
208 | ||
209 | let x = Unstable { | |
210 | inherit: 1, | |
211 | override1: 2, | |
212 | override2: 3, | |
c34b1796 AL |
213 | }; |
214 | ||
215 | let _ = x.inherit; | |
216 | let _ = x.override1; | |
217 | let _ = x.override2; | |
c34b1796 AL |
218 | |
219 | let Unstable { | |
220 | inherit: _, | |
221 | override1: _, | |
222 | override2: _ | |
c34b1796 AL |
223 | } = x; |
224 | ||
225 | let Unstable | |
226 | // the patterns are all fine: | |
227 | { .. } = x; | |
228 | ||
229 | ||
230 | let x = Unstable2(1, 2, 3); | |
231 | ||
232 | let _ = x.0; | |
233 | let _ = x.1; | |
234 | let _ = x.2; | |
c34b1796 AL |
235 | |
236 | let Unstable2 | |
237 | (_, | |
238 | _, | |
239 | _) | |
c34b1796 AL |
240 | = x; |
241 | let Unstable2 | |
242 | // the patterns are all fine: | |
243 | (..) = x; | |
244 | ||
245 | ||
246 | let x = Deprecated { | |
c34b1796 | 247 | inherit: 1, |
c34b1796 AL |
248 | override1: 2, |
249 | override2: 3, | |
250 | }; | |
251 | ||
252 | let _ = x.inherit; | |
c34b1796 AL |
253 | let _ = x.override1; |
254 | let _ = x.override2; | |
255 | ||
256 | let Deprecated { | |
c34b1796 | 257 | inherit: _, |
c34b1796 AL |
258 | override1: _, |
259 | override2: _ | |
260 | } = x; | |
261 | ||
262 | let Deprecated | |
c34b1796 AL |
263 | // the patterns are all fine: |
264 | { .. } = x; | |
265 | ||
266 | let x = Deprecated2(1, 2, 3); | |
c34b1796 AL |
267 | |
268 | let _ = x.0; | |
c34b1796 AL |
269 | let _ = x.1; |
270 | let _ = x.2; | |
271 | ||
272 | let Deprecated2 | |
c34b1796 | 273 | (_, |
c34b1796 AL |
274 | _, |
275 | _) | |
276 | = x; | |
277 | let Deprecated2 | |
c34b1796 AL |
278 | // the patterns are all fine: |
279 | (..) = x; | |
280 | } | |
281 | } | |
282 | ||
283 | fn main() {} |