File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -753,7 +753,11 @@ impl TraceDeriveInput {
753753 let traced_field_types = self . determine_field_types ( false ) ;
754754 let all_field_types = self . determine_field_types ( true ) ;
755755 let needs_trace = traced_field_types. iter ( ) . map ( |ty| quote_spanned ! ( ty. span( ) => <#ty as zerogc:: Trace >:: NEEDS_TRACE ) ) ;
756- let needs_drop = all_field_types. iter ( ) . map ( |ty| quote_spanned ! ( ty. span( ) => <#ty as zerogc:: Trace >:: NEEDS_DROP ) ) ;
756+ let needs_drop = all_field_types. iter ( ) . map ( |ty| if traced_field_types. contains ( ty) {
757+ quote_spanned ! ( ty. span( ) => <#ty as zerogc:: Trace >:: NEEDS_DROP )
758+ } else {
759+ quote_spanned ! ( ty. span( ) => core:: mem:: needs_drop:: <#ty>( ) )
760+ } ) ;
757761 let assoc_constants = if !immutable {
758762 Some ( quote ! {
759763 const NEEDS_TRACE : bool = #( #needs_trace || ) * false /* NOTE: Default to *false* if we have no GC types inside */ ;
Original file line number Diff line number Diff line change @@ -99,9 +99,15 @@ struct UnsafeSkipped<'gc> {
9999 s : & ' static str ,
100100 i : i32 ,
101101 #[ zerogc( unsafe_skip_trace) ]
102- wow : Gc < ' gc , i32 , EpsilonCollectorId >
102+ wow : Gc < ' gc , i32 , EpsilonCollectorId > ,
103+ #[ zerogc( unsafe_skip_trace) ]
104+ not_impld : NotImplTrace
103105}
104106
107+
108+ /// A type that doesn't implement `Trace`
109+ struct NotImplTrace ;
110+
105111#[ derive( Trace ) ]
106112#[ zerogc( ignore_lifetimes( "'a" ) , immutable, collector_ids( EpsilonCollectorId ) ) ]
107113#[ allow( unused) ]
You can’t perform that action at this time.
0 commit comments