Rollup merge of #139157 - mejrs:never, r=Noratrieb
Remove mention of `exhaustive_patterns` from `never` docs
The example shows an exhaustive match:
```rust
#![feature(exhaustive_patterns)]
use std::str::FromStr;
let Ok(s) = String::from_str("hello");
```
But https://github.com/rust-lang/rust/issues/119612 moved this functionality to `#![feature(min_exhaustive_patterns)` and then stabilized it.
This commit is contained in:
commit
6cf2d185ea
1 changed files with 3 additions and 5 deletions
|
|
@ -127,15 +127,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 behavior 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 behavior
|
||||
/// of `!` - it can be used to "delete" certain enum variants from generic types like `Result`.
|
||||
///
|
||||
/// ## Infinite loops
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue