about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/hair/pattern/_match.rs3
-rw-r--r--src/test/ui/exhaustive_integer_patterns.rs8
-rw-r--r--src/test/ui/exhaustive_integer_patterns.stderr14
3 files changed, 23 insertions, 2 deletions
diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs
index e47e2899507..81f7d439feb 100644
--- a/src/librustc_mir/hair/pattern/_match.rs
+++ b/src/librustc_mir/hair/pattern/_match.rs
@@ -1441,7 +1441,8 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>(
                 let ctor_range = IntRange::from_ctor(tcx, &ctor).unwrap();
 
                 /// Represents a border between 2 integers. Because the intervals spanning borders
-                /// must be able to cover every integer, we need 2^128 + 1 such borders.
+                /// must be able to cover every integer, we need to be able to represent
+                /// 2^128 + 1 such borders.
                 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
                 enum Border {
                     JustBefore(u128),
diff --git a/src/test/ui/exhaustive_integer_patterns.rs b/src/test/ui/exhaustive_integer_patterns.rs
index a8e9e74905c..7825aaa2912 100644
--- a/src/test/ui/exhaustive_integer_patterns.rs
+++ b/src/test/ui/exhaustive_integer_patterns.rs
@@ -162,4 +162,12 @@ fn main() {
     match 0u128 { //~ ERROR non-exhaustive patterns
         0 ..= LIM => {}
     }
+
+    match 0u128 { //~ ERROR non-exhaustive patterns
+        0 ..= 4 => {}
+    }
+
+    match 0u128 { //~ ERROR non-exhaustive patterns
+        4 ..= u128::MAX => {}
+    }
 }
diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr
index 3a47a091012..44b05a12aeb 100644
--- a/src/test/ui/exhaustive_integer_patterns.stderr
+++ b/src/test/ui/exhaustive_integer_patterns.stderr
@@ -70,6 +70,18 @@ error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u
 LL |     match 0u128 { //~ ERROR non-exhaustive patterns
    |           ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered
 
-error: aborting due to 11 previous errors
+error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:166:11
+   |
+LL |     match 0u128 { //~ ERROR non-exhaustive patterns
+   |           ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered
+
+error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:170:11
+   |
+LL |     match 0u128 { //~ ERROR non-exhaustive patterns
+   |           ^^^^^ pattern `0u128..=3u128` not covered
+
+error: aborting due to 13 previous errors
 
 For more information about this error, try `rustc --explain E0004`.