@@ -73,12 +73,12 @@ fn unlikely(b: bool) -> bool {
73
73
}
74
74
75
75
#[ cfg( feature = "nightly" ) ]
76
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
76
+ #[ inline]
77
77
unsafe fn offset_from < T > ( to : * const T , from : * const T ) -> usize {
78
78
to. offset_from ( from) as usize
79
79
}
80
80
#[ cfg( not( feature = "nightly" ) ) ]
81
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
81
+ #[ inline]
82
82
unsafe fn offset_from < T > ( to : * const T , from : * const T ) -> usize {
83
83
( to as usize - from as usize ) / mem:: size_of :: < T > ( )
84
84
}
@@ -292,14 +292,14 @@ pub struct Bucket<T> {
292
292
unsafe impl < T > Send for Bucket < T > { }
293
293
294
294
impl < T > Clone for Bucket < T > {
295
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
295
+ #[ inline]
296
296
fn clone ( & self ) -> Self {
297
297
Self { ptr : self . ptr }
298
298
}
299
299
}
300
300
301
301
impl < T > Bucket < T > {
302
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
302
+ #[ inline]
303
303
unsafe fn from_base_index ( base : NonNull < T > , index : usize ) -> Self {
304
304
let ptr = if mem:: size_of :: < T > ( ) == 0 {
305
305
// won't overflow because index must be less than length
@@ -311,15 +311,15 @@ impl<T> Bucket<T> {
311
311
ptr : NonNull :: new_unchecked ( ptr) ,
312
312
}
313
313
}
314
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
314
+ #[ inline]
315
315
unsafe fn to_base_index ( & self , base : NonNull < T > ) -> usize {
316
316
if mem:: size_of :: < T > ( ) == 0 {
317
317
self . ptr . as_ptr ( ) as usize - 1
318
318
} else {
319
319
offset_from ( base. as_ptr ( ) , self . ptr . as_ptr ( ) )
320
320
}
321
321
}
322
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
322
+ #[ inline]
323
323
pub fn as_ptr ( & self ) -> * mut T {
324
324
if mem:: size_of :: < T > ( ) == 0 {
325
325
// Just return an arbitrary ZST pointer which is properly aligned
@@ -328,7 +328,7 @@ impl<T> Bucket<T> {
328
328
unsafe { self . ptr . as_ptr ( ) . sub ( 1 ) }
329
329
}
330
330
}
331
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
331
+ #[ inline]
332
332
unsafe fn next_n ( & self , offset : usize ) -> Self {
333
333
let ptr = if mem:: size_of :: < T > ( ) == 0 {
334
334
( self . ptr . as_ptr ( ) as usize + offset) as * mut T
@@ -343,24 +343,24 @@ impl<T> Bucket<T> {
343
343
pub unsafe fn drop ( & self ) {
344
344
self . as_ptr ( ) . drop_in_place ( ) ;
345
345
}
346
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
346
+ #[ inline]
347
347
pub unsafe fn read ( & self ) -> T {
348
348
self . as_ptr ( ) . read ( )
349
349
}
350
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
350
+ #[ inline]
351
351
pub unsafe fn write ( & self , val : T ) {
352
352
self . as_ptr ( ) . write ( val) ;
353
353
}
354
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
354
+ #[ inline]
355
355
pub unsafe fn as_ref < ' a > ( & self ) -> & ' a T {
356
356
& * self . as_ptr ( )
357
357
}
358
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
358
+ #[ inline]
359
359
pub unsafe fn as_mut < ' a > ( & self ) -> & ' a mut T {
360
360
& mut * self . as_ptr ( )
361
361
}
362
362
#[ cfg( feature = "raw" ) ]
363
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
363
+ #[ inline]
364
364
pub unsafe fn copy_from_nonoverlapping ( & self , other : & Self ) {
365
365
self . as_ptr ( ) . copy_from_nonoverlapping ( other. as_ptr ( ) , 1 ) ;
366
366
}
@@ -399,7 +399,7 @@ impl<T> RawTable<T, Global> {
399
399
/// In effect this returns a table with exactly 1 bucket. However we can
400
400
/// leave the data pointer dangling since that bucket is never written to
401
401
/// due to our load factor forcing us to always have at least 1 free bucket.
402
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
402
+ #[ inline]
403
403
pub const fn new ( ) -> Self {
404
404
Self {
405
405
table : RawTableInner :: new_in ( Global ) ,
@@ -428,7 +428,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
428
428
/// In effect this returns a table with exactly 1 bucket. However we can
429
429
/// leave the data pointer dangling since that bucket is never written to
430
430
/// due to our load factor forcing us to always have at least 1 free bucket.
431
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
431
+ #[ inline]
432
432
pub fn new_in ( alloc : A ) -> Self {
433
433
Self {
434
434
table : RawTableInner :: new_in ( alloc) ,
@@ -506,26 +506,26 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
506
506
}
507
507
508
508
/// Returns pointer to one past last element of data table.
509
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
509
+ #[ inline]
510
510
pub unsafe fn data_end ( & self ) -> NonNull < T > {
511
511
NonNull :: new_unchecked ( self . table . ctrl . as_ptr ( ) . cast ( ) )
512
512
}
513
513
514
514
/// Returns pointer to start of data table.
515
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
515
+ #[ inline]
516
516
#[ cfg( feature = "nightly" ) ]
517
517
pub unsafe fn data_start ( & self ) -> * mut T {
518
518
self . data_end ( ) . as_ptr ( ) . wrapping_sub ( self . buckets ( ) )
519
519
}
520
520
521
521
/// Returns the index of a bucket from a `Bucket`.
522
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
522
+ #[ inline]
523
523
pub unsafe fn bucket_index ( & self , bucket : & Bucket < T > ) -> usize {
524
524
bucket. to_base_index ( self . data_end ( ) )
525
525
}
526
526
527
527
/// Returns a pointer to an element in the table.
528
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
528
+ #[ inline]
529
529
pub unsafe fn bucket ( & self , index : usize ) -> Bucket < T > {
530
530
debug_assert_ne ! ( self . table. bucket_mask, 0 ) ;
531
531
debug_assert ! ( index < self . buckets( ) ) ;
@@ -913,19 +913,19 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
913
913
///
914
914
/// This number is a lower bound; the table might be able to hold
915
915
/// more, but is guaranteed to be able to hold at least this many.
916
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
916
+ #[ inline]
917
917
pub fn capacity ( & self ) -> usize {
918
918
self . table . items + self . table . growth_left
919
919
}
920
920
921
921
/// Returns the number of elements in the table.
922
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
922
+ #[ inline]
923
923
pub fn len ( & self ) -> usize {
924
924
self . table . items
925
925
}
926
926
927
927
/// Returns the number of buckets in the table.
928
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
928
+ #[ inline]
929
929
pub fn buckets ( & self ) -> usize {
930
930
self . table . bucket_mask + 1
931
931
}
@@ -934,7 +934,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
934
934
/// the caller to ensure that the `RawTable` outlives the `RawIter`.
935
935
/// Because we cannot make the `next` method unsafe on the `RawIter`
936
936
/// struct, we have to make the `iter` method unsafe.
937
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
937
+ #[ inline]
938
938
pub unsafe fn iter ( & self ) -> RawIter < T > {
939
939
let data = Bucket :: from_base_index ( self . data_end ( ) , 0 ) ;
940
940
RawIter {
@@ -1031,7 +1031,7 @@ unsafe impl<T, A: Allocator + Clone> Send for RawTable<T, A> where T: Send {}
1031
1031
unsafe impl < T , A : Allocator + Clone > Sync for RawTable < T , A > where T : Sync { }
1032
1032
1033
1033
impl < A > RawTableInner < A > {
1034
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1034
+ #[ inline]
1035
1035
const fn new_in ( alloc : A ) -> Self {
1036
1036
Self {
1037
1037
// Be careful to cast the entire slice to a raw pointer.
@@ -1204,22 +1204,22 @@ impl<A: Allocator + Clone> RawTableInner<A> {
1204
1204
}
1205
1205
}
1206
1206
1207
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1207
+ #[ inline]
1208
1208
unsafe fn bucket < T > ( & self , index : usize ) -> Bucket < T > {
1209
1209
debug_assert_ne ! ( self . bucket_mask, 0 ) ;
1210
1210
debug_assert ! ( index < self . buckets( ) ) ;
1211
1211
Bucket :: from_base_index ( self . data_end ( ) , index)
1212
1212
}
1213
1213
1214
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1214
+ #[ inline]
1215
1215
unsafe fn bucket_ptr ( & self , index : usize , size_of : usize ) -> * mut u8 {
1216
1216
debug_assert_ne ! ( self . bucket_mask, 0 ) ;
1217
1217
debug_assert ! ( index < self . buckets( ) ) ;
1218
1218
let base: * mut u8 = self . data_end ( ) . as_ptr ( ) ;
1219
1219
base. sub ( ( index + 1 ) * size_of)
1220
1220
}
1221
1221
1222
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1222
+ #[ inline]
1223
1223
unsafe fn data_end < T > ( & self ) -> NonNull < T > {
1224
1224
NonNull :: new_unchecked ( self . ctrl . as_ptr ( ) . cast ( ) )
1225
1225
}
@@ -1771,7 +1771,7 @@ impl<T: Clone, A: Allocator + Clone> RawTable<T, A> {
1771
1771
}
1772
1772
1773
1773
impl < T , A : Allocator + Clone + Default > Default for RawTable < T , A > {
1774
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1774
+ #[ inline]
1775
1775
fn default ( ) -> Self {
1776
1776
Self :: new_in ( Default :: default ( ) )
1777
1777
}
@@ -1945,7 +1945,7 @@ impl<T> Iterator for RawIterRange<T> {
1945
1945
}
1946
1946
}
1947
1947
1948
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
1948
+ #[ inline]
1949
1949
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1950
1950
// We don't have an item count, so just guess based on the range size.
1951
1951
(
@@ -2127,7 +2127,7 @@ impl<T> Iterator for RawIter<T> {
2127
2127
}
2128
2128
}
2129
2129
2130
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
2130
+ #[ inline]
2131
2131
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2132
2132
( self . items , Some ( self . items ) )
2133
2133
}
@@ -2193,7 +2193,7 @@ impl<T, A: Allocator + Clone> Iterator for RawIntoIter<T, A> {
2193
2193
unsafe { Some ( self . iter . next ( ) ?. read ( ) ) }
2194
2194
}
2195
2195
2196
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
2196
+ #[ inline]
2197
2197
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2198
2198
self . iter . size_hint ( )
2199
2199
}
@@ -2257,7 +2257,7 @@ impl<T, A: Allocator + Clone> Iterator for RawDrain<'_, T, A> {
2257
2257
}
2258
2258
}
2259
2259
2260
- #[ cfg_attr ( feature = " inline-more" , inline ) ]
2260
+ #[ inline]
2261
2261
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2262
2262
self . iter . size_hint ( )
2263
2263
}
0 commit comments