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

http://github.com/jruderman/rust · Rust · 9 lines · 4 code · 2 blank · 3 comment · 1 complexity · af2cd1c3f7f08aada117173c7608e827 MD5 · raw file

  1. // -*- rust -*-
  2. // error-pattern:bounds check
  3. fn main() {
  4. let s: ~str = ~"hello";
  5. // Bounds-check failure.
  6. assert (s[5] == 0x0 as u8);
  7. }