about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-21 07:06:54 -0700
committerbors <bors@rust-lang.org>2013-03-21 07:06:54 -0700
commitb8899138f88e50841829c471b2705f2e796b9a1f (patch)
tree5997e6dc0d2eebe56179771e1a58f0acd7895f1a /src/libsyntax/parse
parent0b4f2687cec898e52c47d1d93fb6317f2f4b468b (diff)
parent9d9a209e9a61414cdf9c8065d445ce353d6ed45f (diff)
downloadrust-b8899138f88e50841829c471b2705f2e796b9a1f.tar.gz
rust-b8899138f88e50841829c471b2705f2e796b9a1f.zip
auto merge of #5466 : Kimundi/rust/view-slice-rename, r=bstrie
A slice now always refers to something that returns an borrowed pointer, views don't exist anymore. If you want to have an explictit copy of a slice, use `to_owned()`
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/comments.rs8
-rw-r--r--src/libsyntax/parse/lexer.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 98208bf9f76..b5072e8c2b5 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -76,7 +76,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
         while j > i && lines[j - 1u].trim().is_empty() {
             j -= 1u;
         }
-        return lines.slice(i, j);
+        return lines.slice(i, j).to_owned();
     }
 
     // drop leftmost columns that contain only values in chars
@@ -103,7 +103,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
             if i > chars.len() {
                 ~""
             } else {
-                str::from_chars(chars.slice(i, chars.len()))
+                str::from_chars(chars.slice(i, chars.len()).to_owned())
             }
         };
     }
@@ -113,7 +113,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
     }
 
     if comment.starts_with(~"/*") {
-        let lines = str::lines_any(comment.slice(3u, comment.len() - 2u));
+        let lines = str::lines_any(comment.slice(3u, comment.len() - 2u).to_owned());
         let lines = vertical_trim(lines);
         let lines = block_trim(lines, ~"\t ", None);
         let lines = block_trim(lines, ~"*", Some(1u));
@@ -218,7 +218,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
     let col = col.to_uint();
     if all_whitespace(s, 0u, uint::min(len, col)) {
         if col < len {
-            s1 = str::slice(s, col, len);
+            s1 = str::slice(s, col, len).to_owned();
         } else { s1 = ~""; }
     } else { s1 = s; }
     debug!("pushing line: %s", s1);
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 90f51fe9b65..6cb4065935c 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -177,7 +177,7 @@ pub fn get_str_from(rdr: @mut StringReader, start: BytePos) -> ~str {
         // I'm pretty skeptical about this subtraction. What if there's a
         // multi-byte character before the mark?
         return str::slice(*rdr.src, start.to_uint() - 1u,
-                          byte_offset(rdr).to_uint() - 1u);
+                          byte_offset(rdr).to_uint() - 1u).to_owned();
     }
 }