diff options
| author | dianne <diannes.gm@gmail.com> | 2025-07-04 21:53:03 -0700 |
|---|---|---|
| committer | dianne <diannes.gm@gmail.com> | 2025-07-04 23:47:31 -0700 |
| commit | bb643159786c789c0b64f819d36a0979c63f9791 (patch) | |
| tree | 5425926c3529f74b57a549e749ca345e68eef482 /compiler/rustc_pattern_analysis/src/usefulness.rs | |
| parent | 50061f3b11f51d7a6e3acd8ce793a1f17f99b597 (diff) | |
| download | rust-bb643159786c789c0b64f819d36a0979c63f9791.tar.gz rust-bb643159786c789c0b64f819d36a0979c63f9791.zip | |
only check for mixed deref/normal constructors when needed
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 4 |
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 fb94b4afebb..b1c646e9884 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -1837,7 +1837,9 @@ pub fn compute_match_usefulness<'p, Cx: PatCx>( complexity_limit: usize, ) -> Result<UsefulnessReport<'p, Cx>, Cx::Error> { // The analysis doesn't support deref patterns mixed with normal constructors; error if present. - checks::detect_mixed_deref_pat_ctors(tycx, arms)?; + if tycx.match_may_contain_deref_pats() { + checks::detect_mixed_deref_pat_ctors(tycx, arms)?; + } let mut cx = UsefulnessCtxt { tycx, |
