diff options
| author | dianne <diannes.gm@gmail.com> | 2025-04-20 23:57:09 -0700 |
|---|---|---|
| committer | dianne <diannes.gm@gmail.com> | 2025-05-06 18:53:55 -0700 |
| commit | fb261a179d2c210785b6e9005201e262dac801b5 (patch) | |
| tree | 17a709e679f327bb95f013ed4c2f5a825637bc1a /compiler/rustc_pattern_analysis/messages.ftl | |
| parent | cf43bba1e5ec87838fca248f36d940f2923576c2 (diff) | |
| download | rust-fb261a179d2c210785b6e9005201e262dac801b5.tar.gz rust-fb261a179d2c210785b6e9005201e262dac801b5.zip | |
error early when mixing deref patterns with normal constructors
Without adding proper support for mixed exhaustiveness, mixing deref patterns with normal constructors would either violate `ConstructorSet::split`'s invariant 4 or 7. We'd either be ignoring rows with normal constructors or we'd have problems in unspecialization from non-disjoint constructors. Checking mixed exhaustivenss similarly to how unions are currently checked should work, but the diagnostics for unions are confusing. Since mixing deref patterns with normal constructors is pretty niche (currently it only makes sense for `Cow`), emitting an error lets us avoid committing to supporting mixed exhaustiveness without a good answer for the diagnostics.
Diffstat (limited to 'compiler/rustc_pattern_analysis/messages.ftl')
| -rw-r--r-- | compiler/rustc_pattern_analysis/messages.ftl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_pattern_analysis/messages.ftl b/compiler/rustc_pattern_analysis/messages.ftl index 41a1d958f10..d3a3107f8e8 100644 --- a/compiler/rustc_pattern_analysis/messages.ftl +++ b/compiler/rustc_pattern_analysis/messages.ftl @@ -6,6 +6,10 @@ pattern_analysis_excluside_range_missing_max = exclusive range missing `{$max}` .label = this range doesn't match `{$max}` because `..` is an exclusive range .suggestion = use an inclusive range instead +pattern_analysis_mixed_deref_pattern_constructors = mix of deref patterns and normal constructors + .deref_pattern_label = matches on the result of dereferencing `{$smart_pointer_ty}` + .normal_constructor_label = matches directly on `{$smart_pointer_ty}` + pattern_analysis_non_exhaustive_omitted_pattern = some variants are not matched explicitly .help = ensure that all variants are matched explicitly by adding the suggested match arms .note = the matched value is of type `{$scrut_ty}` and the `non_exhaustive_omitted_patterns` attribute was found |
