about summary refs log tree commit diff
path: root/src/libsyntax/parse/comments.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-02-28 12:54:01 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-03-01 22:40:52 -0800
commit198cc3d850136582651489328fec221a2b98bfef (patch)
treefe47f6fab3d4ead61053684613d0b1852ec7e311 /src/libsyntax/parse/comments.rs
parent58fd6ab90db3eb68c94695e1254a73e57bc44658 (diff)
downloadrust-198cc3d850136582651489328fec221a2b98bfef.tar.gz
rust-198cc3d850136582651489328fec221a2b98bfef.zip
libsyntax: Fix errors arising from the automated `~[T]` conversion
Diffstat (limited to 'src/libsyntax/parse/comments.rs')
-rw-r--r--src/libsyntax/parse/comments.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 1c45fe5ee2c..c2a2097de24 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -20,6 +20,7 @@ use parse::token;
 use std::io;
 use std::str;
 use std::uint;
+use std::vec_ng::Vec;
 
 #[deriving(Clone, Eq)]
 pub enum CommentStyle {
@@ -58,20 +59,20 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
         let mut i = 0u;
         let mut j = lines.len();
         // first line of all-stars should be omitted
-        if lines.len() > 0 && lines[0].chars().all(|c| c == '*') {
+        if lines.len() > 0 && lines.get(0).chars().all(|c| c == '*') {
             i += 1;
         }
-        while i < j && lines[i].trim().is_empty() {
+        while i < j && lines.get(i).trim().is_empty() {
             i += 1;
         }
         // like the first, a last line of all stars should be omitted
-        if j > i && lines[j - 1].chars().skip(1).all(|c| c == '*') {
+        if j > i && lines.get(j - 1).chars().skip(1).all(|c| c == '*') {
             j -= 1;
         }
-        while j > i && lines[j - 1].trim().is_empty() {
+        while j > i && lines.get(j - 1).trim().is_empty() {
             j -= 1;
         }
-        return lines.slice(i, j).to_owned();
+        return lines.slice(i, j).iter().map(|x| (*x).clone()).collect();
     }
 
     /// remove a "[ \t]*\*" block from each line, if possible