@@ -95,15 +95,13 @@ pub enum OptimizeAttr {
95
95
#[ derive( HashStable_Generic ) ]
96
96
pub struct Stability {
97
97
pub level : StabilityLevel ,
98
- pub feature : Symbol ,
99
98
}
100
99
101
100
/// Represents the `#[rustc_const_unstable]` and `#[rustc_const_stable]` attributes.
102
101
#[ derive( Encodable , Decodable , Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
103
102
#[ derive( HashStable_Generic ) ]
104
103
pub struct ConstStability {
105
104
pub level : StabilityLevel ,
106
- pub feature : Symbol ,
107
105
/// whether the function has a `#[rustc_promotable]` attribute
108
106
pub promotable : bool ,
109
107
}
@@ -113,8 +111,18 @@ pub struct ConstStability {
113
111
#[ derive( HashStable_Generic ) ]
114
112
pub enum StabilityLevel {
115
113
// Reason for the current stability level and the relevant rust-lang issue
116
- Unstable { reason : Option < Symbol > , issue : Option < NonZeroU32 > , is_soft : bool } ,
117
- Stable { since : Symbol } ,
114
+ Unstable {
115
+ reason : Option < Symbol > ,
116
+ feature : Symbol ,
117
+ issue : Option < NonZeroU32 > ,
118
+ is_soft : bool ,
119
+ } ,
120
+ Stable {
121
+ since : Symbol ,
122
+ // feature flag, should not be set when the feature name remains in use
123
+ // for unstable items (i.e. when partially stabilizing a feature)
124
+ feature : Option < Symbol > ,
125
+ } ,
118
126
}
119
127
120
128
impl StabilityLevel {
@@ -309,14 +317,12 @@ where
309
317
) ;
310
318
continue ;
311
319
}
312
- let level = Unstable { reason, issue : issue_num, is_soft } ;
320
+ let level = Unstable { reason, feature , issue : issue_num, is_soft } ;
313
321
if sym:: unstable == meta_name {
314
- stab = Some ( ( Stability { level, feature } , attr. span ) ) ;
322
+ stab = Some ( ( Stability { level } , attr. span ) ) ;
315
323
} else {
316
- const_stab = Some ( (
317
- ConstStability { level, feature, promotable : false } ,
318
- attr. span ,
319
- ) ) ;
324
+ const_stab =
325
+ Some ( ( ConstStability { level, promotable : false } , attr. span ) ) ;
320
326
}
321
327
}
322
328
( None , _, _) => {
@@ -385,22 +391,16 @@ where
385
391
}
386
392
}
387
393
388
- match ( feature , since) {
389
- ( Some ( feature ) , Some ( since) ) => {
390
- let level = Stable { since } ;
394
+ match since {
395
+ Some ( since) => {
396
+ let level = Stable { since, feature } ;
391
397
if sym:: stable == meta_name {
392
- stab = Some ( ( Stability { level, feature } , attr. span ) ) ;
398
+ stab = Some ( ( Stability { level } , attr. span ) ) ;
393
399
} else {
394
- const_stab = Some ( (
395
- ConstStability { level, feature, promotable : false } ,
396
- attr. span ,
397
- ) ) ;
400
+ const_stab =
401
+ Some ( ( ConstStability { level, promotable : false } , attr. span ) ) ;
398
402
}
399
403
}
400
- ( None , _) => {
401
- handle_errors ( & sess. parse_sess , attr. span , AttrError :: MissingFeature ) ;
402
- continue ;
403
- }
404
404
_ => {
405
405
handle_errors ( & sess. parse_sess , attr. span , AttrError :: MissingSince ) ;
406
406
continue ;
0 commit comments