@@ -29,15 +29,15 @@ pub struct AttrWrapper {
2929 // The start of the outer attributes in the token cursor.
3030 // This allows us to create a `ReplaceRange` for the entire attribute
3131 // target, including outer attributes.
32- start_pos : usize ,
32+ start_pos : u32 ,
3333}
3434
3535impl AttrWrapper {
36- pub ( super ) fn new ( attrs : AttrVec , start_pos : usize ) -> AttrWrapper {
36+ pub ( super ) fn new ( attrs : AttrVec , start_pos : u32 ) -> AttrWrapper {
3737 AttrWrapper { attrs, start_pos }
3838 }
3939 pub fn empty ( ) -> AttrWrapper {
40- AttrWrapper { attrs : AttrVec :: new ( ) , start_pos : usize :: MAX }
40+ AttrWrapper { attrs : AttrVec :: new ( ) , start_pos : u32 :: MAX }
4141 }
4242
4343 pub ( crate ) fn take_for_recovery ( self , psess : & ParseSess ) -> AttrVec {
@@ -91,7 +91,7 @@ fn has_cfg_or_cfg_attr(attrs: &[Attribute]) -> bool {
9191struct LazyAttrTokenStreamImpl {
9292 start_token : ( Token , Spacing ) ,
9393 cursor_snapshot : TokenCursor ,
94- num_calls : usize ,
94+ num_calls : u32 ,
9595 break_last_token : bool ,
9696 replace_ranges : Box < [ ReplaceRange ] > ,
9797}
@@ -110,7 +110,7 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
110110 let token = cursor_snapshot. next ( ) ;
111111 ( FlatToken :: Token ( token. 0 ) , token. 1 )
112112 } ) )
113- . take ( self . num_calls ) ;
113+ . take ( self . num_calls as usize ) ;
114114
115115 if self . replace_ranges . is_empty ( ) {
116116 make_token_stream ( tokens, self . break_last_token )
@@ -296,12 +296,12 @@ impl<'a> Parser<'a> {
296296 ) ;
297297
298298 let end_pos = self . num_bump_calls
299- + captured_trailing as usize
299+ + captured_trailing as u32
300300 // If we 'broke' the last token (e.g. breaking a '>>' token to two '>' tokens), then
301301 // extend the range of captured tokens to include it, since the parser was not actually
302302 // bumped past it. When the `LazyAttrTokenStream` gets converted into an
303303 // `AttrTokenStream`, we will create the proper token.
304- + self . break_last_token as usize ;
304+ + self . break_last_token as u32 ;
305305
306306 let num_calls = end_pos - start_pos;
307307
@@ -459,6 +459,6 @@ mod size_asserts {
459459 use rustc_data_structures:: static_assert_size;
460460 // tidy-alphabetical-start
461461 static_assert_size ! ( AttrWrapper , 16 ) ;
462- static_assert_size ! ( LazyAttrTokenStreamImpl , 104 ) ;
462+ static_assert_size ! ( LazyAttrTokenStreamImpl , 96 ) ;
463463 // tidy-alphabetical-end
464464}
0 commit comments