about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-02-01 03:45:44 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-01 21:56:53 -0800
commitfceec03da005edc82c90f1cbe1d102e8f365bad0 (patch)
tree947e5b433fe4a7b44860697c6d7bc17e54af3647 /src/comp/syntax
parent6156bc56cbd1f40e538b59ff91ce9b8d89969ff3 (diff)
downloadrust-fceec03da005edc82c90f1cbe1d102e8f365bad0.tar.gz
rust-fceec03da005edc82c90f1cbe1d102e8f365bad0.zip
Propagating unsafe::slice 3
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/codemap.rs6
-rw-r--r--src/comp/syntax/parse/lexer.rs3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
index 0b893376bdb..eab92ab6ae9 100644
--- a/src/comp/syntax/codemap.rs
+++ b/src/comp/syntax/codemap.rs
@@ -108,7 +108,7 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
     ret @{name: lo.filename, lines: lines};
 }
 
-fn get_line(fm: filemap, line: int) -> str {
+fn get_line(fm: filemap, line: int) -> str unsafe {
     let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
     let end: uint;
     if line as uint < vec::len(fm.lines) - 1u {
@@ -118,11 +118,11 @@ fn get_line(fm: filemap, line: int) -> str {
         // parsed. If we just slice the rest of the string, we'll print out
         // the remainder of the file, which is undesirable.
         end = str::byte_len(*fm.src);
-        let rest = str::slice(*fm.src, begin, end);
+        let rest = str::unsafe::slice(*fm.src, begin, end);
         let newline = str::index(rest, '\n' as u8);
         if newline != -1 { end = begin + (newline as uint); }
     }
-    ret str::slice(*fm.src, begin, end);
+    ret str::unsafe::slice(*fm.src, begin, end);
 }
 
 fn get_filemap(cm: codemap, filename: str) -> filemap {
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index d4e67e812d1..30dacd27d4e 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -579,7 +579,8 @@ fn all_whitespace(s: str, begin: uint, end: uint) -> bool {
     ret true;
 }
 
-fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) unsafe {
+fn trim_whitespace_prefix_and_push_line(&lines: [str],
+                                        s: str, col: uint) unsafe {
     let s1;
     if all_whitespace(s, 0u, col) {
         if col < str::byte_len(s) {