about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-25 11:11:21 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-27 15:54:44 -0700
commit15e3ae79360508dc44f428f99bb483038fb2ab1e (patch)
tree51242ae2fd6af2abb879d6f493241397ffb33485
parent85b4253bc1946a1e17fe7d93a80fbb5bea96ee27 (diff)
Convert std::os to istrs. Issue #855
-rw-r--r--src/comp/back/x86.rs13
-rw-r--r--src/comp/driver/rustc.rs3
-rw-r--r--src/lib/fs.rs2
-rw-r--r--src/lib/linux_os.rs10
-rw-r--r--src/lib/macos_os.rs10
-rw-r--r--src/lib/win32_os.rs10
-rw-r--r--src/test/compiletest/runtest.rs2
-rw-r--r--src/test/stdtest/path.rs2
8 files changed, 30 insertions, 22 deletions
diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs
index 80f0245a3cd..bb8f201d254 100644
--- a/src/comp/back/x86.rs
+++ b/src/comp/back/x86.rs
@@ -2,31 +2,32 @@
 import lib::llvm::llvm;
 import lib::llvm::llvm::ModuleRef;
 import std::str;
+import std::istr;
 import std::os::target_os;
 
 fn get_module_asm() -> str { ret ""; }
 
 fn get_meta_sect_name() -> str {
-    if str::eq(target_os(), "macos") { ret "__DATA,__note.rustc"; }
-    if str::eq(target_os(), "win32") { ret ".note.rustc"; }
+    if istr::eq(target_os(), ~"macos") { ret "__DATA,__note.rustc"; }
+    if istr::eq(target_os(), ~"win32") { ret ".note.rustc"; }
     ret ".note.rustc";
 }
 
 fn get_data_layout() -> str {
-    if str::eq(target_os(), "macos") {
+    if istr::eq(target_os(), ~"macos") {
         ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + "-i32:32:32-i64:32:64" +
                 "-f32:32:32-f64:32:64-v64:64:64" +
                 "-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32";
     }
-    if str::eq(target_os(), "win32") {
+    if istr::eq(target_os(), ~"win32") {
         ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";
     }
     ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32";
 }
 
 fn get_target_triple() -> str {
-    if str::eq(target_os(), "macos") { ret "i686-apple-darwin"; }
-    if str::eq(target_os(), "win32") { ret "i686-pc-mingw32"; }
+    if istr::eq(target_os(), ~"macos") { ret "i686-apple-darwin"; }
+    if istr::eq(target_os(), ~"win32") { ret "i686-pc-mingw32"; }
     ret "i686-unknown-linux-gnu";
 }
 //
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index 08f00479871..204b6ef0d51 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -55,7 +55,8 @@ fn default_configuration(sess: session::session, argv0: str, input: str) ->
     let mk = attr::mk_name_value_item_str;
 
     ret [ // Target bindings.
-         mk("target_os", std::os::target_os()), mk("target_arch", "x86"),
+         mk("target_os", istr::to_estr(std::os::target_os())),
+        mk("target_arch", "x86"),
          mk("target_libc", libc),
          // Build bindings.
          mk("build_compiler", argv0), mk("build_input", input)];
diff --git a/src/lib/fs.rs b/src/lib/fs.rs
index 9bf6d40323f..6005467438e 100644
--- a/src/lib/fs.rs
+++ b/src/lib/fs.rs
@@ -70,7 +70,7 @@ fn make_absolute(p: &path) -> path {
     if path_is_absolute(p) {
         ret p;
     } else {
-        ret connect(istr::from_estr(getcwd()), p);
+        ret connect(getcwd(), p);
     }
 }
 
diff --git a/src/lib/linux_os.rs b/src/lib/linux_os.rs
index 868b47471bc..4c67a01fc56 100644
--- a/src/lib/linux_os.rs
+++ b/src/lib/linux_os.rs
@@ -52,11 +52,11 @@ mod libc_constants {
     fn S_IWUSR() -> uint { ret 128u; }
 }
 
-fn exec_suffix() -> str { ret ""; }
+fn exec_suffix() -> istr { ret ~""; }
 
-fn target_os() -> str { ret "linux"; }
+fn target_os() -> istr { ret ~"linux"; }
 
-fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; }
+fn dylib_filename(base: &istr) -> istr { ret ~"lib" + base + ~".so"; }
 
 fn pipe() -> {in: int, out: int} {
     let fds = {mutable in: 0, mutable out: 0};
@@ -76,7 +76,9 @@ native "rust" mod rustrt {
     fn rust_getcwd() -> str;
 }
 
-fn getcwd() -> str { ret rustrt::rust_getcwd(); }
+fn getcwd() -> istr {
+    ret istr::from_estr(rustrt::rust_getcwd());
+}
 
 
 // Local Variables:
diff --git a/src/lib/macos_os.rs b/src/lib/macos_os.rs
index ba79eddcfc2..2ac38c35aa8 100644
--- a/src/lib/macos_os.rs
+++ b/src/lib/macos_os.rs
@@ -49,11 +49,11 @@ mod libc_constants {
     fn S_IWUSR() -> uint { ret 512u; }
 }
 
-fn exec_suffix() -> str { ret ""; }
+fn exec_suffix() -> istr { ret ~""; }
 
-fn target_os() -> str { ret "macos"; }
+fn target_os() -> istr { ret ~"macos"; }
 
-fn dylib_filename(base: str) -> str { ret "lib" + base + ".dylib"; }
+fn dylib_filename(base: &istr) -> istr { ret ~"lib" + base + ~".dylib"; }
 
 fn pipe() -> {in: int, out: int} {
     let fds = {mutable in: 0, mutable out: 0};
@@ -73,7 +73,9 @@ native "rust" mod rustrt {
     fn rust_getcwd() -> str;
 }
 
-fn getcwd() -> str { ret rustrt::rust_getcwd(); }
+fn getcwd() -> istr {
+    ret istr::from_estr(rustrt::rust_getcwd());
+}
 
 
 // Local Variables:
diff --git a/src/lib/win32_os.rs b/src/lib/win32_os.rs
index 57944b5ff53..f7c3d4570dd 100644
--- a/src/lib/win32_os.rs
+++ b/src/lib/win32_os.rs
@@ -46,11 +46,11 @@ native "x86stdcall" mod kernel32 {
     fn SetEnvironmentVariableA(n: sbuf, v: sbuf) -> int;
 }
 
-fn exec_suffix() -> str { ret ".exe"; }
+fn exec_suffix() -> istr { ret ~".exe"; }
 
-fn target_os() -> str { ret "win32"; }
+fn target_os() -> istr { ret ~"win32"; }
 
-fn dylib_filename(base: str) -> str { ret base + ".dll"; }
+fn dylib_filename(base: &istr) -> istr { ret base + ~".dll"; }
 
 fn pipe() -> {in: int, out: int} {
     // Windows pipes work subtly differently than unix pipes, and their
@@ -78,7 +78,9 @@ native "rust" mod rustrt {
 
 fn waitpid(pid: int) -> int { ret rustrt::rust_process_wait(pid); }
 
-fn getcwd() -> str { ret rustrt::rust_getcwd(); }
+fn getcwd() -> istr {
+    ret istr::from_estr(rustrt::rust_getcwd());
+}
 
 // Local Variables:
 // mode: rust;
diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs
index a4e1b26b7ed..314f9677437 100644
--- a/src/test/compiletest/runtest.rs
+++ b/src/test/compiletest/runtest.rs
@@ -252,7 +252,7 @@ fn make_compile_args(config: &config, props: &test_props, testfile: &str) ->
 }
 
 fn make_exe_name(config: &config, testfile: &str) -> str {
-    output_base_name(config, testfile) + os::exec_suffix()
+    output_base_name(config, testfile) + istr::to_estr(os::exec_suffix())
 }
 
 fn make_run_args(config: &config, props: &test_props, testfile: &str) ->
diff --git a/src/test/stdtest/path.rs b/src/test/stdtest/path.rs
index 147e9b29eec..82fe54413d9 100644
--- a/src/test/stdtest/path.rs
+++ b/src/test/stdtest/path.rs
@@ -10,7 +10,7 @@ import std::os;
 fn test() {
     assert (!fs::path_is_absolute(~"test-path"));
 
-    log "Current working directory: " + os::getcwd();
+    log ~"Current working directory: " + os::getcwd();
 
     log fs::make_absolute(~"test-path");
     log fs::make_absolute(~"/usr/bin");