@@ -18,20 +18,17 @@ use triomphe::Arc;
18
18
pub mod symbols;
19
19
20
20
// some asserts for layout compatibility
21
- const _: ( ) = assert ! ( std :: mem :: size_of:: <Box <str >>( ) == std :: mem :: size_of:: <& str >( ) ) ;
22
- const _: ( ) = assert ! ( std :: mem :: align_of:: <Box <str >>( ) == std :: mem :: align_of:: <& str >( ) ) ;
21
+ const _: ( ) = assert ! ( size_of:: <Box <str >>( ) == size_of:: <& str >( ) ) ;
22
+ const _: ( ) = assert ! ( align_of:: <Box <str >>( ) == align_of:: <& str >( ) ) ;
23
23
24
- const _: ( ) = assert ! ( std :: mem :: size_of:: <Arc <Box <str >>>( ) == std :: mem :: size_of:: <&&str >( ) ) ;
25
- const _: ( ) = assert ! ( std :: mem :: align_of:: <Arc <Box <str >>>( ) == std :: mem :: align_of:: <&&str >( ) ) ;
24
+ const _: ( ) = assert ! ( size_of:: <Arc <Box <str >>>( ) == size_of:: <&&str >( ) ) ;
25
+ const _: ( ) = assert ! ( align_of:: <Arc <Box <str >>>( ) == align_of:: <&&str >( ) ) ;
26
26
27
- const _: ( ) =
28
- assert ! ( std:: mem:: size_of:: <* const * const str >( ) == std:: mem:: size_of:: <TaggedArcPtr >( ) ) ;
29
- const _: ( ) =
30
- assert ! ( std:: mem:: align_of:: <* const * const str >( ) == std:: mem:: align_of:: <TaggedArcPtr >( ) ) ;
27
+ const _: ( ) = assert ! ( size_of:: <* const * const str >( ) == size_of:: <TaggedArcPtr >( ) ) ;
28
+ const _: ( ) = assert ! ( align_of:: <* const * const str >( ) == align_of:: <TaggedArcPtr >( ) ) ;
31
29
32
- const _: ( ) = assert ! ( std:: mem:: size_of:: <Arc <Box <str >>>( ) == std:: mem:: size_of:: <TaggedArcPtr >( ) ) ;
33
- const _: ( ) =
34
- assert ! ( std:: mem:: align_of:: <Arc <Box <str >>>( ) == std:: mem:: align_of:: <TaggedArcPtr >( ) ) ;
30
+ const _: ( ) = assert ! ( size_of:: <Arc <Box <str >>>( ) == size_of:: <TaggedArcPtr >( ) ) ;
31
+ const _: ( ) = assert ! ( align_of:: <Arc <Box <str >>>( ) == align_of:: <TaggedArcPtr >( ) ) ;
35
32
36
33
/// A pointer that points to a pointer to a `str`, it may be backed as a `&'static &'static str` or
37
34
/// `Arc<Box<str>>` but its size is that of a thin pointer. The active variant is encoded as a tag
@@ -49,9 +46,7 @@ impl TaggedArcPtr {
49
46
const BOOL_BITS : usize = true as usize ;
50
47
51
48
const fn non_arc ( r : & ' static & ' static str ) -> Self {
52
- assert ! (
53
- mem:: align_of:: <& ' static & ' static str >( ) . trailing_zeros( ) as usize > Self :: BOOL_BITS
54
- ) ;
49
+ assert ! ( align_of:: <& ' static & ' static str >( ) . trailing_zeros( ) as usize > Self :: BOOL_BITS ) ;
55
50
// SAFETY: The pointer is non-null as it is derived from a reference
56
51
// Ideally we would call out to `pack_arc` but for a `false` tag, unfortunately the
57
52
// packing stuff requires reading out the pointer to an integer which is not supported
@@ -64,9 +59,7 @@ impl TaggedArcPtr {
64
59
}
65
60
66
61
fn arc ( arc : Arc < Box < str > > ) -> Self {
67
- assert ! (
68
- mem:: align_of:: <& ' static & ' static str >( ) . trailing_zeros( ) as usize > Self :: BOOL_BITS
69
- ) ;
62
+ assert ! ( align_of:: <& ' static & ' static str >( ) . trailing_zeros( ) as usize > Self :: BOOL_BITS ) ;
70
63
Self {
71
64
packed : Self :: pack_arc (
72
65
// Safety: `Arc::into_raw` always returns a non null pointer
@@ -131,8 +124,8 @@ impl fmt::Debug for Symbol {
131
124
}
132
125
}
133
126
134
- const _: ( ) = assert ! ( std :: mem :: size_of:: <Symbol >( ) == std :: mem :: size_of:: <NonNull <( ) >>( ) ) ;
135
- const _: ( ) = assert ! ( std :: mem :: align_of:: <Symbol >( ) == std :: mem :: align_of:: <NonNull <( ) >>( ) ) ;
127
+ const _: ( ) = assert ! ( size_of:: <Symbol >( ) == size_of:: <NonNull <( ) >>( ) ) ;
128
+ const _: ( ) = assert ! ( align_of:: <Symbol >( ) == align_of:: <NonNull <( ) >>( ) ) ;
136
129
137
130
static MAP : OnceLock < DashMap < SymbolProxy , ( ) , BuildHasherDefault < FxHasher > > > = OnceLock :: new ( ) ;
138
131
0 commit comments