File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -753,11 +753,17 @@ 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| 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 ) ]
758
758
} 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
+ } ;
761
767
let assoc_constants = if !immutable {
762
768
Some ( quote ! {
763
769
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