forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#134103 - compiler-errors:never-pat-range, r…
…=oli-obk Don't ICE when encountering never in range pattern Fixes rust-lang#133947 r? oli-obk
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/133947>. | ||
|
||
// Make sure we don't ICE when there's `!` in a range pattern. | ||
// | ||
// This shouldn't be allowed anyways, but we only deny it during MIR | ||
// building, so make sure we handle it semi-gracefully during typeck. | ||
|
||
#![feature(never_type)] | ||
|
||
fn main() { | ||
let x: !; | ||
match 1 { | ||
0..x => {} | ||
//~^ ERROR only `char` and numeric types are allowed in range patterns | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0029]: only `char` and numeric types are allowed in range patterns | ||
--> $DIR/never-in-range-pat.rs:13:12 | ||
| | ||
LL | 0..x => {} | ||
| - ^ this is of type `!` but it should be `char` or numeric | ||
| | | ||
| this is of type `{integer}` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0029`. |