about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-02-01 03:41:58 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-01 21:56:53 -0800
commit6156bc56cbd1f40e538b59ff91ce9b8d89969ff3 (patch)
treeec399916523a701e8ac25903855e90d2210a9254 /src
parent47c57a17dc51ff32594b5759c300b84e380b9f7b (diff)
downloadrust-6156bc56cbd1f40e538b59ff91ce9b8d89969ff3.tar.gz
rust-6156bc56cbd1f40e538b59ff91ce9b8d89969ff3.zip
Propagating unsafe::slice 2
Diffstat (limited to 'src')
-rw-r--r--src/comp/back/link.rs4
-rw-r--r--src/comp/middle/debuginfo.rs4
-rw-r--r--src/comp/syntax/parse/lexer.rs8
-rw-r--r--src/libstd/fs.rs4
-rw-r--r--src/libstd/getopts.rs8
5 files changed, 14 insertions, 14 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 4f61ddf8178..250b576a113 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -562,7 +562,7 @@ 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) {
+               lm: link_meta) unsafe {
     // Converts a library file name into a gcc -l argument
     fn unlib(config: @session::config, filename: str) -> str {
         let rmlib = fn@(filename: str) -> str {
@@ -570,7 +570,7 @@ fn link_binary(sess: session,
                 (config.os == session::os_linux ||
                  config.os == session::os_freebsd) &&
                 str::find(filename, "lib") == 0 {
-                ret str::slice(filename, 3u,
+                ret str::unsafe::slice(filename, 3u,
                                str::byte_len(filename));
             } else { ret filename; }
         };
diff --git a/src/comp/middle/debuginfo.rs b/src/comp/middle/debuginfo.rs
index 56a07619a46..b674af49b26 100644
--- a/src/comp/middle/debuginfo.rs
+++ b/src/comp/middle/debuginfo.rs
@@ -157,7 +157,7 @@ fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int,
 }
 
 fn create_compile_unit(cx: @crate_ctxt, full_path: str)
-    -> @metadata<compile_unit_md> {
+    -> @metadata<compile_unit_md> unsafe {
     let cache = get_cache(cx);
     let tg = CompileUnitTag;
     alt cached_metadata::<@metadata<compile_unit_md>>(cache, tg,
@@ -168,7 +168,7 @@ fn create_compile_unit(cx: @crate_ctxt, full_path: str)
 
     let work_dir = cx.sess.working_dir;
     let file_path = if str::starts_with(full_path, work_dir) {
-        str::slice(full_path, str::byte_len(work_dir),
+        str::unsafe::slice(full_path, str::byte_len(work_dir),
                    str::byte_len(full_path))
     } else {
         full_path
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index 03fc4017106..d4e67e812d1 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -24,10 +24,10 @@ type reader = @{
 
 impl reader for reader {
     fn is_eof() -> bool { self.curr == -1 as char }
-    fn get_str_from(start: uint) -> str {
+    fn get_str_from(start: uint) -> str unsafe {
         // I'm pretty skeptical about this subtraction. What if there's a
         // multi-byte character before the mark?
-        ret str::slice(*self.src, start - 1u, self.pos - 1u);
+        ret str::unsafe::slice(*self.src, start - 1u, self.pos - 1u);
     }
     fn next() -> char {
         if self.pos < self.len {
@@ -579,11 +579,11 @@ 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) {
+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) {
-            s1 = str::slice(s, col, str::byte_len(s));
+            s1 = str::unsafe::slice(s, col, str::byte_len(s));
         } else { s1 = ""; }
     } else { s1 = s; }
     log(debug, "pushing line: " + s1);
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index cbfca163c18..26a9931a0cb 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -63,7 +63,7 @@ path separators in the path then the returned path is identical to
 the provided path. If an empty path is provided or the path ends
 with a path separator then an empty path is returned.
 */
-fn basename(p: path) -> path {
+fn basename(p: path) -> path unsafe {
     let i: int = str::rindex(p, os_fs::path_sep as u8);
     if i == -1 {
         i = str::rindex(p, os_fs::alt_path_sep as u8);
@@ -71,7 +71,7 @@ fn basename(p: path) -> path {
     }
     let len = str::byte_len(p);
     if i + 1 as uint >= len { ret p; }
-    ret str::slice(p, i + 1 as uint, len);
+    ret str::unsafe::slice(p, i + 1 as uint, len);
 }
 
 
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index 585ea48725f..5510dd3231a 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -209,7 +209,7 @@ ok(match) - On success. Use functions such as <opt_present>
             <opt_str>, etc. to interrogate results.
 err(fail_) - On failure. Use <fail_str> to get an error message.
 */
-fn getopts(args: [str], opts: [opt]) -> result {
+fn getopts(args: [str], opts: [opt]) -> result unsafe {
     let n_opts = vec::len::<opt>(opts);
     fn f(_x: uint) -> [optval] { ret []; }
     let vals = vec::init_fn_mut::<[optval]>(n_opts, f);
@@ -229,14 +229,14 @@ fn getopts(args: [str], opts: [opt]) -> result {
             let names;
             let i_arg = option::none::<str>;
             if cur[1] == '-' as u8 {
-                let tail = str::slice(cur, 2u, curlen);
+                let tail = str::unsafe::slice(cur, 2u, curlen);
                 let eq = str::index(tail, '=' as u8);
                 if eq == -1 {
                     names = [long(tail)];
                 } else {
-                    names = [long(str::slice(tail, 0u, eq as uint))];
+                    names = [long(str::unsafe::slice(tail, 0u, eq as uint))];
                     i_arg =
-                        option::some::<str>(str::slice(tail,
+                        option::some::<str>(str::unsafe::slice(tail,
                                                        (eq as uint) + 1u,
                                                        curlen - 2u));
                 }