@@ -760,7 +760,7 @@ pub( super ) fn handle_struct_non_zero_variant
760760 def_types_bound_generics_vec. push ( formed_param ) ;
761761 let def_types_bound_generics = Punctuated :: < _ , Comma > :: from_iter ( def_types_bound_generics_vec ) ;
762762
763- where_clause_with_end_bound = quote ! { #where_clause_with_end_bound End2 : former:: FormingEnd < #def_types_name< #def_types_bound_generics > > } ; // Use constructed list
763+ where_clause_with_end_bound = quote ! { #where_clause_with_end_bound End2 : former:: FormingEnd < #def_types_name< Context2 , Formed2 > > } ; // Use generic parameters directly
764764
765765 quote !
766766 {
@@ -806,7 +806,7 @@ pub( super ) fn handle_struct_non_zero_variant
806806 def_types_bound_generics_vec. push ( context_param. clone ( ) ) ;
807807 def_types_bound_generics_vec. push ( formed_param. clone ( ) ) ;
808808 let def_types_bound_generics = Punctuated :: < _ , Comma > :: from_iter ( def_types_bound_generics_vec ) ;
809- former_where_predicates. push ( parse_quote ! { Definition :: Types : former:: FormerDefinitionTypes < Storage = #storage_struct_name< #enum_generics_ty_no_comma >, Context = ( ) , Formed = #enum_name< #enum_generics_ty_no_comma > > } ) ; // Use no_comma, () and EnumName for Context/Formed
809+ former_where_predicates. push ( parse_quote ! { Definition :: Types : former:: FormerDefinitionTypes < Storage = #storage_struct_name< #enum_generics_ty_no_comma >, Context = Context2 , Formed = Formed2 > } ) ; // Use generic parameters directly
810810 // Add FormerMutator bound
811811 former_where_predicates. push ( parse_quote ! { Definition :: Types : former:: FormerMutator } ) ;
812812 // Add enum's original where clause predicates
@@ -886,7 +886,6 @@ pub( super ) fn handle_struct_non_zero_variant
886886 impl < #former_generics_impl > #former_name < #former_generics_ty_no_comma > // Use no_comma
887887 where #former_impl_where_clause // Use the constructed where clause with bounds
888888 {
889- use former:: FormingEnd ; // Bring FormingEnd trait into scope
890889 // Standard former methods (new, begin, form, end) - Adjusted to use Definition::Types
891890 #[ inline( always ) ] pub fn new( on_end : Definition :: End ) -> Self { Self :: begin( None , None , on_end ) }
892891 #[ inline( always ) ] pub fn new_coercing< IntoEnd >( end : IntoEnd ) -> Self where IntoEnd : Into < Definition :: End > { Self :: begin_coercing( None , None , end ) }
@@ -966,33 +965,38 @@ pub( super ) fn handle_struct_non_zero_variant
966965 quote !
967966 {
968967 #[ automatically_derived ]
969- impl < #enum_generics_impl > former:: FormingEnd
968+ impl < #enum_generics_impl, Context2 , Formed2 > former:: FormingEnd
970969 <
971970 // Correct generics usage and add comma_if_enum_generics
972- #def_types_name< #forming_end_def_types_generics > // Use constructed list
971+ #def_types_name< Context2 , Formed2 > // Use generic parameters directly
973972 >
974973 for #end_struct_name < #enum_generics_ty_no_comma > // Use no_comma
975- #where_clause_tokens
974+ where
975+ Context2 : ' static , // Placeholder bound
976+ Formed2 : ' static , // Placeholder bound
977+ #where_clause_tokens // Include original where clause
976978 {
977979 #[ inline( always ) ]
978980 fn call
979981 (
980982 & self ,
981983 sub_storage : #storage_struct_name< #enum_generics_ty_no_comma >, // Use no_comma
982- _context : Option < ( ) >,
984+ _context : Option < Context2 >, // Use Context2 generic parameter
983985 )
984986 ->
985987 #enum_name< #enum_generics_ty_no_comma > // Use no_comma
986988 {
987989 // Correctly destructure the tuple from preform and use field names
988990 let preformed_tuple = former:: StoragePreform :: preform( sub_storage ) ;
991+ // Destructure the tuple into named fields
992+ let ( #( #field_idents_for_construction ) , * ) = preformed_tuple;
989993 #enum_name:: #variant_ident
990994 {
991- #( #field_idents_for_construction : preformed_tuple . #tuple_indices ) , * // Construct using field names
995+ #( #field_idents_for_construction ) , * // Use the bound variables
992996 }
993- }
994- }
995- }
997+ }
998+ }
999+ }
9961000 } ;
9971001 ctx. end_impls . push ( forming_end_impl_tokens ) ;
9981002 // --- Generate Static Method ---
0 commit comments