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 {
753
753
let traced_field_types = self . determine_field_types ( false ) ;
754
754
let all_field_types = self . determine_field_types ( true ) ;
755
755
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
+ } ) ;
757
761
let assoc_constants = if !immutable {
758
762
Some ( quote ! {
759
763
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> {
99
99
s : & ' static str ,
100
100
i : i32 ,
101
101
#[ 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
103
105
}
104
106
107
+
108
+ /// A type that doesn't implement `Trace`
109
+ struct NotImplTrace ;
110
+
105
111
#[ derive( Trace ) ]
106
112
#[ zerogc( ignore_lifetimes( "'a" ) , immutable, collector_ids( EpsilonCollectorId ) ) ]
107
113
#[ allow( unused) ]
You can’t perform that action at this time.
0 commit comments