Skip to content

Commit bd23d68

Browse files
committed
Remove StringReader::end_src_index.
It not needed, always being set to the end of the text.
1 parent 5518599 commit bd23d68

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_parse/src/lexer

1 file changed

+2
-5
lines changed

compiler/rustc_parse/src/lexer/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ pub(crate) fn parse_token_trees<'a>(
3737
start_pos: BytePos,
3838
override_span: Option<Span>,
3939
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>) {
40-
StringReader { sess, start_pos, pos: start_pos, end_src_index: src.len(), src, override_span }
41-
.into_token_trees()
40+
StringReader { sess, start_pos, pos: start_pos, src, override_span }.into_token_trees()
4241
}
4342

4443
struct StringReader<'a> {
@@ -47,8 +46,6 @@ struct StringReader<'a> {
4746
start_pos: BytePos,
4847
/// The absolute offset within the source_map of the current character.
4948
pos: BytePos,
50-
/// Stop reading src at this index.
51-
end_src_index: usize,
5249
/// Source text to tokenize.
5350
src: &'a str,
5451
override_span: Option<Span>,
@@ -74,7 +71,7 @@ impl<'a> StringReader<'a> {
7471
// Skip trivial (whitespace & comments) tokens
7572
loop {
7673
let start_src_index = self.src_index(self.pos);
77-
let text: &str = &self.src[start_src_index..self.end_src_index];
74+
let text: &str = &self.src[start_src_index..];
7875

7976
if text.is_empty() {
8077
let span = self.mk_sp(self.pos, self.pos);

0 commit comments

Comments
 (0)