Skip to content

Commit 9be5ef3

Browse files
committed
---
yaml --- r: 4346 b: refs/heads/master c: 35e9e02 h: refs/heads/master v: v3
1 parent f6727ec commit 9be5ef3

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
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: a1a25969a072a33f68fba16a2a3859a7d96809c2
2+
refs/heads/master: 35e9e02066fd3f8fde35212f465e0a6e56de5d8c

trunk/src/comp/syntax/codemap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap,
108108

109109
// FIXME: reading in the entire file is the worst possible way to
110110
// get access to the necessary lines.
111-
let rdr = ioivec::file_reader(lines.name);
112-
let file = str::unsafe_from_bytes_ivec(rdr.read_whole_stream());
111+
let file = ioivec::read_whole_file_str(lines.name);
113112
let fm = get_filemap(cm, lines.name);
114113

115114
// arbitrarily only print up to six lines of the error

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ fn new_parser_from_file(sess: parse_sess, cfg:
6262
ast::crate_cfg, path: str,
6363
chpos: uint, byte_pos: uint,
6464
ftype: file_type) -> parser {
65-
let srdr = ioivec::file_reader(path);
66-
let src = str::unsafe_from_bytes_ivec(srdr.read_whole_stream());
65+
let src = ioivec::read_whole_file_str(path);
6766
let filemap = codemap::new_filemap(path, chpos, byte_pos);
6867
sess.cm.files += ~[filemap];
6968
let itr = @interner::mk(str::hash, str::eq);

trunk/src/fuzzer/fuzzer.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import rustc::syntax::codemap;
2121
import rustc::syntax::parse::parser;
2222
import rustc::syntax::print::pprust;
2323

24-
25-
fn read_whole_file(filename: &str) -> str {
26-
str::unsafe_from_bytes_ivec(ioivec::file_reader(filename).read_whole_stream())
27-
}
28-
2924
fn write_file(filename: &str, content: &str) {
3025
ioivec::file_writer(filename,
3126
~[ioivec::create,
@@ -35,7 +30,7 @@ fn write_file(filename: &str, content: &str) {
3530
}
3631

3732
fn file_contains(filename: &str, needle: &str) -> bool {
38-
let contents = read_whole_file(filename);
33+
let contents = ioivec::read_whole_file_str(filename);
3934
ret str::find(contents, needle) != -1;
4035
}
4136

@@ -325,7 +320,7 @@ fn check_convergence(files: &str[]) {
325320
log_err #fmt("pp convergence tests: %u files", ivec::len(files));
326321
for file in files {
327322
if !file_is_confusing(file) {
328-
let s = read_whole_file(file);
323+
let s = ioivec::read_whole_file_str(file);
329324
if !content_is_confusing(s) {
330325
log_err #fmt("pp converge: %s", file);
331326
// Change from 7u to 2u when https://github.com/graydon/rust/issues/759 is fixed
@@ -338,7 +333,7 @@ fn check_convergence(files: &str[]) {
338333
fn check_variants(files: &str[]) {
339334
for file in files {
340335
if !file_is_confusing(file) {
341-
let s = read_whole_file(file);
336+
let s = ioivec::read_whole_file_str(file);
342337
if content_is_dangerous_to_modify(s) || content_is_confusing(s) { cont; }
343338
log_err "check_variants: " + file;
344339
let codemap = codemap::new_codemap();

trunk/src/test/compiletest/runtest.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import std::io;
2+
import std::ioivec;
23
import std::str;
34
import std::option;
45
import std::vec;
@@ -86,8 +87,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
8687
option::none. { 2 }
8788
};
8889

89-
let srcs = ~[str::unsafe_from_bytes(
90-
io::file_reader(testfile).read_whole_stream())];
90+
let srcs = ~[ioivec::read_whole_file_str(testfile)];
9191

9292
let round = 0;
9393
while round < rounds {
@@ -106,8 +106,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
106106
let expected = alt props.pp_exact {
107107
option::some(file) {
108108
let filepath = fs::connect(fs::dirname(testfile), file);
109-
str::unsafe_from_bytes(
110-
io::file_reader(filepath).read_whole_stream())
109+
ioivec::read_whole_file_str(filepath)
111110
}
112111
option::none. {
113112
srcs.(ivec::len(srcs) - 2u)

0 commit comments

Comments
 (0)