Skip to content

Commit 26cb6c7

Browse files
authored
Rollup merge of #120742 - Nadrieril:use-min_exh_pats, r=compiler-errors
mark `min_exhaustive_patterns` as complete This is step 1 and 2 of my [proposal](#119612 (comment)) to move `min_exhaustive_patterns` forward. The vast majority of in-tree use cases of `exhaustive_patterns` are covered by `min_exhaustive_patterns`. There are a few cases that still require `exhaustive_patterns` in tests and they're all behind references. r? ``@ghost``
2 parents 52cea08 + 8e83d0c commit 26cb6c7

32 files changed

+198
-249
lines changed

compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ declare_features! (
518518
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
519519
/// Allows exhaustive pattern matching on types that contain uninhabited types in cases that are
520520
/// unambiguously sound.
521-
(incomplete, min_exhaustive_patterns, "1.77.0", Some(119612)),
521+
(unstable, min_exhaustive_patterns, "1.77.0", Some(119612)),
522522
/// A minimal, sound subset of specialization intended to be used by the
523523
/// standard library until the soundness issues with specialization
524524
/// are fixed.

compiler/rustc_middle/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
2525
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2626
#![doc(rust_logo)]
27+
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
28+
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
2729
#![feature(rustdoc_internals)]
2830
#![feature(allocator_api)]
2931
#![feature(array_windows)]
@@ -32,7 +34,6 @@
3234
#![feature(core_intrinsics)]
3335
#![feature(const_type_name)]
3436
#![feature(discriminant_kind)]
35-
#![feature(exhaustive_patterns)]
3637
#![feature(coroutines)]
3738
#![feature(generic_nonzero)]
3839
#![feature(if_let_guard)]

compiler/rustc_target/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1111
#![doc(rust_logo)]
12+
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
13+
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
1214
#![feature(rustdoc_internals)]
1315
#![feature(assert_matches)]
14-
#![feature(exhaustive_patterns)]
1516
#![feature(iter_intersperse)]
1617
#![feature(let_chains)]
1718
#![cfg_attr(bootstrap, feature(min_specialization))]

tests/ui/closures/2229_closure_analysis/run_pass/multivariant.min_exhaustive_patterns.stderr

-11
This file was deleted.

tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//@ run-pass
66
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
77
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
8-
//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete
98
#![feature(never_type)]
109

1110
pub fn main() {

tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0004]: non-exhaustive patterns: type `&!` is non-empty
2-
--> $DIR/always-inhabited-union-ref.rs:26:11
2+
--> $DIR/always-inhabited-union-ref.rs:25:11
33
|
44
LL | match uninhab_ref() {
55
| ^^^^^^^^^^^^^
@@ -14,13 +14,13 @@ LL + }
1414
|
1515

1616
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
17-
--> $DIR/always-inhabited-union-ref.rs:30:11
17+
--> $DIR/always-inhabited-union-ref.rs:29:11
1818
|
1919
LL | match uninhab_union() {
2020
| ^^^^^^^^^^^^^^^
2121
|
2222
note: `Foo` defined here
23-
--> $DIR/always-inhabited-union-ref.rs:13:11
23+
--> $DIR/always-inhabited-union-ref.rs:12:11
2424
|
2525
LL | pub union Foo {
2626
| ^^^
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/always-inhabited-union-ref.rs:7:46
3-
|
4-
LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: see issue #119612 <https://github.com/rust-lang/rust/issues/119612> for more information
8-
= note: `#[warn(incomplete_features)]` on by default
9-
101
error[E0004]: non-exhaustive patterns: type `&!` is non-empty
11-
--> $DIR/always-inhabited-union-ref.rs:26:11
2+
--> $DIR/always-inhabited-union-ref.rs:25:11
123
|
134
LL | match uninhab_ref() {
145
| ^^^^^^^^^^^^^
@@ -23,13 +14,13 @@ LL + }
2314
|
2415

2516
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
26-
--> $DIR/always-inhabited-union-ref.rs:30:11
17+
--> $DIR/always-inhabited-union-ref.rs:29:11
2718
|
2819
LL | match uninhab_union() {
2920
| ^^^^^^^^^^^^^^^
3021
|
3122
note: `Foo` defined here
32-
--> $DIR/always-inhabited-union-ref.rs:13:11
23+
--> $DIR/always-inhabited-union-ref.rs:12:11
3324
|
3425
LL | pub union Foo {
3526
| ^^^
@@ -41,6 +32,6 @@ LL + _ => todo!(),
4132
LL + }
4233
|
4334

44-
error: aborting due to 2 previous errors; 1 warning emitted
35+
error: aborting due to 2 previous errors
4536

4637
For more information about this error, try `rustc --explain E0004`.

tests/ui/pattern/usefulness/always-inhabited-union-ref.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
77
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
8-
//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete
98
#![feature(never_type)]
109
#![allow(dead_code)]
1110
#![allow(unreachable_code)]

0 commit comments

Comments
 (0)