File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -181,21 +181,24 @@ pub struct AttrId {
181
181
// FIXME: This only handles a single level of cfg_attr nesting
182
182
// that is `#[cfg_attr(all(), cfg_attr(all(), cfg(any())))]` breaks again
183
183
impl AttrId {
184
- const AST_INDEX_MASK : usize = 0x00FF_FFFF ;
185
- const INNER_ATTR_BIT : usize = 1 << 31 ;
184
+ const INNER_ATTR_SET_BIT : usize = 1 << 31 ;
186
185
187
186
pub fn new ( id : usize , is_inner : bool ) -> Self {
188
- let id = id & Self :: AST_INDEX_MASK ;
189
- let id = if is_inner { id | Self :: INNER_ATTR_BIT } else { id } ;
190
- Self { id : id as u32 }
187
+ Self {
188
+ id : if is_inner {
189
+ id | Self :: INNER_ATTR_SET_BIT
190
+ } else {
191
+ id & !Self :: INNER_ATTR_SET_BIT
192
+ } as u32 ,
193
+ }
191
194
}
192
195
193
196
pub fn ast_index ( & self ) -> usize {
194
- self . id as usize & Self :: AST_INDEX_MASK
197
+ self . id as usize & ! Self :: INNER_ATTR_SET_BIT
195
198
}
196
199
197
200
pub fn is_inner_attr ( & self ) -> bool {
198
- ( self . id as usize ) & Self :: INNER_ATTR_BIT != 0
201
+ ( self . id as usize ) & Self :: INNER_ATTR_SET_BIT != 0
199
202
}
200
203
}
201
204
You can’t perform that action at this time.
0 commit comments