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

Stabilise exhaustive patterns feature #110105

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove more mentions of the feature name.
  • Loading branch information
cjgillot committed Jun 30, 2023
commit 9f73f16d649a0e9b5fee54f71d0a6782a449f681
8 changes: 3 additions & 5 deletions library/core/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,13 @@ mod prim_bool {}
/// [`Result<String, !>`] which we can unpack like this:
///
/// ```
/// #![feature(exhaustive_patterns)]
/// use std::str::FromStr;
/// let Ok(s) = String::from_str("hello");
/// ```
///
/// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns`
/// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the
/// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain
/// enum variants from generic types like `Result`.
/// Since the [`Err`] variant contains a `!`, it can never occur. This means we can exhaustively
/// match on [`Result<T, !>`] by just taking the [`Ok`] variant. This illustrates another behaviour
/// of `!` - it can be used to "delete" certain enum variants from generic types like `Result`.
///
/// ## Infinite loops
///
Expand Down
8 changes: 3 additions & 5 deletions library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,13 @@ mod prim_bool {}
/// [`Result<String, !>`] which we can unpack like this:
///
/// ```
/// #![feature(exhaustive_patterns)]
/// use std::str::FromStr;
/// let Ok(s) = String::from_str("hello");
/// ```
///
/// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns`
/// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the
/// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain
/// enum variants from generic types like `Result`.
/// Since the [`Err`] variant contains a `!`, it can never occur. This means we can exhaustively
/// match on [`Result<T, !>`] by just taking the [`Ok`] variant. This illustrates another behaviour
/// of `!` - it can be used to "delete" certain enum variants from generic types like `Result`.
///
/// ## Infinite loops
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ 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)]`.

fn cannot_empty_match_on_empty_enum_to_anything(x: IndirectUninhabitedEnum) -> A {
match x {}
}
Expand Down