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

Consolidate exhaustiveness-related tests #79243

Merged
merged 2 commits into from
Nov 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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: 1 addition & 0 deletions compiler/rustc_mir_build/src/thir/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! - ui/or-patterns
//! - ui/consts/const_in_pattern
//! - ui/rfc-2008-non-exhaustive
//! - ui/half-open-range-patterns
//! - probably many others
//! I (Nadrieril) prefer to put new tests in `ui/pattern/usefulness` unless there's a specific
//! reason not to, for example if they depend on a particular feature like or_patterns.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#![feature(exclusive_range_pattern)]

use std::usize::MAX;
use std::{isize, usize};

fn main() {
match 0usize { //~ERROR non-exhaustive patterns: `_` not covered
0..=MAX => {}
match 0usize {
//~^ ERROR non-exhaustive patterns: `_` not covered
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}

match 0isize { //~ERROR non-exhaustive patterns: `_` not covered
1..=20 => {}
-5..3 => {}
match 0isize {
//~^ ERROR non-exhaustive patterns: `_` not covered
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `isize`
//~| NOTE `isize` does not have a fixed maximum value
isize::MIN..=isize::MAX => {}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11
--> $DIR/feature-gate-precise_pointer_size_matching.rs:4:11
|
LL | match 0usize {
| ^^^^^^ pattern `_` not covered
Expand All @@ -10,7 +10,7 @@ LL | match 0usize {
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching

error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
--> $DIR/feature-gate-precise_pointer_size_matching.rs:12:11
|
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
Expand Down
172 changes: 0 additions & 172 deletions src/test/ui/pattern/usefulness/exhaustive_integer_patterns.rs

This file was deleted.

146 changes: 0 additions & 146 deletions src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ fn main() {
match 0.0 { //~ ERROR non-exhaustive patterns
0.0..=1.0 => {}
}

match 1.0f64 {
0.01f64 ..= 6.5f64 => {}
0.02f64 => {} //~ ERROR unreachable pattern
_ => {}
};
}
Loading