]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / out_of_bounds_indexing / simple.rs
index 4c541c23f5f472608eba394c39f180ee3ea7892f..c38ca512381653de71e0b9277fdaeae18fa3c981 100644 (file)
@@ -5,11 +5,18 @@ fn main() {
     let x = [1, 2, 3, 4];
 
     &x[..=4];
+    //~^ ERROR: range is out of bounds
+    //~| NOTE: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
     &x[1..5];
+    //~^ ERROR: range is out of bounds
     &x[5..];
+    //~^ ERROR: range is out of bounds
     &x[..5];
+    //~^ ERROR: range is out of bounds
     &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
+    //~^ ERROR: range is out of bounds
     &x[0..=4];
+    //~^ ERROR: range is out of bounds
 
     &x[4..]; // Ok, should not produce stderr.
     &x[..4]; // Ok, should not produce stderr.