about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/constructor.rs
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-07-26 01:15:04 -0500
committerGitHub <noreply@github.com>2025-07-26 01:15:04 -0500
commit3f7d497c8aba1b415c2b9b6a597eab1faa744416 (patch)
treebeb74b00c992ea03b7d3a6fc2188780cf3522c1b /compiler/rustc_pattern_analysis/src/constructor.rs
parent9c13f4fb201e31f51ebaf8633ece12e660263008 (diff)
parentaf07c08c60fe779c2e73c561403cb5edf4f15e9b (diff)
downloadrust-3f7d497c8aba1b415c2b9b6a597eab1faa744416.tar.gz
rust-3f7d497c8aba1b415c2b9b6a597eab1faa744416.zip
Rollup merge of #144171 - Nadrieril:exhaustive-witnesses, r=davidtwco
pattern_analysis: add option to get a full set of witnesses

This adds an option to the rustc_pattern_analysis machinery to have it report a complete set of patterns when a match is non-exhaustive (by default we only guarantee to report _some_ missing patterns). This is for use in rust-analyzer.

Leaving as draft until I'm sure this is what r-a needs.

r? ghost
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/constructor.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/constructor.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs
index 09685640e50..9a9e0db964c 100644
--- a/compiler/rustc_pattern_analysis/src/constructor.rs
+++ b/compiler/rustc_pattern_analysis/src/constructor.rs
@@ -950,9 +950,7 @@ impl<Cx: PatCx> Constructor<Cx> {
                 }
             }
             Never => write!(f, "!")?,
-            Wildcard | Missing | NonExhaustive | Hidden | PrivateUninhabited => {
-                write!(f, "_ : {:?}", ty)?
-            }
+            Wildcard | Missing | NonExhaustive | Hidden | PrivateUninhabited => write!(f, "_")?,
         }
         Ok(())
     }