Skip to content

Commit 15e3ae7

Browse files
committed
Convert std::os to istrs. Issue #855
1 parent 85b4253 commit 15e3ae7

File tree

8 files changed

+30
-22
lines changed

8 files changed

+30
-22
lines changed

src/comp/back/x86.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,32 @@
22
import lib::llvm::llvm;
33
import lib::llvm::llvm::ModuleRef;
44
import std::str;
5+
import std::istr;
56
import std::os::target_os;
67

78
fn get_module_asm() -> str { ret ""; }
89

910
fn get_meta_sect_name() -> str {
10-
if str::eq(target_os(), "macos") { ret "__DATA,__note.rustc"; }
11-
if str::eq(target_os(), "win32") { ret ".note.rustc"; }
11+
if istr::eq(target_os(), ~"macos") { ret "__DATA,__note.rustc"; }
12+
if istr::eq(target_os(), ~"win32") { ret ".note.rustc"; }
1213
ret ".note.rustc";
1314
}
1415

1516
fn get_data_layout() -> str {
16-
if str::eq(target_os(), "macos") {
17+
if istr::eq(target_os(), ~"macos") {
1718
ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + "-i32:32:32-i64:32:64" +
1819
"-f32:32:32-f64:32:64-v64:64:64" +
1920
"-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32";
2021
}
21-
if str::eq(target_os(), "win32") {
22+
if istr::eq(target_os(), ~"win32") {
2223
ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";
2324
}
2425
ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32";
2526
}
2627

2728
fn get_target_triple() -> str {
28-
if str::eq(target_os(), "macos") { ret "i686-apple-darwin"; }
29-
if str::eq(target_os(), "win32") { ret "i686-pc-mingw32"; }
29+
if istr::eq(target_os(), ~"macos") { ret "i686-apple-darwin"; }
30+
if istr::eq(target_os(), ~"win32") { ret "i686-pc-mingw32"; }
3031
ret "i686-unknown-linux-gnu";
3132
}
3233
//

src/comp/driver/rustc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ fn default_configuration(sess: session::session, argv0: str, input: str) ->
5555
let mk = attr::mk_name_value_item_str;
5656

5757
ret [ // Target bindings.
58-
mk("target_os", std::os::target_os()), mk("target_arch", "x86"),
58+
mk("target_os", istr::to_estr(std::os::target_os())),
59+
mk("target_arch", "x86"),
5960
mk("target_libc", libc),
6061
// Build bindings.
6162
mk("build_compiler", argv0), mk("build_input", input)];

src/lib/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn make_absolute(p: &path) -> path {
7070
if path_is_absolute(p) {
7171
ret p;
7272
} else {
73-
ret connect(istr::from_estr(getcwd()), p);
73+
ret connect(getcwd(), p);
7474
}
7575
}
7676

src/lib/linux_os.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ mod libc_constants {
5252
fn S_IWUSR() -> uint { ret 128u; }
5353
}
5454

55-
fn exec_suffix() -> str { ret ""; }
55+
fn exec_suffix() -> istr { ret ~""; }
5656

57-
fn target_os() -> str { ret "linux"; }
57+
fn target_os() -> istr { ret ~"linux"; }
5858

59-
fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; }
59+
fn dylib_filename(base: &istr) -> istr { ret ~"lib" + base + ~".so"; }
6060

6161
fn pipe() -> {in: int, out: int} {
6262
let fds = {mutable in: 0, mutable out: 0};
@@ -76,7 +76,9 @@ native "rust" mod rustrt {
7676
fn rust_getcwd() -> str;
7777
}
7878

79-
fn getcwd() -> str { ret rustrt::rust_getcwd(); }
79+
fn getcwd() -> istr {
80+
ret istr::from_estr(rustrt::rust_getcwd());
81+
}
8082

8183

8284
// Local Variables:

src/lib/macos_os.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ mod libc_constants {
4949
fn S_IWUSR() -> uint { ret 512u; }
5050
}
5151

52-
fn exec_suffix() -> str { ret ""; }
52+
fn exec_suffix() -> istr { ret ~""; }
5353

54-
fn target_os() -> str { ret "macos"; }
54+
fn target_os() -> istr { ret ~"macos"; }
5555

56-
fn dylib_filename(base: str) -> str { ret "lib" + base + ".dylib"; }
56+
fn dylib_filename(base: &istr) -> istr { ret ~"lib" + base + ~".dylib"; }
5757

5858
fn pipe() -> {in: int, out: int} {
5959
let fds = {mutable in: 0, mutable out: 0};
@@ -73,7 +73,9 @@ native "rust" mod rustrt {
7373
fn rust_getcwd() -> str;
7474
}
7575

76-
fn getcwd() -> str { ret rustrt::rust_getcwd(); }
76+
fn getcwd() -> istr {
77+
ret istr::from_estr(rustrt::rust_getcwd());
78+
}
7779

7880

7981
// Local Variables:

src/lib/win32_os.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ native "x86stdcall" mod kernel32 {
4646
fn SetEnvironmentVariableA(n: sbuf, v: sbuf) -> int;
4747
}
4848

49-
fn exec_suffix() -> str { ret ".exe"; }
49+
fn exec_suffix() -> istr { ret ~".exe"; }
5050

51-
fn target_os() -> str { ret "win32"; }
51+
fn target_os() -> istr { ret ~"win32"; }
5252

53-
fn dylib_filename(base: str) -> str { ret base + ".dll"; }
53+
fn dylib_filename(base: &istr) -> istr { ret base + ~".dll"; }
5454

5555
fn pipe() -> {in: int, out: int} {
5656
// Windows pipes work subtly differently than unix pipes, and their
@@ -78,7 +78,9 @@ native "rust" mod rustrt {
7878

7979
fn waitpid(pid: int) -> int { ret rustrt::rust_process_wait(pid); }
8080

81-
fn getcwd() -> str { ret rustrt::rust_getcwd(); }
81+
fn getcwd() -> istr {
82+
ret istr::from_estr(rustrt::rust_getcwd());
83+
}
8284

8385
// Local Variables:
8486
// mode: rust;

src/test/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fn make_compile_args(config: &config, props: &test_props, testfile: &str) ->
252252
}
253253

254254
fn make_exe_name(config: &config, testfile: &str) -> str {
255-
output_base_name(config, testfile) + os::exec_suffix()
255+
output_base_name(config, testfile) + istr::to_estr(os::exec_suffix())
256256
}
257257

258258
fn make_run_args(config: &config, props: &test_props, testfile: &str) ->

src/test/stdtest/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import std::os;
1010
fn test() {
1111
assert (!fs::path_is_absolute(~"test-path"));
1212

13-
log "Current working directory: " + os::getcwd();
13+
log ~"Current working directory: " + os::getcwd();
1414
1515
log fs::make_absolute(~"test-path");
1616
log fs::make_absolute(~"/usr/bin");

0 commit comments

Comments
 (0)