about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/usefulness.rs
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2025-05-10 05:01:09 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2025-05-10 05:01:09 +0000
commita4f765dcada7c37abfc3beda66b7823736b58ea6 (patch)
treeb815913f2d6c42de19b550fd5f5941555789ab08 /compiler/rustc_pattern_analysis/src/usefulness.rs
parent6e5d6473aaa21d6fae3eb7afdacdfaf93391bfc7 (diff)
parent35679bad981e1551138a8b367c0571b0a5928a27 (diff)
downloadrust-a4f765dcada7c37abfc3beda66b7823736b58ea6.tar.gz
rust-a4f765dcada7c37abfc3beda66b7823736b58ea6.zip
Merge from rustc
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 11ebbea07fa..53638f2a57d 100644
--- a/compiler/rustc_pattern_analysis/src/usefulness.rs
+++ b/compiler/rustc_pattern_analysis/src/usefulness.rs
@@ -702,6 +702,7 @@
 //!   - `ui/consts/const_in_pattern`
 //!   - `ui/rfc-2008-non-exhaustive`
 //!   - `ui/half-open-range-patterns`
+//!   - `ui/pattern/deref-patterns`
 //!   - probably many others
 //!
 //! I (Nadrieril) prefer to put new tests in `ui/pattern/usefulness` unless there's a specific
@@ -866,7 +867,8 @@ impl PlaceValidity {
     /// inside `&` and union fields where validity is reset to `MaybeInvalid`.
     fn specialize<Cx: PatCx>(self, ctor: &Constructor<Cx>) -> Self {
         // We preserve validity except when we go inside a reference or a union field.
-        if matches!(ctor, Constructor::Ref | Constructor::UnionField) {
+        if matches!(ctor, Constructor::Ref | Constructor::DerefPattern(_) | Constructor::UnionField)
+        {
             // Validity of `x: &T` does not imply validity of `*x: T`.
             MaybeInvalid
         } else {