summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/usefulness.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2025-07-19 11:28:31 +0200
committerNadrieril <nadrieril+git@gmail.com>2025-07-20 18:27:30 +0200
commit2bb00741d463143a10e632bb118d4ed336dbb75f (patch)
tree333eddf6f28aa6b988ff164ed82066f636633b06 /compiler/rustc_pattern_analysis/src/usefulness.rs
parent81af9d45698a19183b8552079cbc7bf893fad1e5 (diff)
downloadrust-2bb00741d463143a10e632bb118d4ed336dbb75f.tar.gz
rust-2bb00741d463143a10e632bb118d4ed336dbb75f.zip
pattern_analysis: add option to get a full set of witnesses
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/usefulness.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs
index b1c646e9884..91377b2f2bd 100644
--- a/compiler/rustc_pattern_analysis/src/usefulness.rs
+++ b/compiler/rustc_pattern_analysis/src/usefulness.rs
@@ -1747,7 +1747,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: PatCx>(
         // `ctor` is *irrelevant* if there's another constructor in `split_ctors` that matches
         // strictly fewer rows. In that case we can sometimes skip it. See the top of the file for
         // details.
-        let ctor_is_relevant = matches!(ctor, Constructor::Missing) || missing_ctors.is_empty();
+        let ctor_is_relevant = matches!(ctor, Constructor::Missing)
+            || missing_ctors.is_empty()
+            || mcx.tycx.exhaustive_witnesses();
         let mut spec_matrix = matrix.specialize_constructor(pcx, &ctor, ctor_is_relevant)?;
         let mut witnesses = ensure_sufficient_stack(|| {
             compute_exhaustiveness_and_usefulness(mcx, &mut spec_matrix)