diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2025-07-19 21:18:14 +0200 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2025-07-20 18:27:30 +0200 |
| commit | 9b01de20e10376d379ae32baa6a315d8e30cb351 (patch) | |
| tree | 146d8535eec3612d51f0318528d248dd0847f66f /compiler/rustc_pattern_analysis/src/usefulness.rs | |
| parent | 2bb00741d463143a10e632bb118d4ed336dbb75f (diff) | |
| download | rust-9b01de20e10376d379ae32baa6a315d8e30cb351.tar.gz rust-9b01de20e10376d379ae32baa6a315d8e30cb351.zip | |
List all the variants of non-exhaustive enums in exhaustive mode
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 91377b2f2bd..19446a1efe9 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -994,7 +994,8 @@ impl<Cx: PatCx> PlaceInfo<Cx> { if !missing_ctors.is_empty() && !report_individual_missing_ctors { // Report `_` as missing. missing_ctors = vec![Constructor::Wildcard]; - } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) { + } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) && !cx.exhaustive_witnesses() + { // We need to report a `_` anyway, so listing other constructors would be redundant. // `NonExhaustive` is displayed as `_` just like `Wildcard`, but it will be picked // up by diagnostics to add a note about why `_` is required here. |
