Skip to content

Commit 1d63549

Browse files
committed
---
yaml --- r: 22757 b: refs/heads/master c: f8dc928 h: refs/heads/master i: 22755: 411247d v: v3
1 parent 020c5ca commit 1d63549

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 62d4f8fe825c907bd03c275f85aeeaf7b25c4336
2+
refs/heads/master: f8dc9283ad13f990d1ee5ac814eac49189edcd59
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/io.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,11 @@ fn seek_in_buf(offset: int, pos: uint, len: uint, whence: seek_style) ->
687687
688688
fn read_whole_file_str(file: ~str) -> result<~str, ~str> {
689689
result::chain(read_whole_file(file), |bytes| {
690-
result::ok(str::from_bytes(bytes))
690+
if str::is_utf8(bytes) {
691+
result::ok(str::from_bytes(bytes))
692+
} else {
693+
result::err(file + ~" is not UTF-8")
694+
}
691695
})
692696
}
693697

2.96 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// error-pattern: is not UTF-8
2+
3+
fn foo() {
4+
#include("not-utf8.bin")
5+
}

0 commit comments

Comments
 (0)