diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-02-07 04:00:02 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-02-07 23:25:11 +0100 |
| commit | 9dca6be7b83f4816f67ebaa11008348ce022eb60 (patch) | |
| tree | b7dd7a7386d92843821928cb4164cdb9d99d8921 /compiler/rustc_pattern_analysis/src/usefulness.rs | |
| parent | 970f46c60de420205044c53092d6cff8200354d5 (diff) | |
| download | rust-9dca6be7b83f4816f67ebaa11008348ce022eb60.tar.gz rust-9dca6be7b83f4816f67ebaa11008348ce022eb60.zip | |
Prefer "0..MAX not covered" to "_ not covered"
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 576005b2c7f..80a807b4f27 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -1520,11 +1520,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>( split_ctors.push(Constructor::Missing); } - // Decide what constructors to report. - let is_integers = matches!(ctors_for_ty, ConstructorSet::Integers { .. }); - let always_report_all = place.is_scrutinee && !is_integers; - // Whether we should report "Enum::A and Enum::C are missing" or "_ is missing". - let report_individual_missing_ctors = always_report_all || !all_missing; + // Whether we should report "Enum::A and Enum::C are missing" or "_ is missing". At the top + // level we prefer to list all constructors. + let report_individual_missing_ctors = place.is_scrutinee || !all_missing; // Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() => // split_ctors.contains(Missing)`. The converse usually holds except when // `!place_validity.is_known_valid()`. |
