Skip to content

Commit 420b426

Browse files
committed
fix bounds checking failure message
casting the `uint` to an `int` can result in printing high values as negative intege
1 parent a7e8957 commit 420b426

File tree

3 files changed

+1
-41
lines changed

3 files changed

+1
-41
lines changed

src/libstd/unstable/lang.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn fail_(expr: *c_char, file: *c_char, line: size_t) -> ! {
2525
pub fn fail_bounds_check(file: *c_char, line: size_t,
2626
index: size_t, len: size_t) {
2727
let msg = format!("index out of bounds: the len is {} but the index is {}",
28-
len as int, index as int);
28+
len as uint, index as uint);
2929
do msg.with_c_str |buf| {
3030
fail_(buf, file, line);
3131
}

src/test/run-fail/small-negative-indexing.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/test/run-fail/vec-underrun.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)