@@ -696,11 +696,6 @@ pub fn fields(
696696 }
697697
698698 if !derived {
699- let ( offset, gen_offset) = if field_dim. is_some ( ) {
700- ( quote ! { O } , quote ! { , const O : u8 } )
701- } else {
702- ( util:: unsuffixed ( offset as u64 ) , quote ! { } )
703- } ;
704699 let proxy = if width == 1 {
705700 let wproxy = Ident :: new (
706701 match mwv {
@@ -718,7 +713,7 @@ pub fn fields(
718713 } ,
719714 span,
720715 ) ;
721- quote ! { crate :: #wproxy<' a, #rty, #name_uc_spec, #name_pc_aw, #offset > }
716+ quote ! { crate :: #wproxy<' a, #rty, #name_uc_spec, #name_pc_aw, O > }
722717 } else {
723718 let wproxy = Ident :: new (
724719 if unsafety {
@@ -729,25 +724,17 @@ pub fn fields(
729724 span,
730725 ) ;
731726 let width = & util:: unsuffixed ( width as _ ) ;
732- quote ! { crate :: #wproxy<' a, #rty, #name_uc_spec, #fty, #name_pc_aw, #width, #offset > }
727+ quote ! { crate :: #wproxy<' a, #rty, #name_uc_spec, #fty, #name_pc_aw, #width, O > }
733728 } ;
734729 mod_items. extend ( quote ! {
735730 #[ doc = #writerdoc]
736- pub type #name_pc_w<' a #gen_offset > = #proxy;
731+ pub type #name_pc_w<' a, const O : u8 > = #proxy;
737732 } ) ;
738733 }
739734 if !proxy_items. is_empty ( ) {
740- mod_items. extend ( if field_dim. is_some ( ) {
741- quote ! {
742- impl <' a, const O : u8 > #name_pc_w<' a, O > {
743- #proxy_items
744- }
745- }
746- } else {
747- quote ! {
748- impl <' a> #name_pc_w<' a> {
749- #proxy_items
750- }
735+ mod_items. extend ( quote ! {
736+ impl <' a, const O : u8 > #name_pc_w<' a, O > {
737+ #proxy_items
751738 }
752739 } ) ;
753740 }
@@ -784,10 +771,11 @@ pub fn fields(
784771 }
785772 } else {
786773 let doc = description_with_bits ( description_raw, offset, width) ;
774+ let offset = util:: unsuffixed ( offset as u64 ) ;
787775 w_impl_items. extend ( quote ! {
788776 #[ doc = #doc]
789777 #inline
790- pub fn #name_sc( & mut self ) -> #name_pc_w {
778+ pub fn #name_sc( & mut self ) -> #name_pc_w<#offset> {
791779 #name_pc_w:: new( self )
792780 }
793781 } ) ;
0 commit comments