diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-04-16 15:50:32 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-05-06 14:02:55 +0900 |
| commit | e69748ba4f48efdc9a1dfcf8c16bc9aba39a86e3 (patch) | |
| tree | 33fc77d7a08037da5deeb878068f5af0284aa732 /src/test/ui/vec | |
| parent | 43271a39adc26d29350d4830b594c6435472815e (diff) | |
Move tests from `test/run-fail` to UI
Diffstat (limited to 'src/test/ui/vec')
| -rw-r--r-- | src/test/ui/vec/vec-overrun.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/vec/vec-overrun.rs b/src/test/ui/vec/vec-overrun.rs new file mode 100644 index 00000000000..4f6aec7773f --- /dev/null +++ b/src/test/ui/vec/vec-overrun.rs @@ -0,0 +1,11 @@ +// run-fail +// error-pattern:index out of bounds: the len is 1 but the index is 2 + +fn main() { + let v: Vec<isize> = vec![10]; + let x: usize = 0; + assert_eq!(v[x], 10); + // Bounds-check panic. + + assert_eq!(v[x + 2], 20); +} |
