Skip to content

Commit

Permalink
Prefer min_exhaustive_patterns in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Feb 7, 2024
1 parent e1df69a commit 464d5e7
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// visibly uninhabited).
// edition:2021
// run-pass
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

pub fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/never_type/issue-44402.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![allow(dead_code)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

// Regression test for inhabitedness check. The old
// cache used to cause us to incorrectly decide
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/always-inhabited-union-ref.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The precise semantics of inhabitedness with respect to unions and references is currently
// undecided. This test file currently checks a conservative choice.

#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/impl-trait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(type_alias_impl_trait)]
#![feature(non_exhaustive_omitted_patterns_lint)]
#![deny(unreachable_patterns)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/match-privately-empty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

mod private {
pub struct Private {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/uninhabited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// `Ty::is_inhabited_from` function.
#![feature(never_type)]
#![feature(never_type_fallback)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![deny(unreachable_patterns)]

macro_rules! assert_empty {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reachable/unreachable-loop-patterns.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(never_type, never_type_fallback)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

#![allow(unreachable_code)]
#![deny(unreachable_patterns)]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//[pass] check-pass
//[fail] check-fail
#![feature(never_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![allow(incomplete_features)]

#[derive(Copy, Clone)]
Expand Down Expand Up @@ -107,7 +107,7 @@ fn never_pattern_typeck_pass(void: Void) {
}
match (&[] as &[Void]) {
[] => {}
[!],
[!, ..],
}
// Accept on a composite empty type.
match None::<&(u32, Void)> {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/rfcs/rfc-0000-never_patterns/unreachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//[normal] check-pass
#![feature(never_patterns)]
#![allow(incomplete_features)]
#![cfg_attr(exh_pats, feature(exhaustive_patterns))]
#![cfg_attr(exh_pats, feature(min_exhaustive_patterns))]
#![allow(dead_code, unreachable_code)]
#![deny(unreachable_patterns)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ pub struct IndirectUninhabitedVariants(UninhabitedVariants);
struct A;

// This test checks that an empty match on a non-exhaustive uninhabited type through a level of
// indirection from the defining crate will not compile without `#![feature(exhaustive_patterns)]`.
// indirection from the defining crate will not compile without
// `#![feature(min_exhaustive_patterns)]`.

fn cannot_empty_match_on_empty_enum_to_anything(x: IndirectUninhabitedEnum) -> A {
match x {} //~ ERROR non-exhaustive patterns
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match_same_crate.rs:34:11
--> $DIR/indirect_match_same_crate.rs:35:11
|
LL | match x {}
| ^
Expand All @@ -18,7 +18,7 @@ LL ~ }
|

error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:38:11
--> $DIR/indirect_match_same_crate.rs:39:11
|
LL | match x {}
| ^
Expand All @@ -37,7 +37,7 @@ LL ~ }
|

error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:42:11
--> $DIR/indirect_match_same_crate.rs:43:11
|
LL | match x {}
| ^
Expand All @@ -56,7 +56,7 @@ LL ~ }
|

error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match_same_crate.rs:48:11
--> $DIR/indirect_match_same_crate.rs:49:11
|
LL | match x {}
| ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// aux-build:uninhabited.rs
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

extern crate uninhabited;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-pass

#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

#[non_exhaustive]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// aux-build:uninhabited.rs
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

extern crate uninhabited;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-pass

#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

#[non_exhaustive]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// aux-build:uninhabited.rs
// build-pass (FIXME(62277): could be check-pass?)
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

extern crate uninhabited;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(unreachable_patterns)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)]

#[non_exhaustive]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass

#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

enum Void {}
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/uninhabited/uninhabited-irrefutable.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]

mod foo {
pub struct SecretlyEmpty {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/uninhabited/uninhabited-patterns.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(box_patterns)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(min_exhaustive_patterns)]
#![deny(unreachable_patterns)]

mod foo {
Expand Down

0 comments on commit 464d5e7

Please sign in to comment.