about summary refs log tree commit diff
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
parent6156bc56cbd1f40e538b59ff91ce9b8d89969ff3 (diff)
downloadrust-fceec03da005edc82c90f1cbe1d102e8f365bad0.tar.gz
rust-fceec03da005edc82c90f1cbe1d102e8f365bad0.zip
Propagating unsafe::slice 3
-rw-r--r--src/comp/back/link.rs4
-rw-r--r--src/comp/syntax/codemap.rs6
-rw-r--r--src/comp/syntax/parse/lexer.rs3
-rw-r--r--src/compiletest/errors.rs6
-rw-r--r--src/compiletest/header.rs4
5 files changed, 12 insertions, 11 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 250b576a113..fee4356cadb 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -562,9 +562,9 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
 fn link_binary(sess: session,
                obj_filename: str,
                out_filename: str,
-               lm: link_meta) unsafe {
+               lm: link_meta) {
     // Converts a library file name into a gcc -l argument
-    fn unlib(config: @session::config, filename: str) -> str {
+    fn unlib(config: @session::config, filename: str) -> str unsafe {
         let rmlib = fn@(filename: str) -> str {
             if config.os == session::os_macos ||
                 (config.os == session::os_linux ||
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) {
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index e0c4bf6b654..014419a2aeb 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -22,7 +22,7 @@ fn load_errors(testfile: str) -> [expected_error] {
     ret error_patterns;
 }
 
-fn parse_expected(line_num: uint, line: str) -> [expected_error] {
+fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe {
     let error_tag = "//!";
     let idx0 = str::find(line, error_tag);
     if idx0 < 0 { ret []; }
@@ -41,11 +41,11 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error] {
     while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
     let start_kind = idx;
     while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
-    let kind = str::to_lower(str::slice(line, start_kind, idx));
+    let kind = str::to_lower(str::unsafe::slice(line, start_kind, idx));
 
     // Extract msg:
     while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
-    let msg = str::slice(line, idx, len);
+    let msg = str::unsafe::slice(line, idx, len);
 
     #debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
 
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index ec881caebbc..0f666528210 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -104,12 +104,12 @@ fn parse_name_directive(line: str, directive: str) -> bool {
 }
 
 fn parse_name_value_directive(line: str,
-                              directive: str) -> option<str> {
+                              directive: str) -> option<str> unsafe {
     let keycolon = directive + ":";
     if str::find(line, keycolon) >= 0 {
         let colon = str::find(line, keycolon) as uint;
         let value =
-            str::slice(line, colon + str::byte_len(keycolon),
+            str::unsafe::slice(line, colon + str::byte_len(keycolon),
                        str::byte_len(line));
         #debug("%s: %s", directive,  value);
         option::some(value)