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