From f513aa3a059870775ed935413e3e617b5f713e69 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 1 Oct 2019 16:37:22 -0700 Subject: [PATCH 1/2] Allow const_err in out_of_bounds_indexing tests --- tests/ui/out_of_bounds_indexing/empty_array.rs | 2 +- tests/ui/out_of_bounds_indexing/empty_array.stderr | 10 +--------- tests/ui/out_of_bounds_indexing/issue-3102.rs | 2 +- tests/ui/out_of_bounds_indexing/simple.rs | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/ui/out_of_bounds_indexing/empty_array.rs b/tests/ui/out_of_bounds_indexing/empty_array.rs index 884e46eb4ee1..eebd5a6e2fbf 100644 --- a/tests/ui/out_of_bounds_indexing/empty_array.rs +++ b/tests/ui/out_of_bounds_indexing/empty_array.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, clippy::unnecessary_operation)] +#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)] fn main() { let empty: [i8; 0] = []; diff --git a/tests/ui/out_of_bounds_indexing/empty_array.stderr b/tests/ui/out_of_bounds_indexing/empty_array.stderr index cda78a47ec73..819c01f51739 100644 --- a/tests/ui/out_of_bounds_indexing/empty_array.stderr +++ b/tests/ui/out_of_bounds_indexing/empty_array.stderr @@ -1,11 +1,3 @@ -error: index out of bounds: the len is 0 but the index is 0 - --> $DIR/empty_array.rs:6:5 - | -LL | empty[0]; - | ^^^^^^^^ - | - = note: `#[deny(const_err)]` on by default - error: range is out of bounds --> $DIR/empty_array.rs:7:12 | @@ -50,5 +42,5 @@ error: range is out of bounds LL | &empty[..=0]; | ^ -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors diff --git a/tests/ui/out_of_bounds_indexing/issue-3102.rs b/tests/ui/out_of_bounds_indexing/issue-3102.rs index edd2123d48a5..f20a0ede1137 100644 --- a/tests/ui/out_of_bounds_indexing/issue-3102.rs +++ b/tests/ui/out_of_bounds_indexing/issue-3102.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect)] +#![allow(clippy::no_effect, const_err)] fn main() { let x = [1, 2, 3, 4]; diff --git a/tests/ui/out_of_bounds_indexing/simple.rs b/tests/ui/out_of_bounds_indexing/simple.rs index 4c541c23f5f4..590e578d758e 100644 --- a/tests/ui/out_of_bounds_indexing/simple.rs +++ b/tests/ui/out_of_bounds_indexing/simple.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, clippy::unnecessary_operation)] +#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)] fn main() { let x = [1, 2, 3, 4]; From 4318854bfc8a3dc1755ca345a651112ea6bbded3 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 1 Oct 2019 16:45:07 -0700 Subject: [PATCH 2/2] Remove tests that only ICE on CI --- .../ui/out_of_bounds_indexing/empty_array.rs | 19 -------- .../out_of_bounds_indexing/empty_array.stderr | 46 ------------------- 2 files changed, 65 deletions(-) delete mode 100644 tests/ui/out_of_bounds_indexing/empty_array.rs delete mode 100644 tests/ui/out_of_bounds_indexing/empty_array.stderr diff --git a/tests/ui/out_of_bounds_indexing/empty_array.rs b/tests/ui/out_of_bounds_indexing/empty_array.rs deleted file mode 100644 index eebd5a6e2fbf..000000000000 --- a/tests/ui/out_of_bounds_indexing/empty_array.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)] - -fn main() { - let empty: [i8; 0] = []; - empty[0]; - &empty[1..5]; - &empty[0..=4]; - &empty[..=4]; - &empty[1..]; - &empty[..4]; - &empty[0..=0]; - &empty[..=0]; - - &empty[0..]; // Ok, should not produce stderr. - &empty[0..0]; // Ok, should not produce stderr. - &empty[..0]; // Ok, should not produce stderr. - &empty[..]; // Ok, should not produce stderr. -} diff --git a/tests/ui/out_of_bounds_indexing/empty_array.stderr b/tests/ui/out_of_bounds_indexing/empty_array.stderr deleted file mode 100644 index 819c01f51739..000000000000 --- a/tests/ui/out_of_bounds_indexing/empty_array.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error: range is out of bounds - --> $DIR/empty_array.rs:7:12 - | -LL | &empty[1..5]; - | ^ - | - = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings` - -error: range is out of bounds - --> $DIR/empty_array.rs:8:16 - | -LL | &empty[0..=4]; - | ^ - -error: range is out of bounds - --> $DIR/empty_array.rs:9:15 - | -LL | &empty[..=4]; - | ^ - -error: range is out of bounds - --> $DIR/empty_array.rs:10:12 - | -LL | &empty[1..]; - | ^ - -error: range is out of bounds - --> $DIR/empty_array.rs:11:14 - | -LL | &empty[..4]; - | ^ - -error: range is out of bounds - --> $DIR/empty_array.rs:12:16 - | -LL | &empty[0..=0]; - | ^ - -error: range is out of bounds - --> $DIR/empty_array.rs:13:15 - | -LL | &empty[..=0]; - | ^ - -error: aborting due to 7 previous errors -