@@ -169,7 +169,6 @@ impl StringCache {
169
169
170
170
// NOTE: Deriving Eq here implies that a given string must always
171
171
// be interned the same way.
172
- #[ cfg_attr( feature = "unstable" , unsafe_no_drop_flag) ] // See tests::atom_drop_is_idempotent
173
172
#[ derive( Eq , Hash , PartialEq ) ]
174
173
pub struct Atom {
175
174
/// This field is public so that the `atom!()` macro can use it.
@@ -714,9 +713,16 @@ mod tests {
714
713
715
714
#[ test]
716
715
fn assert_sizes ( ) {
717
- // Guard against accidental changes to the sizes of things.
718
716
use std:: mem;
719
- assert_eq ! ( if cfg!( feature = "unstable" ) { 8 } else { 16 } , mem:: size_of:: <super :: Atom >( ) ) ;
717
+ struct EmptyWithDrop ;
718
+ impl Drop for EmptyWithDrop {
719
+ fn drop ( & mut self ) { }
720
+ }
721
+ let compiler_uses_inline_drop_flags = mem:: size_of :: < EmptyWithDrop > ( ) > 0 ;
722
+
723
+ // Guard against accidental changes to the sizes of things.
724
+ assert_eq ! ( mem:: size_of:: <super :: Atom >( ) ,
725
+ if compiler_uses_inline_drop_flags { 16 } else { 8 } ) ;
720
726
assert_eq ! ( 40 , mem:: size_of:: <super :: StringCacheEntry >( ) ) ;
721
727
}
722
728
@@ -771,18 +777,6 @@ mod tests {
771
777
let _: & str = atom. as_ref ( ) ;
772
778
}
773
779
774
- /// Atom uses #[unsafe_no_drop_flag] to stay small, so drop() may be called more than once.
775
- /// In calls after the first one, the atom will be filled with a POST_DROP value.
776
- /// drop() must be a no-op in this case.
777
- #[ cfg( feature = "unstable" ) ]
778
- #[ test]
779
- fn atom_drop_is_idempotent ( ) {
780
- use super :: from_packed_dynamic;
781
- unsafe {
782
- assert_eq ! ( from_packed_dynamic( mem:: POST_DROP_U64 ) , None ) ;
783
- }
784
- }
785
-
786
780
#[ test]
787
781
fn string_cache_entry_alignment_is_sufficient ( ) {
788
782
assert ! ( mem:: align_of:: <StringCacheEntry >( ) >= ENTRY_ALIGNMENT ) ;
0 commit comments