diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index fbb523e5d803d..a49f5884562d2 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -302,7 +302,7 @@ //! //! # `Missing` and relevant constructors //! -//! Take the following example: +//! Take the following variation on the previous example: //! //! ```compile_fail,E0004 //! enum Direction { North, South, East, West } @@ -313,7 +313,8 @@ //! } //! ``` //! -//! Remember that we represent the "everything else" cases with [`Constructor::Missing`]. When we +//! As explained in [`crate::constructor`], we represent the "everything else" cases with +//! [`Constructor::Missing`]. This constructor is only covered by wildcards in the column. When we //! specialize with `Missing` in the first column, we have one arm left: //! //! ```ignore(partial code) @@ -332,10 +333,10 @@ //! //! Because `Missing` only matches wildcard rows, specializing with `Missing` is guaranteed to //! result in a subset of the rows obtained from specializing with anything else. This means that -//! any row with a wildcard found useful when specializing with anything else would also be found -//! useful in the `Missing` case. In our example, after specializing with `North` here we will not -//! gain new information regarding the usefulness of arm 2 or of the fake wildcard row used for -//! exhaustiveness. This allows us to skip cases. +//! any row with a wildcard found useful when specializing with any non-`Missing` constructor would +//! also be found useful in the `Missing` case. In our example, after specializing with `North` here +//! we will not gain new information regarding the usefulness of arm 2 or of the fake wildcard row +//! used for exhaustiveness. This allows us to skip cases. //! //! When specializing, if there is a `Missing` case we call the other constructors "irrelevant". //! When there is no `Missing` case there are no irrelevant constructors.