Skip to content

Commit 37b879b

Browse files
committed
Fix fuzzer to compile with ivec-ized pp module.
1 parent e9a6fc9 commit 37b879b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/fuzzer/fuzzer.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import std::getopts;
66
import std::getopts::optopt;
77
import std::getopts::opt_present;
88
import std::getopts::opt_str;
9-
import std::io;
10-
import std::io::stdout;
9+
import std::ioivec;
10+
import std::ioivec::stdout;
1111
import std::vec;
1212
import std::ivec;
1313
import std::str;
@@ -46,11 +46,11 @@ import rustc::lib::llvm;
4646
*/
4747

4848
fn read_whole_file(&str filename) -> str {
49-
str::unsafe_from_bytes(io::file_reader(filename).read_whole_stream())
49+
str::unsafe_from_bytes_ivec(ioivec::file_reader(filename).read_whole_stream())
5050
}
5151

5252
fn write_file(&str filename, &str content) {
53-
io::file_writer(filename, [io::create]).write_str(content);
53+
ioivec::file_writer(filename, ~[ioivec::create]).write_str(content);
5454
}
5555

5656
fn file_contains(&str filename, &str needle) -> bool {
@@ -145,9 +145,9 @@ fn replace_expr_in_crate(&ast::crate crate, uint i, ast::expr_ newexpr) -> ast::
145145

146146
iter under(uint n) -> uint { let uint i = 0u; while (i < n) { put i; i += 1u; } }
147147

148-
fn devnull() -> io::writer { std::io::string_writer().get_writer() }
148+
fn devnull() -> ioivec::writer { std::ioivec::string_writer().get_writer() }
149149

150-
fn as_str(fn (io::writer) f) -> str { auto w = std::io::string_writer(); f(w.get_writer()); w.get_str() }
150+
fn as_str(fn (ioivec::writer) f) -> str { auto w = std::ioivec::string_writer(); f(w.get_writer()); w.get_str() }
151151

152152
fn pp_variants(&ast::crate crate, &codemap::codemap cmap, &str filename) {
153153
auto exprs = steal_exprs(crate);
@@ -166,7 +166,6 @@ fn pp_variants(&ast::crate crate, &codemap::codemap cmap, &str filename) {
166166

167167
fn check_roundtrip(@ast::crate crate2, &codemap::codemap cmap, &str filename) {
168168
auto str3 = as_str(bind pprust::print_crate(cmap, crate2, filename, _, pprust::no_ann()));
169-
auto cm4 = codemap::new_codemap();
170169
if (true
171170
&& !contains(str3, "][]") // https://github.com/graydon/rust/issues/669
172171
&& !contains(str3, "][mutable]") // https://github.com/graydon/rust/issues/669
@@ -175,9 +174,10 @@ fn check_roundtrip(@ast::crate crate2, &codemap::codemap cmap, &str filename) {
175174
&& !contains(str3, "spawn") // more precedence issues
176175
&& !contains(str3, "bind") // more precedence issues?
177176
) {
177+
auto cm4 = codemap::new_codemap();
178178
auto crate4 = parser::parse_crate_from_source_str(filename, str3, ~[], cm4);
179179
// should compare crates at this point, but it's easier to compare strings
180-
auto str5 = as_str(bind pprust::print_crate(cmap, crate4, filename, _, pprust::no_ann()));
180+
auto str5 = as_str(bind pprust::print_crate(cm4, crate4, filename, _, pprust::no_ann()));
181181
if (!str::is_ascii(str3)) {
182182
log_err "Non-ASCII in " + filename; // why does non-ASCII work correctly with "rustc --pretty normal" but not here???
183183
} else if (str3 != str5) {

0 commit comments

Comments
 (0)