@@ -50,18 +50,18 @@ pub struct StructSignature {
5050bitflags ! {
5151 #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
5252 pub struct StructFlags : u8 {
53- /// Indicates whether the struct is `PhantomData`.
54- const IS_PHANTOM_DATA = 1 << 2 ;
55- /// Indicates whether the struct has a `#[fundamental]` attribute.
56- const IS_FUNDAMENTAL = 1 << 3 ;
5753 /// Indicates whether the struct has a `#[rustc_has_incoherent_inherent_impls]` attribute.
58- const IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 4 ;
54+ const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 1 ;
55+ /// Indicates whether the struct has a `#[fundamental]` attribute.
56+ const FUNDAMENTAL = 1 << 2 ;
57+ /// Indicates whether the struct is `PhantomData`.
58+ const IS_PHANTOM_DATA = 1 << 3 ;
5959 /// Indicates whether this struct is `Box`.
60- const IS_BOX = 1 << 5 ;
60+ const IS_BOX = 1 << 4 ;
6161 /// Indicates whether this struct is `ManuallyDrop`.
62- const IS_MANUALLY_DROP = 1 << 6 ;
62+ const IS_MANUALLY_DROP = 1 << 5 ;
6363 /// Indicates whether this struct is `UnsafeCell`.
64- const IS_UNSAFE_CELL = 1 << 7 ;
64+ const IS_UNSAFE_CELL = 1 << 6 ;
6565 }
6666}
6767
@@ -73,10 +73,10 @@ impl StructSignature {
7373
7474 let mut flags = StructFlags :: empty ( ) ;
7575 if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
76- flags |= StructFlags :: IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
76+ flags |= StructFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
7777 }
7878 if attrs. by_key ( & sym:: fundamental) . exists ( ) {
79- flags |= StructFlags :: IS_FUNDAMENTAL ;
79+ flags |= StructFlags :: FUNDAMENTAL ;
8080 }
8181 if let Some ( lang) = attrs. lang_item ( ) {
8282 match lang {
@@ -129,10 +129,10 @@ impl UnionSignature {
129129 let attrs = item_tree. attrs ( db, krate, ModItem :: from ( loc. id . value ) . into ( ) ) ;
130130 let mut flags = StructFlags :: empty ( ) ;
131131 if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
132- flags |= StructFlags :: IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
132+ flags |= StructFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
133133 }
134134 if attrs. by_key ( & sym:: fundamental) . exists ( ) {
135- flags |= StructFlags :: IS_FUNDAMENTAL ;
135+ flags |= StructFlags :: FUNDAMENTAL ;
136136 }
137137
138138 let repr = attrs. repr ( ) ;
@@ -162,7 +162,7 @@ impl UnionSignature {
162162bitflags ! {
163163 #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
164164 pub struct EnumFlags : u8 {
165- const IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 4 ;
165+ const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 1 ;
166166 }
167167}
168168
@@ -182,7 +182,7 @@ impl EnumSignature {
182182 let attrs = item_tree. attrs ( db, loc. container . krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
183183 let mut flags = EnumFlags :: empty ( ) ;
184184 if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
185- flags |= EnumFlags :: IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
185+ flags |= EnumFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
186186 }
187187
188188 let repr = attrs. repr ( ) ;
@@ -219,8 +219,8 @@ impl EnumSignature {
219219bitflags:: bitflags! {
220220 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
221221 pub struct ConstFlags : u8 {
222- const HAS_BODY = 1 << 0 ;
223- const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 1 ;
222+ const HAS_BODY = 1 << 1 ;
223+ const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 7 ;
224224 }
225225}
226226
@@ -271,12 +271,12 @@ impl ConstSignature {
271271bitflags:: bitflags! {
272272 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
273273 pub struct StaticFlags : u8 {
274- const HAS_BODY = 1 << 0 ;
275- const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 1 ;
276- const MUTABLE = 1 << 2 ;
277- const HAS_UNSAFE = 1 << 3 ;
278- const HAS_SAFE = 1 << 4 ;
279- const IS_EXTERN = 1 << 5 ;
274+ const HAS_BODY = 1 << 1 ;
275+ const MUTABLE = 1 << 3 ;
276+ const UNSAFE = 1 << 4 ;
277+ const EXPLICIT_SAFE = 1 << 5 ;
278+ const EXTERN = 1 << 6 ;
279+ const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 7 ;
280280 }
281281}
282282
@@ -302,7 +302,7 @@ impl StaticSignature {
302302 }
303303
304304 if matches ! ( loc. container, ItemContainerId :: ExternBlockId ( _) ) {
305- flags. insert ( StaticFlags :: IS_EXTERN ) ;
305+ flags. insert ( StaticFlags :: EXTERN ) ;
306306 }
307307
308308 let source = loc. source ( db) ;
@@ -313,10 +313,10 @@ impl StaticSignature {
313313 flags. insert ( StaticFlags :: MUTABLE ) ;
314314 }
315315 if source. value . unsafe_token ( ) . is_some ( ) {
316- flags. insert ( StaticFlags :: HAS_UNSAFE ) ;
316+ flags. insert ( StaticFlags :: UNSAFE ) ;
317317 }
318318 if source. value . safe_token ( ) . is_some ( ) {
319- flags. insert ( StaticFlags :: HAS_SAFE ) ;
319+ flags. insert ( StaticFlags :: EXPLICIT_SAFE ) ;
320320 }
321321
322322 let ( store, source_map, type_ref) =
@@ -337,8 +337,8 @@ impl StaticSignature {
337337bitflags:: bitflags! {
338338 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
339339 pub struct ImplFlags : u8 {
340- const IS_NEGATIVE = 1 << 0 ;
341- const IS_UNSAFE = 1 << 1 ;
340+ const NEGATIVE = 1 << 1 ;
341+ const UNSAFE = 1 << 3 ;
342342 }
343343}
344344
@@ -358,10 +358,10 @@ impl ImplSignature {
358358 let mut flags = ImplFlags :: empty ( ) ;
359359 let src = loc. source ( db) ;
360360 if src. value . unsafe_token ( ) . is_some ( ) {
361- flags. insert ( ImplFlags :: IS_UNSAFE ) ;
361+ flags. insert ( ImplFlags :: UNSAFE ) ;
362362 }
363363 if src. value . excl_token ( ) . is_some ( ) {
364- flags. insert ( ImplFlags :: IS_NEGATIVE ) ;
364+ flags. insert ( ImplFlags :: NEGATIVE ) ;
365365 }
366366
367367 let ( store, source_map, self_ty, target_trait, generic_params) =
@@ -383,13 +383,13 @@ impl ImplSignature {
383383bitflags:: bitflags! {
384384 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
385385 pub struct TraitFlags : u8 {
386- const IS_AUTO = 1 << 0 ;
387- const IS_UNSAFE = 1 << 1 ;
388- const IS_FUNDAMENTAL = 1 << 2 ;
389- const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 3 ;
390- const SKIP_ARRAY_DURING_METHOD_DISPATCH = 1 << 4 ;
391- const SKIP_BOXED_SLICE_DURING_METHOD_DISPATCH = 1 << 5 ;
392- const RUSTC_PAREN_SUGAR = 1 << 6 ;
386+ const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 1 ;
387+ const FUNDAMENTAL = 1 << 2 ;
388+ const UNSAFE = 1 << 3 ;
389+ const AUTO = 1 << 4 ;
390+ const SKIP_ARRAY_DURING_METHOD_DISPATCH = 1 << 5 ;
391+ const SKIP_BOXED_SLICE_DURING_METHOD_DISPATCH = 1 << 6 ;
392+ const RUSTC_PAREN_SUGAR = 1 << 7 ;
393393 }
394394}
395395
@@ -410,13 +410,13 @@ impl TraitSignature {
410410 let attrs = item_tree. attrs ( db, loc. container . krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
411411 let source = loc. source ( db) ;
412412 if source. value . auto_token ( ) . is_some ( ) {
413- flags. insert ( TraitFlags :: IS_AUTO ) ;
413+ flags. insert ( TraitFlags :: AUTO ) ;
414414 }
415415 if source. value . unsafe_token ( ) . is_some ( ) {
416- flags. insert ( TraitFlags :: IS_UNSAFE ) ;
416+ flags. insert ( TraitFlags :: UNSAFE ) ;
417417 }
418418 if attrs. by_key ( & sym:: fundamental) . exists ( ) {
419- flags |= TraitFlags :: IS_FUNDAMENTAL ;
419+ flags |= TraitFlags :: FUNDAMENTAL ;
420420 }
421421 if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
422422 flags |= TraitFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
@@ -489,21 +489,21 @@ impl TraitAliasSignature {
489489bitflags ! {
490490 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
491491 pub struct FnFlags : u16 {
492- const HAS_SELF_PARAM = 1 << 0 ;
493492 const HAS_BODY = 1 << 1 ;
494- const HAS_DEFAULT_KW = 1 << 2 ;
495- const HAS_CONST_KW = 1 << 3 ;
496- const HAS_ASYNC_KW = 1 << 4 ;
497- const HAS_UNSAFE_KW = 1 << 5 ;
498- const IS_VARARGS = 1 << 6 ;
499- const HAS_SAFE_KW = 1 << 7 ;
493+ const DEFAULT = 1 << 2 ;
494+ const CONST = 1 << 3 ;
495+ const ASYNC = 1 << 4 ;
496+ const UNSAFE = 1 << 5 ;
497+ const HAS_VARARGS = 1 << 6 ;
498+ const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 7 ;
499+ const HAS_SELF_PARAM = 1 << 8 ;
500500 /// The `#[target_feature]` attribute is necessary to check safety (with RFC 2396),
501501 /// but keeping it for all functions will consume a lot of memory when there are
502502 /// only very few functions with it. So we only encode its existence here, and lookup
503503 /// it if needed.
504- const HAS_TARGET_FEATURE = 1 << 8 ;
505- const DEPRECATED_SAFE_2024 = 1 << 9 ;
506- const RUSTC_ALLOW_INCOHERENT_IMPLS = 1 << 10 ;
504+ const HAS_TARGET_FEATURE = 1 << 9 ;
505+ const DEPRECATED_SAFE_2024 = 1 << 10 ;
506+ const EXPLICIT_SAFE = 1 << 11 ;
507507 }
508508}
509509
@@ -532,7 +532,7 @@ impl FunctionSignature {
532532 let mut flags = FnFlags :: empty ( ) ;
533533 let attrs = item_tree. attrs ( db, module. krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
534534 if attrs. by_key ( & sym:: rustc_allow_incoherent_impl) . exists ( ) {
535- flags. insert ( FnFlags :: RUSTC_ALLOW_INCOHERENT_IMPLS ) ;
535+ flags. insert ( FnFlags :: RUSTC_ALLOW_INCOHERENT_IMPL ) ;
536536 }
537537
538538 if attrs. by_key ( & sym:: target_feature) . exists ( ) {
@@ -546,20 +546,20 @@ impl FunctionSignature {
546546 if attrs. by_key ( & sym:: rustc_deprecated_safe_2024) . exists ( ) {
547547 flags. insert ( FnFlags :: DEPRECATED_SAFE_2024 ) ;
548548 } else {
549- flags. insert ( FnFlags :: HAS_UNSAFE_KW ) ;
549+ flags. insert ( FnFlags :: UNSAFE ) ;
550550 }
551551 }
552552 if source. value . async_token ( ) . is_some ( ) {
553- flags. insert ( FnFlags :: HAS_ASYNC_KW ) ;
553+ flags. insert ( FnFlags :: ASYNC ) ;
554554 }
555555 if source. value . const_token ( ) . is_some ( ) {
556- flags. insert ( FnFlags :: HAS_CONST_KW ) ;
556+ flags. insert ( FnFlags :: CONST ) ;
557557 }
558558 if source. value . default_token ( ) . is_some ( ) {
559- flags. insert ( FnFlags :: HAS_DEFAULT_KW ) ;
559+ flags. insert ( FnFlags :: DEFAULT ) ;
560560 }
561561 if source. value . safe_token ( ) . is_some ( ) {
562- flags. insert ( FnFlags :: HAS_SAFE_KW ) ;
562+ flags. insert ( FnFlags :: EXPLICIT_SAFE ) ;
563563 }
564564 if source. value . body ( ) . is_some ( ) {
565565 flags. insert ( FnFlags :: HAS_BODY ) ;
@@ -575,7 +575,7 @@ impl FunctionSignature {
575575 flags. insert ( FnFlags :: HAS_SELF_PARAM ) ;
576576 }
577577 if variadic {
578- flags. insert ( FnFlags :: IS_VARARGS ) ;
578+ flags. insert ( FnFlags :: HAS_VARARGS ) ;
579579 }
580580 (
581581 Arc :: new ( FunctionSignature {
@@ -603,31 +603,31 @@ impl FunctionSignature {
603603 }
604604
605605 pub fn is_default ( & self ) -> bool {
606- self . flags . contains ( FnFlags :: HAS_DEFAULT_KW )
606+ self . flags . contains ( FnFlags :: DEFAULT )
607607 }
608608
609609 pub fn is_const ( & self ) -> bool {
610- self . flags . contains ( FnFlags :: HAS_CONST_KW )
610+ self . flags . contains ( FnFlags :: CONST )
611611 }
612612
613613 pub fn is_async ( & self ) -> bool {
614- self . flags . contains ( FnFlags :: HAS_ASYNC_KW )
614+ self . flags . contains ( FnFlags :: ASYNC )
615615 }
616616
617617 pub fn is_unsafe ( & self ) -> bool {
618- self . flags . contains ( FnFlags :: HAS_UNSAFE_KW )
618+ self . flags . contains ( FnFlags :: UNSAFE )
619619 }
620620
621621 pub fn is_deprecated_safe_2024 ( & self ) -> bool {
622622 self . flags . contains ( FnFlags :: DEPRECATED_SAFE_2024 )
623623 }
624624
625625 pub fn is_safe ( & self ) -> bool {
626- self . flags . contains ( FnFlags :: HAS_SAFE_KW )
626+ self . flags . contains ( FnFlags :: EXPLICIT_SAFE )
627627 }
628628
629629 pub fn is_varargs ( & self ) -> bool {
630- self . flags . contains ( FnFlags :: IS_VARARGS )
630+ self . flags . contains ( FnFlags :: HAS_VARARGS )
631631 }
632632
633633 pub fn has_target_feature ( & self ) -> bool {
@@ -637,10 +637,10 @@ impl FunctionSignature {
637637
638638bitflags ! {
639639 #[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
640- pub struct TypeAliasFlags : u16 {
641- const IS_EXTERN = 1 << 7 ;
642- const RUSTC_ALLOW_INCOHERENT_IMPLS = 1 << 8 ;
643- const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 9 ;
640+ pub struct TypeAliasFlags : u8 {
641+ const RUSTC_HAS_INCOHERENT_INHERENT_IMPL = 1 << 1 ;
642+ const IS_EXTERN = 1 << 6 ;
643+ const RUSTC_ALLOW_INCOHERENT_IMPL = 1 << 7 ;
644644 }
645645}
646646
@@ -669,10 +669,10 @@ impl TypeAliasSignature {
669669 ModItem :: from ( loc. id . value ) . into ( ) ,
670670 ) ;
671671 if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
672- flags. insert ( TypeAliasFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ) ;
672+ flags. insert ( TypeAliasFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPL ) ;
673673 }
674674 if attrs. by_key ( & sym:: rustc_allow_incoherent_impl) . exists ( ) {
675- flags. insert ( TypeAliasFlags :: RUSTC_ALLOW_INCOHERENT_IMPLS ) ;
675+ flags. insert ( TypeAliasFlags :: RUSTC_ALLOW_INCOHERENT_IMPL ) ;
676676 }
677677 if matches ! ( loc. container, ItemContainerId :: ExternBlockId ( _) ) {
678678 flags. insert ( TypeAliasFlags :: IS_EXTERN ) ;
0 commit comments