about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-07-27 12:50:22 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-08-01 08:11:15 +1000
commitbd23d68b4133fdf849544e8cbd866d86b535934d (patch)
tree23260055cd4e0e27914c31cde849f807e553842c /compiler/rustc_parse/src
parent55185992d6f4ef3c01aaab545488863d21232d8d (diff)
downloadrust-bd23d68b4133fdf849544e8cbd866d86b535934d.tar.gz
rust-bd23d68b4133fdf849544e8cbd866d86b535934d.zip
Remove `StringReader::end_src_index`.
It not needed, always being set to the end of the text.
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/lexer/mod.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs
index 90df8dbd445..5868036c737 100644
--- a/compiler/rustc_parse/src/lexer/mod.rs
+++ b/compiler/rustc_parse/src/lexer/mod.rs
@@ -37,8 +37,7 @@ pub(crate) fn parse_token_trees<'a>(
     start_pos: BytePos,
     override_span: Option<Span>,
 ) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>) {
-    StringReader { sess, start_pos, pos: start_pos, end_src_index: src.len(), src, override_span }
-        .into_token_trees()
+    StringReader { sess, start_pos, pos: start_pos, src, override_span }.into_token_trees()
 }
 
 struct StringReader<'a> {
@@ -47,8 +46,6 @@ struct StringReader<'a> {
     start_pos: BytePos,
     /// The absolute offset within the source_map of the current character.
     pos: BytePos,
-    /// Stop reading src at this index.
-    end_src_index: usize,
     /// Source text to tokenize.
     src: &'a str,
     override_span: Option<Span>,
@@ -74,7 +71,7 @@ impl<'a> StringReader<'a> {
         // Skip trivial (whitespace & comments) tokens
         loop {
             let start_src_index = self.src_index(self.pos);
-            let text: &str = &self.src[start_src_index..self.end_src_index];
+            let text: &str = &self.src[start_src_index..];
 
             if text.is_empty() {
                 let span = self.mk_sp(self.pos, self.pos);