File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -753,11 +753,17 @@ 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| if traced_field_types . contains ( ty ) {
757- quote_spanned ! ( ty . span ( ) => <#ty as zerogc :: Trace > :: NEEDS_DROP )
756+ let needs_drop = if self . is_copy {
757+ vec ! [ quote! ( false ) ]
758758 } else {
759- quote_spanned ! ( ty. span( ) => core:: mem:: needs_drop:: <#ty>( ) )
760- } ) ;
759+ all_field_types. iter ( ) . map ( |ty| {
760+ if traced_field_types. contains ( ty) {
761+ quote_spanned ! ( ty. span( ) => <#ty as zerogc:: Trace >:: NEEDS_DROP )
762+ } else {
763+ quote_spanned ! ( ty. span( ) => core:: mem:: needs_drop:: <#ty>( ) )
764+ }
765+ } ) . collect :: < Vec < _ > > ( )
766+ } ;
761767 let assoc_constants = if !immutable {
762768 Some ( quote ! {
763769 const NEEDS_TRACE : bool = #( #needs_trace || ) * false /* NOTE: Default to *false* if we have no GC types inside */ ;
You can’t perform that action at this time.
0 commit comments