rust/src/test/run-fail/str-overrun.rs

10 lines
151 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
// error-pattern:bounds check
2010-06-23 23:03:09 -05:00
fn main() {
let s: ~str = ~"hello";
2010-06-23 23:03:09 -05:00
// Bounds-check failure.
assert (s[5] == 0x0 as u8);
}