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 {
175175// FIXME: This only handles a single level of cfg_attr nesting
176176// that is `#[cfg_attr(all(), cfg_attr(all(), cfg(any())))]` breaks again
177177impl 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 ;
180179
181180 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+ }
185188 }
186189
187190 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
189192 }
190193
191194 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
193196 }
194197}
195198
You can’t perform that action at this time.
0 commit comments