diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 907c84b6f8cf0..0009524ef6f93 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -1,3 +1,6 @@ +/// Note: most tests relevant to this file can be found (at the time of writing) +/// in src/tests/ui/pattern/usefulness. +/// /// This file includes the logic for exhaustiveness and usefulness checking for /// pattern-matching. Specifically, given a list of patterns for a type, we can /// tell whether: diff --git a/src/test/ui/uninhabited/always-inhabited-union-ref.rs b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.rs similarity index 100% rename from src/test/ui/uninhabited/always-inhabited-union-ref.rs rename to src/test/ui/pattern/usefulness/always-inhabited-union-ref.rs diff --git a/src/test/ui/uninhabited/always-inhabited-union-ref.stderr b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr similarity index 100% rename from src/test/ui/uninhabited/always-inhabited-union-ref.stderr rename to src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr diff --git a/src/test/ui/exhaustive_integer_patterns.rs b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.rs similarity index 100% rename from src/test/ui/exhaustive_integer_patterns.rs rename to src/test/ui/pattern/usefulness/exhaustive_integer_patterns.rs diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr similarity index 100% rename from src/test/ui/exhaustive_integer_patterns.stderr rename to src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr diff --git a/src/test/ui/guards-not-exhaustive.rs b/src/test/ui/pattern/usefulness/guards-not-exhaustive.rs similarity index 100% rename from src/test/ui/guards-not-exhaustive.rs rename to src/test/ui/pattern/usefulness/guards-not-exhaustive.rs diff --git a/src/test/ui/pattern/irrefutable-exhaustive-integer-binding.rs b/src/test/ui/pattern/usefulness/irrefutable-exhaustive-integer-binding.rs similarity index 100% rename from src/test/ui/pattern/irrefutable-exhaustive-integer-binding.rs rename to src/test/ui/pattern/usefulness/irrefutable-exhaustive-integer-binding.rs diff --git a/src/test/ui/irrefutable-unit.rs b/src/test/ui/pattern/usefulness/irrefutable-unit.rs similarity index 100% rename from src/test/ui/irrefutable-unit.rs rename to src/test/ui/pattern/usefulness/irrefutable-unit.rs diff --git a/src/test/ui/check_match/issue-35609.rs b/src/test/ui/pattern/usefulness/issue-35609.rs similarity index 100% rename from src/test/ui/check_match/issue-35609.rs rename to src/test/ui/pattern/usefulness/issue-35609.rs diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr similarity index 100% rename from src/test/ui/check_match/issue-35609.stderr rename to src/test/ui/pattern/usefulness/issue-35609.stderr diff --git a/src/test/ui/check_match/issue-43253.rs b/src/test/ui/pattern/usefulness/issue-43253.rs similarity index 100% rename from src/test/ui/check_match/issue-43253.rs rename to src/test/ui/pattern/usefulness/issue-43253.rs diff --git a/src/test/ui/check_match/issue-43253.stderr b/src/test/ui/pattern/usefulness/issue-43253.stderr similarity index 100% rename from src/test/ui/check_match/issue-43253.stderr rename to src/test/ui/pattern/usefulness/issue-43253.stderr diff --git a/src/test/ui/match/match-argm-statics-2.rs b/src/test/ui/pattern/usefulness/match-arm-statics-2.rs similarity index 100% rename from src/test/ui/match/match-argm-statics-2.rs rename to src/test/ui/pattern/usefulness/match-arm-statics-2.rs diff --git a/src/test/ui/match/match-argm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr similarity index 90% rename from src/test/ui/match/match-argm-statics-2.stderr rename to src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index 8c54e030823af..8521e37d3fddc 100644 --- a/src/test/ui/match/match-argm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered - --> $DIR/match-argm-statics-2.rs:17:11 + --> $DIR/match-arm-statics-2.rs:17:11 | LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` not covered @@ -7,7 +7,7 @@ LL | match (true, false) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered - --> $DIR/match-argm-statics-2.rs:29:11 + --> $DIR/match-arm-statics-2.rs:29:11 | LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered @@ -15,7 +15,7 @@ LL | match Some(Some(North)) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered - --> $DIR/match-argm-statics-2.rs:48:11 + --> $DIR/match-arm-statics-2.rs:48:11 | LL | / struct Foo { LL | | bar: Option, diff --git a/src/test/ui/match/match-arm-statics.rs b/src/test/ui/pattern/usefulness/match-arm-statics.rs similarity index 100% rename from src/test/ui/match/match-arm-statics.rs rename to src/test/ui/pattern/usefulness/match-arm-statics.rs diff --git a/src/test/ui/match/match-arm-statics.stderr b/src/test/ui/pattern/usefulness/match-arm-statics.stderr similarity index 100% rename from src/test/ui/match/match-arm-statics.stderr rename to src/test/ui/pattern/usefulness/match-arm-statics.stderr diff --git a/src/test/ui/match/match-byte-array-patterns-2.rs b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.rs similarity index 100% rename from src/test/ui/match/match-byte-array-patterns-2.rs rename to src/test/ui/pattern/usefulness/match-byte-array-patterns-2.rs diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr similarity index 100% rename from src/test/ui/match/match-byte-array-patterns-2.stderr rename to src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr diff --git a/src/test/ui/match/match-byte-array-patterns.rs b/src/test/ui/pattern/usefulness/match-byte-array-patterns.rs similarity index 100% rename from src/test/ui/match/match-byte-array-patterns.rs rename to src/test/ui/pattern/usefulness/match-byte-array-patterns.rs diff --git a/src/test/ui/match/match-byte-array-patterns.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr similarity index 100% rename from src/test/ui/match/match-byte-array-patterns.stderr rename to src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr diff --git a/src/test/ui/match/match-non-exhaustive.rs b/src/test/ui/pattern/usefulness/match-non-exhaustive.rs similarity index 100% rename from src/test/ui/match/match-non-exhaustive.rs rename to src/test/ui/pattern/usefulness/match-non-exhaustive.rs diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr similarity index 100% rename from src/test/ui/match/match-non-exhaustive.stderr rename to src/test/ui/pattern/usefulness/match-non-exhaustive.stderr diff --git a/src/test/ui/match/match-privately-empty.rs b/src/test/ui/pattern/usefulness/match-privately-empty.rs similarity index 100% rename from src/test/ui/match/match-privately-empty.rs rename to src/test/ui/pattern/usefulness/match-privately-empty.rs diff --git a/src/test/ui/match/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr similarity index 100% rename from src/test/ui/match/match-privately-empty.stderr rename to src/test/ui/pattern/usefulness/match-privately-empty.stderr diff --git a/src/test/ui/match/match-range-fail-dominate.rs b/src/test/ui/pattern/usefulness/match-range-fail-dominate.rs similarity index 100% rename from src/test/ui/match/match-range-fail-dominate.rs rename to src/test/ui/pattern/usefulness/match-range-fail-dominate.rs diff --git a/src/test/ui/match/match-range-fail-dominate.stderr b/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr similarity index 100% rename from src/test/ui/match/match-range-fail-dominate.stderr rename to src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr diff --git a/src/test/ui/match/match-ref-ice.rs b/src/test/ui/pattern/usefulness/match-ref-ice.rs similarity index 100% rename from src/test/ui/match/match-ref-ice.rs rename to src/test/ui/pattern/usefulness/match-ref-ice.rs diff --git a/src/test/ui/match/match-ref-ice.stderr b/src/test/ui/pattern/usefulness/match-ref-ice.stderr similarity index 100% rename from src/test/ui/match/match-ref-ice.stderr rename to src/test/ui/pattern/usefulness/match-ref-ice.stderr diff --git a/src/test/ui/match/match-slice-patterns.rs b/src/test/ui/pattern/usefulness/match-slice-patterns.rs similarity index 100% rename from src/test/ui/match/match-slice-patterns.rs rename to src/test/ui/pattern/usefulness/match-slice-patterns.rs diff --git a/src/test/ui/match/match-slice-patterns.stderr b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr similarity index 100% rename from src/test/ui/match/match-slice-patterns.stderr rename to src/test/ui/pattern/usefulness/match-slice-patterns.stderr diff --git a/src/test/ui/match/match-vec-fixed.rs b/src/test/ui/pattern/usefulness/match-vec-fixed.rs similarity index 100% rename from src/test/ui/match/match-vec-fixed.rs rename to src/test/ui/pattern/usefulness/match-vec-fixed.rs diff --git a/src/test/ui/match/match-vec-fixed.stderr b/src/test/ui/pattern/usefulness/match-vec-fixed.stderr similarity index 100% rename from src/test/ui/match/match-vec-fixed.stderr rename to src/test/ui/pattern/usefulness/match-vec-fixed.stderr diff --git a/src/test/ui/match/match-vec-unreachable.rs b/src/test/ui/pattern/usefulness/match-vec-unreachable.rs similarity index 100% rename from src/test/ui/match/match-vec-unreachable.rs rename to src/test/ui/pattern/usefulness/match-vec-unreachable.rs diff --git a/src/test/ui/match/match-vec-unreachable.stderr b/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr similarity index 100% rename from src/test/ui/match/match-vec-unreachable.stderr rename to src/test/ui/pattern/usefulness/match-vec-unreachable.stderr diff --git a/src/test/ui/binding/nested-exhaustive-match.rs b/src/test/ui/pattern/usefulness/nested-exhaustive-match.rs similarity index 100% rename from src/test/ui/binding/nested-exhaustive-match.rs rename to src/test/ui/pattern/usefulness/nested-exhaustive-match.rs diff --git a/src/test/ui/match/non-exhaustive-defined-here.rs b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs similarity index 100% rename from src/test/ui/match/non-exhaustive-defined-here.rs rename to src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs diff --git a/src/test/ui/match/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr similarity index 100% rename from src/test/ui/match/non-exhaustive-defined-here.stderr rename to src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs b/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.rs similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs rename to src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.rs diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr rename to src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs rename to src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr rename to src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-match.rs rename to src/test/ui/pattern/usefulness/non-exhaustive-match.rs diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-match.stderr rename to src/test/ui/pattern/usefulness/non-exhaustive-match.stderr diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs rename to src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr similarity index 100% rename from src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr rename to src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr diff --git a/src/test/ui/refutable-pattern-errors.rs b/src/test/ui/pattern/usefulness/refutable-pattern-errors.rs similarity index 100% rename from src/test/ui/refutable-pattern-errors.rs rename to src/test/ui/pattern/usefulness/refutable-pattern-errors.rs diff --git a/src/test/ui/refutable-pattern-errors.stderr b/src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr similarity index 100% rename from src/test/ui/refutable-pattern-errors.stderr rename to src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr diff --git a/src/test/ui/refutable-pattern-in-fn-arg.rs b/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs similarity index 100% rename from src/test/ui/refutable-pattern-in-fn-arg.rs rename to src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs diff --git a/src/test/ui/refutable-pattern-in-fn-arg.stderr b/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr similarity index 100% rename from src/test/ui/refutable-pattern-in-fn-arg.stderr rename to src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.rs b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs similarity index 100% rename from src/test/ui/structs/struct-like-enum-nonexhaustive.rs rename to src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr similarity index 100% rename from src/test/ui/structs/struct-like-enum-nonexhaustive.stderr rename to src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr diff --git a/src/test/ui/structs/struct-pattern-match-useless.rs b/src/test/ui/pattern/usefulness/struct-pattern-match-useless.rs similarity index 100% rename from src/test/ui/structs/struct-pattern-match-useless.rs rename to src/test/ui/pattern/usefulness/struct-pattern-match-useless.rs diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr similarity index 100% rename from src/test/ui/structs/struct-pattern-match-useless.stderr rename to src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.rs b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.rs similarity index 100% rename from src/test/ui/tuple/tuple-struct-nonexhaustive.rs rename to src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.rs diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr similarity index 100% rename from src/test/ui/tuple/tuple-struct-nonexhaustive.stderr rename to src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr