about summary refs log tree commit diff
path: root/src/test/run-fail/str-overrun.rs
blob: e566308a08767ababa165f2347a2b4709116faf1 (plain)
1
2
3
4
5
6
7
// error-pattern:index out of bounds: the len is 5 but the index is 5
fn main() {
    let s: String = "hello".to_string();

    // Bounds-check panic.
    assert_eq!(s.as_bytes()[5], 0x0 as u8);
}