@@ -467,6 +467,7 @@ impl ToTokens for Member {
467
467
let this = value;
468
468
#into
469
469
} ;
470
+ #[ allow( unused_comparisons) ]
470
471
debug_assert!( value <= #mask, "value out of bounds" ) ;
471
472
Self ( self . 0 & !( #mask << #offset) | ( value & #mask) << #offset)
472
473
}
@@ -558,6 +559,7 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
558
559
meta : syn:: Meta :: List ( syn:: MetaList { path, tokens, .. } ) ,
559
560
..
560
561
} if path. is_ident ( "bits" ) => {
562
+ let span = tokens. span ( ) ;
561
563
let BitsAttr {
562
564
bits,
563
565
default,
@@ -567,10 +569,10 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
567
569
568
570
if let Some ( bits) = bits {
569
571
if bits == 0 {
570
- return Err ( syn:: Error :: new ( tokens . span ( ) , "bits cannot bit 0" ) ) ;
572
+ return Err ( syn:: Error :: new ( span, "bits cannot bit 0" ) ) ;
571
573
}
572
574
if ty_bits != 0 && bits > ty_bits {
573
- return Err ( syn:: Error :: new ( tokens . span ( ) , "overflowing field type" ) ) ;
575
+ return Err ( syn:: Error :: new ( span, "overflowing field type" ) ) ;
574
576
}
575
577
ret. bits = bits;
576
578
}
@@ -607,7 +609,7 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
607
609
) ) ;
608
610
}
609
611
610
- // Negative integers need some special handling...
612
+ // Signed integers need some special handling...
611
613
if !ignore && class == TypeClass :: SInt {
612
614
let bits = ret. bits as u32 ;
613
615
let mask: u128 = !0 >> ( u128:: BITS - ret. bits as u32 ) ;
0 commit comments