]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/expr_use_visitor.rs
Rollup merge of #87727 - SkiFire13:fix-87718, r=jackh726
[rust.git] / compiler / rustc_typeck / src / expr_use_visitor.rs
index 6c76a8960bbe1a2a509ae6165787ef30c4c65822..1d7852d964c1dd428108c9934c0ffbe40e0886ce 100644 (file)
@@ -267,12 +267,21 @@ pub fn walk_expr(&mut self, expr: &hir::Expr<'_>) {
                                     }
                                 }
                             }
-                            PatKind::Lit(_) => {
-                                // If the PatKind is a Lit then we want
+                            PatKind::Lit(_) | PatKind::Range(..) => {
+                                // If the PatKind is a Lit or a Range then we want
                                 // to borrow discr.
                                 needs_to_be_read = true;
                             }
-                            _ => {}
+                            PatKind::Or(_)
+                            | PatKind::Box(_)
+                            | PatKind::Slice(..)
+                            | PatKind::Ref(..)
+                            | PatKind::Wild => {
+                                // If the PatKind is Or, Box, Slice or Ref, the decision is made later
+                                // as these patterns contains subpatterns
+                                // If the PatKind is Wild, the decision is made based on the other patterns being
+                                // examined
+                            }
                         }
                     }));
                 }