This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
librustc_expand/parse/lexer Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,13 @@ fn t1() {
5050 assert_eq ! ( string_reader. next_token( ) , token:: Whitespace ) ;
5151 // Read another token.
5252 let tok3 = string_reader. next_token ( ) ;
53- assert_eq ! ( string_reader. pos. clone ( ) , BytePos ( 28 ) ) ;
53+ assert_eq ! ( string_reader. pos( ) , BytePos ( 28 ) ) ;
5454 let tok4 = Token :: new ( mk_ident ( "main" ) , Span :: with_root_ctxt ( BytePos ( 24 ) , BytePos ( 28 ) ) ) ;
5555 assert_eq ! ( tok3. kind, tok4. kind) ;
5656 assert_eq ! ( tok3. span, tok4. span) ;
5757
5858 assert_eq ! ( string_reader. next_token( ) , token:: OpenDelim ( token:: Paren ) ) ;
59- assert_eq ! ( string_reader. pos. clone ( ) , BytePos ( 29 ) )
59+ assert_eq ! ( string_reader. pos( ) , BytePos ( 29 ) )
6060 } )
6161}
6262
Original file line number Diff line number Diff line change @@ -31,8 +31,7 @@ pub struct StringReader<'a> {
3131 /// Initial position, read-only.
3232 start_pos : BytePos ,
3333 /// The absolute offset within the source_map of the current character.
34- // FIXME(#64197): `pub` is needed by tests for now.
35- pub pos : BytePos ,
34+ pos : BytePos ,
3635 /// Stop reading src at this index.
3736 end_src_index : usize ,
3837 /// Source text to tokenize.
@@ -436,6 +435,10 @@ impl<'a> StringReader<'a> {
436435 }
437436 }
438437
438+ pub fn pos ( & self ) -> BytePos {
439+ self . pos
440+ }
441+
439442 #[ inline]
440443 fn src_index ( & self , pos : BytePos ) -> usize {
441444 ( pos - self . start_pos ) . to_usize ( )
You can’t perform that action at this time.
0 commit comments