Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename overlapping_patterns lint #78242

Merged
merged 6 commits into from
Dec 22, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -283,7 +283,6 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
UNUSED_MUT,
UNREACHABLE_CODE,
UNREACHABLE_PATTERNS,
OVERLAPPING_RANGE_ENDPOINTS,
UNUSED_MUST_USE,
UNUSED_UNSAFE,
PATH_STATEMENTS,
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(exclusive_range_pattern)]
#![feature(assoc_char_consts)]
#![allow(overlapping_range_endpoints)]
#![deny(unreachable_patterns)]

macro_rules! m {
24 changes: 12 additions & 12 deletions src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/exhaustiveness.rs:47:8
--> $DIR/exhaustiveness.rs:48:8
|
LL | m!(0u8, 0..255);
| ^^^ pattern `u8::MAX` not covered
@@ -8,7 +8,7 @@ LL | m!(0u8, 0..255);
= note: the matched value is of type `u8`

error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/exhaustiveness.rs:48:8
--> $DIR/exhaustiveness.rs:49:8
|
LL | m!(0u8, 0..=254);
| ^^^ pattern `u8::MAX` not covered
@@ -17,7 +17,7 @@ LL | m!(0u8, 0..=254);
= note: the matched value is of type `u8`

error[E0004]: non-exhaustive patterns: `0_u8` not covered
--> $DIR/exhaustiveness.rs:49:8
--> $DIR/exhaustiveness.rs:50:8
|
LL | m!(0u8, 1..=255);
| ^^^ pattern `0_u8` not covered
@@ -26,7 +26,7 @@ LL | m!(0u8, 1..=255);
= note: the matched value is of type `u8`

error[E0004]: non-exhaustive patterns: `42_u8` not covered
--> $DIR/exhaustiveness.rs:50:8
--> $DIR/exhaustiveness.rs:51:8
|
LL | m!(0u8, 0..42 | 43..=255);
| ^^^ pattern `42_u8` not covered
@@ -35,7 +35,7 @@ LL | m!(0u8, 0..42 | 43..=255);
= note: the matched value is of type `u8`

error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/exhaustiveness.rs:51:8
--> $DIR/exhaustiveness.rs:52:8
|
LL | m!(0i8, -128..127);
| ^^^ pattern `i8::MAX` not covered
@@ -44,7 +44,7 @@ LL | m!(0i8, -128..127);
= note: the matched value is of type `i8`

error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/exhaustiveness.rs:52:8
--> $DIR/exhaustiveness.rs:53:8
|
LL | m!(0i8, -128..=126);
| ^^^ pattern `i8::MAX` not covered
@@ -53,7 +53,7 @@ LL | m!(0i8, -128..=126);
= note: the matched value is of type `i8`

error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/exhaustiveness.rs:53:8
--> $DIR/exhaustiveness.rs:54:8
|
LL | m!(0i8, -127..=127);
| ^^^ pattern `i8::MIN` not covered
@@ -62,7 +62,7 @@ LL | m!(0i8, -127..=127);
= note: the matched value is of type `i8`

error[E0004]: non-exhaustive patterns: `0_i8` not covered
--> $DIR/exhaustiveness.rs:54:11
--> $DIR/exhaustiveness.rs:55:11
|
LL | match 0i8 {
| ^^^ pattern `0_i8` not covered
@@ -71,7 +71,7 @@ LL | match 0i8 {
= note: the matched value is of type `i8`

error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/exhaustiveness.rs:59:8
--> $DIR/exhaustiveness.rs:60:8
|
LL | m!(0u128, 0..=ALMOST_MAX);
| ^^^^^ pattern `u128::MAX` not covered
@@ -80,7 +80,7 @@ LL | m!(0u128, 0..=ALMOST_MAX);
= note: the matched value is of type `u128`

error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered
--> $DIR/exhaustiveness.rs:60:8
--> $DIR/exhaustiveness.rs:61:8
|
LL | m!(0u128, 0..=4);
| ^^^^^ pattern `5_u128..=u128::MAX` not covered
@@ -89,7 +89,7 @@ LL | m!(0u128, 0..=4);
= note: the matched value is of type `u128`

error[E0004]: non-exhaustive patterns: `0_u128` not covered
--> $DIR/exhaustiveness.rs:61:8
--> $DIR/exhaustiveness.rs:62:8
|
LL | m!(0u128, 1..=u128::MAX);
| ^^^^^ pattern `0_u128` not covered
@@ -98,7 +98,7 @@ LL | m!(0u128, 1..=u128::MAX);
= note: the matched value is of type `u128`

error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered
--> $DIR/exhaustiveness.rs:69:11
--> $DIR/exhaustiveness.rs:70:11
|
LL | match (0u8, true) {
| ^^^^^^^^^^^ pattern `(126_u8..=127_u8, false)` not covered
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(exclusive_range_pattern)]
#![allow(overlapping_range_endpoints)]
#![deny(unreachable_patterns)]

macro_rules! m {
50 changes: 25 additions & 25 deletions src/test/ui/pattern/usefulness/integer-ranges/reachability.stderr
Original file line number Diff line number Diff line change
@@ -1,149 +1,149 @@
error: unreachable pattern
--> $DIR/reachability.rs:16:17
--> $DIR/reachability.rs:17:17
|
LL | m!(0u8, 42, 42);
| ^^
|
note: the lint level is defined here
--> $DIR/reachability.rs:2:9
--> $DIR/reachability.rs:3:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:20:22
--> $DIR/reachability.rs:21:22
|
LL | m!(0u8, 20..=30, 20);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:21:22
--> $DIR/reachability.rs:22:22
|
LL | m!(0u8, 20..=30, 21);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:22:22
--> $DIR/reachability.rs:23:22
|
LL | m!(0u8, 20..=30, 25);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:23:22
--> $DIR/reachability.rs:24:22
|
LL | m!(0u8, 20..=30, 29);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:24:22
--> $DIR/reachability.rs:25:22
|
LL | m!(0u8, 20..=30, 30);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:27:21
--> $DIR/reachability.rs:28:21
|
LL | m!(0u8, 20..30, 20);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:28:21
--> $DIR/reachability.rs:29:21
|
LL | m!(0u8, 20..30, 21);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:29:21
--> $DIR/reachability.rs:30:21
|
LL | m!(0u8, 20..30, 25);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:30:21
--> $DIR/reachability.rs:31:21
|
LL | m!(0u8, 20..30, 29);
| ^^

error: unreachable pattern
--> $DIR/reachability.rs:34:22
--> $DIR/reachability.rs:35:22
|
LL | m!(0u8, 20..=30, 20..=30);
| ^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:35:22
--> $DIR/reachability.rs:36:22
|
LL | m!(0u8, 20.. 30, 20.. 30);
| ^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:36:22
--> $DIR/reachability.rs:37:22
|
LL | m!(0u8, 20..=30, 20.. 30);
| ^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:38:22
--> $DIR/reachability.rs:39:22
|
LL | m!(0u8, 20..=30, 21..=30);
| ^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:39:22
--> $DIR/reachability.rs:40:22
|
LL | m!(0u8, 20..=30, 20..=29);
| ^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:41:24
--> $DIR/reachability.rs:42:24
|
LL | m!('a', 'A'..='z', 'a'..='z');
| ^^^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:48:9
--> $DIR/reachability.rs:49:9
|
LL | 5..=8 => {},
| ^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:54:9
--> $DIR/reachability.rs:55:9
|
LL | 5..15 => {},
| ^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:61:9
--> $DIR/reachability.rs:62:9
|
LL | 5..25 => {},
| ^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:69:9
--> $DIR/reachability.rs:70:9
|
LL | 5..25 => {},
| ^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:75:9
--> $DIR/reachability.rs:76:9
|
LL | 5..15 => {},
| ^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:82:9
--> $DIR/reachability.rs:83:9
|
LL | '\u{D7FF}'..='\u{E000}' => {},
| ^^^^^^^^^^^^^^^^^^^^^^^

error: unreachable pattern
--> $DIR/reachability.rs:103:9
--> $DIR/reachability.rs:104:9
|
LL | &FOO => {}
| ^^^^

error: unreachable pattern
--> $DIR/reachability.rs:104:9
--> $DIR/reachability.rs:105:9
|
LL | BAR => {}
| ^^^