@@ -696,11 +696,6 @@ pub fn fields(
696
696
}
697
697
698
698
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
- } ;
704
699
let proxy = if width == 1 {
705
700
let wproxy = Ident :: new (
706
701
match mwv {
@@ -718,7 +713,7 @@ pub fn fields(
718
713
} ,
719
714
span,
720
715
) ;
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 > }
722
717
} else {
723
718
let wproxy = Ident :: new (
724
719
if unsafety {
@@ -729,25 +724,17 @@ pub fn fields(
729
724
span,
730
725
) ;
731
726
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 > }
733
728
} ;
734
729
mod_items. extend ( quote ! {
735
730
#[ doc = #writerdoc]
736
- pub type #name_pc_w<' a #gen_offset > = #proxy;
731
+ pub type #name_pc_w<' a, const O : u8 > = #proxy;
737
732
} ) ;
738
733
}
739
734
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
751
738
}
752
739
} ) ;
753
740
}
@@ -784,10 +771,11 @@ pub fn fields(
784
771
}
785
772
} else {
786
773
let doc = description_with_bits ( description_raw, offset, width) ;
774
+ let offset = util:: unsuffixed ( offset as u64 ) ;
787
775
w_impl_items. extend ( quote ! {
788
776
#[ doc = #doc]
789
777
#inline
790
- pub fn #name_sc( & mut self ) -> #name_pc_w {
778
+ pub fn #name_sc( & mut self ) -> #name_pc_w<#offset> {
791
779
#name_pc_w:: new( self )
792
780
}
793
781
} ) ;
0 commit comments