@@ -50,18 +50,18 @@ pub struct StructSignature {
50
50
bitflags ! {
51
51
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
52
52
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 ;
57
53
/// 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 ;
59
59
/// Indicates whether this struct is `Box`.
60
- const IS_BOX = 1 << 5 ;
60
+ const IS_BOX = 1 << 4 ;
61
61
/// Indicates whether this struct is `ManuallyDrop`.
62
- const IS_MANUALLY_DROP = 1 << 6 ;
62
+ const IS_MANUALLY_DROP = 1 << 5 ;
63
63
/// Indicates whether this struct is `UnsafeCell`.
64
- const IS_UNSAFE_CELL = 1 << 7 ;
64
+ const IS_UNSAFE_CELL = 1 << 6 ;
65
65
}
66
66
}
67
67
@@ -73,10 +73,10 @@ impl StructSignature {
73
73
74
74
let mut flags = StructFlags :: empty ( ) ;
75
75
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 ;
77
77
}
78
78
if attrs. by_key ( & sym:: fundamental) . exists ( ) {
79
- flags |= StructFlags :: IS_FUNDAMENTAL ;
79
+ flags |= StructFlags :: FUNDAMENTAL ;
80
80
}
81
81
if let Some ( lang) = attrs. lang_item ( ) {
82
82
match lang {
@@ -129,10 +129,10 @@ impl UnionSignature {
129
129
let attrs = item_tree. attrs ( db, krate, ModItem :: from ( loc. id . value ) . into ( ) ) ;
130
130
let mut flags = StructFlags :: empty ( ) ;
131
131
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 ;
133
133
}
134
134
if attrs. by_key ( & sym:: fundamental) . exists ( ) {
135
- flags |= StructFlags :: IS_FUNDAMENTAL ;
135
+ flags |= StructFlags :: FUNDAMENTAL ;
136
136
}
137
137
138
138
let repr = attrs. repr ( ) ;
@@ -162,7 +162,7 @@ impl UnionSignature {
162
162
bitflags ! {
163
163
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
164
164
pub struct EnumFlags : u8 {
165
- const IS_RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 4 ;
165
+ const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 1 ;
166
166
}
167
167
}
168
168
@@ -182,7 +182,7 @@ impl EnumSignature {
182
182
let attrs = item_tree. attrs ( db, loc. container . krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
183
183
let mut flags = EnumFlags :: empty ( ) ;
184
184
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 ;
186
186
}
187
187
188
188
let repr = attrs. repr ( ) ;
@@ -219,8 +219,8 @@ impl EnumSignature {
219
219
bitflags:: bitflags! {
220
220
#[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
221
221
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 ;
224
224
}
225
225
}
226
226
@@ -271,12 +271,12 @@ impl ConstSignature {
271
271
bitflags:: bitflags! {
272
272
#[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
273
273
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 ;
280
280
}
281
281
}
282
282
@@ -302,7 +302,7 @@ impl StaticSignature {
302
302
}
303
303
304
304
if matches ! ( loc. container, ItemContainerId :: ExternBlockId ( _) ) {
305
- flags. insert ( StaticFlags :: IS_EXTERN ) ;
305
+ flags. insert ( StaticFlags :: EXTERN ) ;
306
306
}
307
307
308
308
let source = loc. source ( db) ;
@@ -313,10 +313,10 @@ impl StaticSignature {
313
313
flags. insert ( StaticFlags :: MUTABLE ) ;
314
314
}
315
315
if source. value . unsafe_token ( ) . is_some ( ) {
316
- flags. insert ( StaticFlags :: HAS_UNSAFE ) ;
316
+ flags. insert ( StaticFlags :: UNSAFE ) ;
317
317
}
318
318
if source. value . safe_token ( ) . is_some ( ) {
319
- flags. insert ( StaticFlags :: HAS_SAFE ) ;
319
+ flags. insert ( StaticFlags :: EXPLICIT_SAFE ) ;
320
320
}
321
321
322
322
let ( store, source_map, type_ref) =
@@ -337,8 +337,8 @@ impl StaticSignature {
337
337
bitflags:: bitflags! {
338
338
#[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
339
339
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 ;
342
342
}
343
343
}
344
344
@@ -358,10 +358,10 @@ impl ImplSignature {
358
358
let mut flags = ImplFlags :: empty ( ) ;
359
359
let src = loc. source ( db) ;
360
360
if src. value . unsafe_token ( ) . is_some ( ) {
361
- flags. insert ( ImplFlags :: IS_UNSAFE ) ;
361
+ flags. insert ( ImplFlags :: UNSAFE ) ;
362
362
}
363
363
if src. value . excl_token ( ) . is_some ( ) {
364
- flags. insert ( ImplFlags :: IS_NEGATIVE ) ;
364
+ flags. insert ( ImplFlags :: NEGATIVE ) ;
365
365
}
366
366
367
367
let ( store, source_map, self_ty, target_trait, generic_params) =
@@ -383,13 +383,13 @@ impl ImplSignature {
383
383
bitflags:: bitflags! {
384
384
#[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
385
385
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 ;
393
393
}
394
394
}
395
395
@@ -410,13 +410,13 @@ impl TraitSignature {
410
410
let attrs = item_tree. attrs ( db, loc. container . krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
411
411
let source = loc. source ( db) ;
412
412
if source. value . auto_token ( ) . is_some ( ) {
413
- flags. insert ( TraitFlags :: IS_AUTO ) ;
413
+ flags. insert ( TraitFlags :: AUTO ) ;
414
414
}
415
415
if source. value . unsafe_token ( ) . is_some ( ) {
416
- flags. insert ( TraitFlags :: IS_UNSAFE ) ;
416
+ flags. insert ( TraitFlags :: UNSAFE ) ;
417
417
}
418
418
if attrs. by_key ( & sym:: fundamental) . exists ( ) {
419
- flags |= TraitFlags :: IS_FUNDAMENTAL ;
419
+ flags |= TraitFlags :: FUNDAMENTAL ;
420
420
}
421
421
if attrs. by_key ( & sym:: rustc_has_incoherent_inherent_impls) . exists ( ) {
422
422
flags |= TraitFlags :: RUSTC_HAS_INCOHERENT_INHERENT_IMPLS ;
@@ -489,21 +489,21 @@ impl TraitAliasSignature {
489
489
bitflags ! {
490
490
#[ derive( Debug , Clone , Copy , Eq , PartialEq , Default ) ]
491
491
pub struct FnFlags : u16 {
492
- const HAS_SELF_PARAM = 1 << 0 ;
493
492
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 ;
500
500
/// The `#[target_feature]` attribute is necessary to check safety (with RFC 2396),
501
501
/// but keeping it for all functions will consume a lot of memory when there are
502
502
/// only very few functions with it. So we only encode its existence here, and lookup
503
503
/// 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 ;
507
507
}
508
508
}
509
509
@@ -532,7 +532,7 @@ impl FunctionSignature {
532
532
let mut flags = FnFlags :: empty ( ) ;
533
533
let attrs = item_tree. attrs ( db, module. krate , ModItem :: from ( loc. id . value ) . into ( ) ) ;
534
534
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 ) ;
536
536
}
537
537
538
538
if attrs. by_key ( & sym:: target_feature) . exists ( ) {
@@ -546,20 +546,20 @@ impl FunctionSignature {
546
546
if attrs. by_key ( & sym:: rustc_deprecated_safe_2024) . exists ( ) {
547
547
flags. insert ( FnFlags :: DEPRECATED_SAFE_2024 ) ;
548
548
} else {
549
- flags. insert ( FnFlags :: HAS_UNSAFE_KW ) ;
549
+ flags. insert ( FnFlags :: UNSAFE ) ;
550
550
}
551
551
}
552
552
if source. value . async_token ( ) . is_some ( ) {
553
- flags. insert ( FnFlags :: HAS_ASYNC_KW ) ;
553
+ flags. insert ( FnFlags :: ASYNC ) ;
554
554
}
555
555
if source. value . const_token ( ) . is_some ( ) {
556
- flags. insert ( FnFlags :: HAS_CONST_KW ) ;
556
+ flags. insert ( FnFlags :: CONST ) ;
557
557
}
558
558
if source. value . default_token ( ) . is_some ( ) {
559
- flags. insert ( FnFlags :: HAS_DEFAULT_KW ) ;
559
+ flags. insert ( FnFlags :: DEFAULT ) ;
560
560
}
561
561
if source. value . safe_token ( ) . is_some ( ) {
562
- flags. insert ( FnFlags :: HAS_SAFE_KW ) ;
562
+ flags. insert ( FnFlags :: EXPLICIT_SAFE ) ;
563
563
}
564
564
if source. value . body ( ) . is_some ( ) {
565
565
flags. insert ( FnFlags :: HAS_BODY ) ;
@@ -575,7 +575,7 @@ impl FunctionSignature {
575
575
flags. insert ( FnFlags :: HAS_SELF_PARAM ) ;
576
576
}
577
577
if variadic {
578
- flags. insert ( FnFlags :: IS_VARARGS ) ;
578
+ flags. insert ( FnFlags :: HAS_VARARGS ) ;
579
579
}
580
580
(
581
581
Arc :: new ( FunctionSignature {
@@ -603,31 +603,31 @@ impl FunctionSignature {
603
603
}
604
604
605
605
pub fn is_default ( & self ) -> bool {
606
- self . flags . contains ( FnFlags :: HAS_DEFAULT_KW )
606
+ self . flags . contains ( FnFlags :: DEFAULT )
607
607
}
608
608
609
609
pub fn is_const ( & self ) -> bool {
610
- self . flags . contains ( FnFlags :: HAS_CONST_KW )
610
+ self . flags . contains ( FnFlags :: CONST )
611
611
}
612
612
613
613
pub fn is_async ( & self ) -> bool {
614
- self . flags . contains ( FnFlags :: HAS_ASYNC_KW )
614
+ self . flags . contains ( FnFlags :: ASYNC )
615
615
}
616
616
617
617
pub fn is_unsafe ( & self ) -> bool {
618
- self . flags . contains ( FnFlags :: HAS_UNSAFE_KW )
618
+ self . flags . contains ( FnFlags :: UNSAFE )
619
619
}
620
620
621
621
pub fn is_deprecated_safe_2024 ( & self ) -> bool {
622
622
self . flags . contains ( FnFlags :: DEPRECATED_SAFE_2024 )
623
623
}
624
624
625
625
pub fn is_safe ( & self ) -> bool {
626
- self . flags . contains ( FnFlags :: HAS_SAFE_KW )
626
+ self . flags . contains ( FnFlags :: EXPLICIT_SAFE )
627
627
}
628
628
629
629
pub fn is_varargs ( & self ) -> bool {
630
- self . flags . contains ( FnFlags :: IS_VARARGS )
630
+ self . flags . contains ( FnFlags :: HAS_VARARGS )
631
631
}
632
632
633
633
pub fn has_target_feature ( & self ) -> bool {
@@ -637,10 +637,10 @@ impl FunctionSignature {
637
637
638
638
bitflags ! {
639
639
#[ 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 ;
644
644
}
645
645
}
646
646
@@ -669,10 +669,10 @@ impl TypeAliasSignature {
669
669
ModItem :: from ( loc. id . value ) . into ( ) ,
670
670
) ;
671
671
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 ) ;
673
673
}
674
674
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 ) ;
676
676
}
677
677
if matches ! ( loc. container, ItemContainerId :: ExternBlockId ( _) ) {
678
678
flags. insert ( TypeAliasFlags :: IS_EXTERN ) ;
0 commit comments