Skip to content

Commit 81b3142

Browse files
committed
Remove more uses of str from std::run. Issue #855
1 parent 1772ee3 commit 81b3142

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/fuzzer/fuzzer.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -197,51 +197,51 @@ fn check_whole_compiler(code: &str) {
197197
198198
//log_err #ifmt("Status: %d", p.status);
199199
//log_err "Output: " + p.out;
200-
if p.err != "" {
201-
if contains(p.err, "argument of incompatible type") {
200+
if p.err != ~"" {
201+
if contains(istr::to_estr(p.err), "argument of incompatible type") {
202202
log_err "https://github.com/graydon/rust/issues/769";
203-
} else if contains(p.err,
203+
} else if contains(istr::to_estr(p.err),
204204
"Cannot create binary operator with two operands of differing type")
205205
{
206206
log_err "https://github.com/graydon/rust/issues/770";
207-
} else if contains(p.err, "May only branch on boolean predicates!") {
207+
} else if contains(istr::to_estr(p.err), "May only branch on boolean predicates!") {
208208
log_err "https://github.com/graydon/rust/issues/770 or https://github.com/graydon/rust/issues/776";
209-
} else if contains(p.err, "Invalid constantexpr cast!") &&
209+
} else if contains(istr::to_estr(p.err), "Invalid constantexpr cast!") &&
210210
contains(code, "!") {
211211
log_err "https://github.com/graydon/rust/issues/777";
212-
} else if contains(p.err,
212+
} else if contains(istr::to_estr(p.err),
213213
"Both operands to ICmp instruction are not of the same type!")
214214
&& contains(code, "!") {
215215
log_err "https://github.com/graydon/rust/issues/777 #issuecomment-1678487";
216-
} else if contains(p.err, "Ptr must be a pointer to Val type!") &&
216+
} else if contains(istr::to_estr(p.err), "Ptr must be a pointer to Val type!") &&
217217
contains(code, "!") {
218218
log_err "https://github.com/graydon/rust/issues/779";
219-
} else if contains(p.err, "Calling a function with bad signature!") &&
219+
} else if contains(istr::to_estr(p.err), "Calling a function with bad signature!") &&
220220
(contains(code, "iter") || contains(code, "range")) {
221221
log_err "https://github.com/graydon/rust/issues/771 - calling an iter fails";
222-
} else if contains(p.err, "Calling a function with a bad signature!")
222+
} else if contains(istr::to_estr(p.err), "Calling a function with a bad signature!")
223223
&& contains(code, "empty") {
224224
log_err "https://github.com/graydon/rust/issues/775 - possibly a modification of run-pass/import-glob-crate.rs";
225-
} else if contains(p.err, "Invalid type for pointer element!") &&
225+
} else if contains(istr::to_estr(p.err), "Invalid type for pointer element!") &&
226226
contains(code, "put") {
227227
log_err "https://github.com/graydon/rust/issues/773 - put put ()";
228-
} else if contains(p.err, "pointer being freed was not allocated") &&
229-
contains(p.out, "Out of stack space, sorry") {
228+
} else if contains(istr::to_estr(p.err), "pointer being freed was not allocated") &&
229+
contains(istr::to_estr(p.out), "Out of stack space, sorry") {
230230
log_err "https://github.com/graydon/rust/issues/768 + https://github.com/graydon/rust/issues/778"
231231
} else {
232-
log_err "Stderr: " + p.err;
232+
log_err ~"Stderr: " + p.err;
233233
fail "Unfamiliar error message";
234234
}
235-
} else if contains(p.out, "non-exhaustive match failure") &&
236-
contains(p.out, "alias.rs") {
235+
} else if contains(istr::to_estr(p.out), "non-exhaustive match failure") &&
236+
contains(istr::to_estr(p.out), "alias.rs") {
237237
log_err "https://github.com/graydon/rust/issues/772";
238-
} else if contains(p.out, "non-exhaustive match failure") &&
239-
contains(p.out, "trans.rs") && contains(code, "put") {
238+
} else if contains(istr::to_estr(p.out), "non-exhaustive match failure") &&
239+
contains(istr::to_estr(p.out), "trans.rs") && contains(code, "put") {
240240
log_err "https://github.com/graydon/rust/issues/774";
241-
} else if contains(p.out, "Out of stack space, sorry") {
241+
} else if contains(istr::to_estr(p.out), "Out of stack space, sorry") {
242242
log_err "Possibly a variant of https://github.com/graydon/rust/issues/768";
243243
} else if p.status == 256 {
244-
if !contains(p.out, "error:") {
244+
if !contains(istr::to_estr(p.out), "error:") {
245245
fail "Exited with status 256 without a span-error";
246246
}
247247
} else if p.status == 11 {

src/lib/run_program.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ fn start_program(prog: &istr, args: &[istr]) -> @program_res {
100100
os::fd_FILE(pipe_err.in), false));
101101
}
102102

103-
fn read_all(rd: &io::reader) -> str {
104-
let buf = "";
103+
fn read_all(rd: &io::reader) -> istr {
104+
let buf = ~"";
105105
while !rd.eof() {
106106
let bytes = rd.read_bytes(4096u);
107-
buf += str::unsafe_from_bytes(bytes);
107+
buf += istr::unsafe_from_bytes(bytes);
108108
}
109109
ret buf;
110110
}
111111

112112
fn program_output(prog: &istr, args: &[istr]) ->
113-
{status: int, out: str, err: str} {
113+
{status: int, out: istr, err: istr} {
114114
let pr = start_program(prog, args);
115115
pr.close_input();
116116
ret {status: pr.finish(),

0 commit comments

Comments
 (0)