about summary refs log tree commit diff
path: root/src/libsyntax/codemap.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-07 17:26:58 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-07 17:26:58 -0800
commit6e806bdefde91af102567ef4b5dbd3ccf0c5c2ec (patch)
treeb8627ad2c80976f618b661ec14695f6a322ad1b3 /src/libsyntax/codemap.rs
parentf6a7dc5528a9a9ac36867bbca2a6044b7be5bce2 (diff)
parent7d72719efc25c6cdb8963c187e93df646ba65245 (diff)
downloadrust-6e806bdefde91af102567ef4b5dbd3ccf0c5c2ec.tar.gz
rust-6e806bdefde91af102567ef4b5dbd3ccf0c5c2ec.zip
rollup merge of #20721: japaric/snap
Conflicts:
	src/libcollections/vec.rs
	src/libcore/fmt/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/session/config.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/context.rs
	src/librustc_trans/trans/type_.rs
	src/librustc_typeck/check/_match.rs
	src/librustdoc/html/format.rs
	src/libsyntax/std_inject.rs
	src/libsyntax/util/interner.rs
	src/test/compile-fail/mut-pattern-mismatched.rs
Diffstat (limited to 'src/libsyntax/codemap.rs')
-rw-r--r--src/libsyntax/codemap.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index e4460ca865b..d1768867f0d 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -304,9 +304,9 @@ impl FileMap {
         lines.get(line_number).map(|&line| {
             let begin: BytePos = line - self.start_pos;
             let begin = begin.to_uint();
-            let slice = self.src.index(&(begin..));
+            let slice = &self.src[begin..];
             match slice.find('\n') {
-                Some(e) => slice.index(&(0..e)),
+                Some(e) => &slice[0..e],
                 None => slice
             }.to_string()
         })
@@ -351,9 +351,9 @@ impl CodeMap {
         // FIXME #12884: no efficient/safe way to remove from the start of a string
         // and reuse the allocation.
         let mut src = if src.starts_with("\u{feff}") {
-            String::from_str(src.index(&(3..)))
+            String::from_str(&src[3..])
         } else {
-            String::from_str(src.index(&FullRange))
+            String::from_str(&src[])
         };
 
         // Append '\n' in case it's not already there.
@@ -440,8 +440,7 @@ impl CodeMap {
         if begin.fm.start_pos != end.fm.start_pos {
             None
         } else {
-            Some(begin.fm.src.index(&(begin.pos.to_uint()..
-                                      end.pos.to_uint())).to_string())
+            Some((&begin.fm.src[begin.pos.to_uint()..end.pos.to_uint()]).to_string())
         }
     }