about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse/lexer/mod.rs')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index a50b97142c2..850d527fe39 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -196,7 +196,7 @@ impl<'a> StringReader<'a> {
         let mut m = m.to_string();
         m.push_str(": ");
         for c in c.escape_default() { m.push(c) }
-        self.fatal_span_(from_pos, to_pos, m[]);
+        self.fatal_span_(from_pos, to_pos, m.index(&FullRange));
     }
 
     /// Report a lexical error spanning [`from_pos`, `to_pos`), appending an
@@ -205,7 +205,7 @@ impl<'a> StringReader<'a> {
         let mut m = m.to_string();
         m.push_str(": ");
         for c in c.escape_default() { m.push(c) }
-        self.err_span_(from_pos, to_pos, m[]);
+        self.err_span_(from_pos, to_pos, m.index(&FullRange));
     }
 
     /// Report a lexical error spanning [`from_pos`, `to_pos`), appending the
@@ -214,8 +214,8 @@ impl<'a> StringReader<'a> {
         m.push_str(": ");
         let from = self.byte_offset(from_pos).to_uint();
         let to = self.byte_offset(to_pos).to_uint();
-        m.push_str(self.filemap.src[from..to]);
-        self.fatal_span_(from_pos, to_pos, m[]);
+        m.push_str(self.filemap.src.index(&(from..to)));
+        self.fatal_span_(from_pos, to_pos, m.index(&FullRange));
     }
 
     /// Advance peek_tok and peek_span to refer to the next token, and
@@ -301,7 +301,7 @@ impl<'a> StringReader<'a> {
             while i < s.len() {
                 let str::CharRange { ch, next } = s.char_range_at(i);
                 if ch == '\r' {
-                    if j < i { buf.push_str(s[j..i]); }
+                    if j < i { buf.push_str(s.index(&(j..i))); }
                     j = next;
                     if next >= s.len() || s.char_at(next) != '\n' {
                         let pos = start + BytePos(i as u32);
@@ -311,7 +311,7 @@ impl<'a> StringReader<'a> {
                 }
                 i = next;
             }
-            if j < s.len() { buf.push_str(s[j..]); }
+            if j < s.len() { buf.push_str(s.index(&(j..))); }
             buf
         }
     }
@@ -556,7 +556,7 @@ impl<'a> StringReader<'a> {
                     self.translate_crlf(start_bpos, string,
                                         "bare CR not allowed in block doc-comment")
                 } else { string.into_cow() };
-                token::DocComment(token::intern(string[]))
+                token::DocComment(token::intern(string.index(&FullRange)))
             } else {
                 token::Comment
             };
@@ -1110,7 +1110,7 @@ impl<'a> StringReader<'a> {
                 // expansion purposes. See #12512 for the gory details of why
                 // this is necessary.
                 let ident = self.with_str_from(start, |lifetime_name| {
-                    str_to_ident(format!("'{}", lifetime_name)[])
+                    str_to_ident(format!("'{}", lifetime_name).index(&FullRange))
                 });
 
                 // Conjure up a "keyword checking ident" to make sure that