Skip to content

Commit 6aad0cf

Browse files
committed
---
yaml --- r: 4981 b: refs/heads/master c: 20178b9 h: refs/heads/master i: 4979: b09c5e0 v: v3
1 parent 1bbdff5 commit 6aad0cf

File tree

6 files changed

+40
-29
lines changed

6 files changed

+40
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4cf2e510e0cbd91d51bdbe3080c7491a6a4c6567
2+
refs/heads/master: 20178b9312675f4889bd656916a1f32cbacc94d6

trunk/src/comp/driver/rustc.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,14 @@ fn main(args: [str]) {
551551
let glu: str = binary_dir + "/lib/glue.o";
552552
let main: str = binary_dir + "/lib/main.o";
553553
let stage: str = "-L" + binary_dir + "/lib";
554-
let prog: str = "gcc";
554+
let prog: istr = ~"gcc";
555555
// The invocations of gcc share some flags across platforms
556556

557557
let gcc_args =
558-
[stage, "-Lrt", "-lrustrt", glu, "-m32", "-o", saved_out_filename,
559-
saved_out_filename + ".o"];
558+
[istr::from_estr(stage),
559+
~"-Lrt", ~"-lrustrt", istr::from_estr(glu),
560+
~"-m32", ~"-o", istr::from_estr(saved_out_filename),
561+
istr::from_estr(saved_out_filename) + ~".o"];
560562
let lib_cmd;
561563

562564
let os = sess.get_targ_cfg().os;
@@ -590,46 +592,49 @@ fn main(args: [str]) {
590592
let cstore = sess.get_cstore();
591593
for cratepath: str in cstore::get_used_crate_files(cstore) {
592594
if str::ends_with(cratepath, ".rlib") {
593-
gcc_args += [cratepath];
595+
gcc_args += [istr::from_estr(cratepath)];
594596
cont;
595597
}
596598
let cratepath = istr::from_estr(cratepath);
597599
let dir = fs::dirname(cratepath);
598-
if dir != ~"" { gcc_args += ["-L" + istr::to_estr(dir)]; }
600+
if dir != ~"" { gcc_args += [~"-L" + dir]; }
599601
let libarg = unlib(sess.get_targ_cfg(), fs::basename(cratepath));
600-
gcc_args += ["-l" + istr::to_estr(libarg)];
602+
gcc_args += [~"-l" + libarg];
601603
}
602604

603605
let ula = cstore::get_used_link_args(cstore);
604-
for arg: str in ula { gcc_args += [arg]; }
606+
for arg: str in ula { gcc_args += [istr::from_estr(arg)]; }
605607

606608
let used_libs = cstore::get_used_libraries(cstore);
607-
for l: str in used_libs { gcc_args += ["-l" + l]; }
609+
for l: str in used_libs { gcc_args += [~"-l" + istr::from_estr(l)]; }
608610

609611
if sopts.library {
610-
gcc_args += [lib_cmd];
612+
gcc_args += [istr::from_estr(lib_cmd)];
611613
} else {
612614
// FIXME: why do we hardcode -lm?
613-
gcc_args += ["-lm", main];
615+
gcc_args += [~"-lm", istr::from_estr(main)];
614616
}
615617
// We run 'gcc' here
616618

617619
let err_code = run::run_program(prog, gcc_args);
618620
if 0 != err_code {
619621
sess.err(#fmt["linking with gcc failed with code %d", err_code]);
620-
sess.note(#fmt["gcc arguments: %s", str::connect(gcc_args, " ")]);
622+
sess.note(#fmt["gcc arguments: %s",
623+
istr::to_estr(istr::connect(gcc_args, ~" "))]);
621624
sess.abort_if_errors();
622625
}
623626
// Clean up on Darwin
624627
625628
if sess.get_targ_cfg().os == session::os_macos {
626-
run::run_program("dsymutil", [saved_out_filename]);
629+
run::run_program(~"dsymutil",
630+
[istr::from_estr(saved_out_filename)]);
627631
}
628632

629633

630634
// Remove the temporary object file if we aren't saving temps
631635
if !sopts.save_temps {
632-
run::run_program("rm", [saved_out_filename + ".o"]);
636+
run::run_program(~"rm",
637+
[istr::from_estr(saved_out_filename) + ~".o"]);
633638
}
634639
}
635640

trunk/src/fuzzer/fuzzer.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import rustc::syntax::print::pprust;
2424
fn write_file(filename: &str, content: &str) {
2525
io::file_writer(filename, [io::create, io::truncate]).write_str(content);
2626
// Work around https://github.com/graydon/rust/issues/726
27-
std::run::run_program("chmod", ["644", filename]);
27+
std::run::run_program(~"chmod", [~"644", istr::from_estr(filename)]);
2828
}
2929

3030
fn file_contains(filename: &str, needle: &str) -> bool {
@@ -190,8 +190,9 @@ fn check_whole_compiler(code: &str) {
190190
let filename = "test.rs";
191191
write_file(filename, code);
192192
let p =
193-
std::run::program_output("/Users/jruderman/code/rust/build/stage1/rustc",
194-
["-c", filename]);
193+
std::run::program_output(
194+
~"/Users/jruderman/code/rust/build/stage1/rustc",
195+
[~"-c", istr::from_estr(filename)]);
195196
196197
//log_err #fmt("Status: %d", p.status);
197198
//log_err "Output: " + p.out;
@@ -328,9 +329,9 @@ fn check_roundtrip_convergence(code: &str, maxIters: uint) {
328329
log_err #fmt["Did not converge after %u iterations!", i];
329330
write_file("round-trip-a.rs", old);
330331
write_file("round-trip-b.rs", new);
331-
std::run::run_program("diff",
332-
["-w", "-u", "round-trip-a.rs",
333-
"round-trip-b.rs"]);
332+
std::run::run_program(~"diff",
333+
[~"-w", ~"-u", ~"round-trip-a.rs",
334+
~"round-trip-b.rs"]);
334335
fail "Mismatch";
335336
}
336337
}

trunk/src/lib/run_program.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ fn arg_vec(prog: str, args: &[str]) -> [sbuf] {
1919
ret argptrs;
2020
}
2121

22-
fn spawn_process(prog: str, args: &[str], in_fd: int, out_fd: int,
22+
fn spawn_process(prog: &istr, args: &[istr], in_fd: int, out_fd: int,
2323
err_fd: int) -> int {
24+
let prog = istr::to_estr(prog);
25+
let args = istr::to_estrs(args);
2426
// Note: we have to hold on to this vector reference while we hold a
2527
// pointer to its buffer
2628
let argv = arg_vec(prog, args);
@@ -29,7 +31,7 @@ fn spawn_process(prog: str, args: &[str], in_fd: int, out_fd: int,
2931
ret pid;
3032
}
3133

32-
fn run_program(prog: str, args: &[str]) -> int {
34+
fn run_program(prog: &istr, args: &[istr]) -> int {
3335
ret os::waitpid(spawn_process(prog, args, 0, 0, 0));
3436
}
3537

@@ -46,7 +48,7 @@ type program =
4648

4749
resource program_res(p: program) { p.destroy(); }
4850

49-
fn start_program(prog: str, args: &[str]) -> @program_res {
51+
fn start_program(prog: &istr, args: &[istr]) -> @program_res {
5052
let pipe_input = os::pipe();
5153
let pipe_output = os::pipe();
5254
let pipe_err = os::pipe();
@@ -106,7 +108,7 @@ fn read_all(rd: &io::reader) -> str {
106108
ret buf;
107109
}
108110

109-
fn program_output(prog: str, args: [str]) ->
111+
fn program_output(prog: &istr, args: &[istr]) ->
110112
{status: int, out: str, err: str} {
111113
let pr = start_program(prog, args);
112114
pr.close_input();

trunk/src/test/compiletest/procsrv.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import std::os;
1313
import std::run;
1414
import std::io;
1515
import std::str;
16+
import std::istr;
1617
import std::comm::chan;
1718
import std::comm::port;
1819
import std::comm::send;
@@ -128,7 +129,8 @@ fn worker(p: port<request>) {
128129
let pipe_out = os::pipe();
129130
let pipe_err = os::pipe();
130131
let spawnproc =
131-
bind run::spawn_process(execparms.prog, execparms.args,
132+
bind run::spawn_process(istr::from_estr(execparms.prog),
133+
istr::from_estrs(execparms.args),
132134
pipe_in.in, pipe_out.out, pipe_err.out);
133135
let pid = with_lib_path(execparms.lib_path, spawnproc);
134136

trunk/src/test/stdtest/run.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import std::vec;
1111
#[cfg(target_os = "macos")]
1212
#[test]
1313
fn test_leaks() {
14-
run::run_program("echo", []);
15-
run::start_program("echo", []);
16-
run::program_output("echo", []);
14+
run::run_program(~"echo", []);
15+
run::start_program(~"echo", []);
16+
run::program_output(~"echo", []);
1717
}
1818

1919
// FIXME
@@ -29,7 +29,8 @@ fn test_pipes() {
2929
let pipe_err = os::pipe();
3030

3131
let pid =
32-
run::spawn_process("cat", [], pipe_in.in, pipe_out.out, pipe_err.out);
32+
run::spawn_process(~"cat", [],
33+
pipe_in.in, pipe_out.out, pipe_err.out);
3334
os::libc::close(pipe_in.in);
3435
os::libc::close(pipe_out.out);
3536
os::libc::close(pipe_err.out);

0 commit comments

Comments
 (0)