Skip to content

Commit ff1f0b0

Browse files
committed
explain what happens in a test
1 parent 9ec5264 commit ff1f0b0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

tests/run-pass/transmute_fat2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ fn main() {
88
let bad = unsafe {
99
std::mem::transmute::<u64, &[u8]>(42)
1010
};
11+
// This created a slice with length 0, so the following will fail the bounds check.
1112
bad[0];
1213
}

tests/run-pass/transmute_fat2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:11:5
1+
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:12:5

0 commit comments

Comments
 (0)