Skip to content

Commit

Permalink
Unrolled build for rust-lang#120742
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#120742 - Nadrieril:use-min_exh_pats, r=compiler-errors

mark `min_exhaustive_patterns` as complete

This is step 1 and 2 of my [proposal](rust-lang#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``
  • Loading branch information
rust-timer authored Feb 23, 2024
2 parents b6a23b8 + 8e83d0c commit c2a9560
Show file tree
Hide file tree
Showing 32 changed files with 198 additions and 249 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ declare_features! (
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
/// Allows exhaustive pattern matching on types that contain uninhabited types in cases that are
/// unambiguously sound.
(incomplete, min_exhaustive_patterns, "1.77.0", Some(119612)),
(unstable, min_exhaustive_patterns, "1.77.0", Some(119612)),
/// A minimal, sound subset of specialization intended to be used by the
/// standard library until the soundness issues with specialization
/// are fixed.
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
#![feature(rustdoc_internals)]
#![feature(allocator_api)]
#![feature(array_windows)]
Expand All @@ -32,7 +34,6 @@
#![feature(core_intrinsics)]
#![feature(const_type_name)]
#![feature(discriminant_kind)]
#![feature(exhaustive_patterns)]
#![feature(coroutines)]
#![feature(generic_nonzero)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
#![feature(rustdoc_internals)]
#![feature(assert_matches)]
#![feature(exhaustive_patterns)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//@ run-pass
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete
#![feature(never_type)]

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/always-inhabited-union-ref.rs:26:11
--> $DIR/always-inhabited-union-ref.rs:25:11
|
LL | match uninhab_ref() {
| ^^^^^^^^^^^^^
Expand All @@ -14,13 +14,13 @@ LL + }
|

error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:30:11
--> $DIR/always-inhabited-union-ref.rs:29:11
|
LL | match uninhab_union() {
| ^^^^^^^^^^^^^^^
|
note: `Foo` defined here
--> $DIR/always-inhabited-union-ref.rs:13:11
--> $DIR/always-inhabited-union-ref.rs:12:11
|
LL | pub union Foo {
| ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/always-inhabited-union-ref.rs:7:46
|
LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #119612 <https://github.com/rust-lang/rust/issues/119612> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/always-inhabited-union-ref.rs:26:11
--> $DIR/always-inhabited-union-ref.rs:25:11
|
LL | match uninhab_ref() {
| ^^^^^^^^^^^^^
Expand All @@ -23,13 +14,13 @@ LL + }
|

error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:30:11
--> $DIR/always-inhabited-union-ref.rs:29:11
|
LL | match uninhab_union() {
| ^^^^^^^^^^^^^^^
|
note: `Foo` defined here
--> $DIR/always-inhabited-union-ref.rs:13:11
--> $DIR/always-inhabited-union-ref.rs:12:11
|
LL | pub union Foo {
| ^^^
Expand All @@ -41,6 +32,6 @@ LL + _ => todo!(),
LL + }
|

error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0004`.
1 change: 0 additions & 1 deletion tests/ui/pattern/usefulness/always-inhabited-union-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete
#![feature(never_type)]
#![allow(dead_code)]
#![allow(unreachable_code)]
Expand Down
Loading

0 comments on commit c2a9560

Please sign in to comment.