about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-03-01 21:43:39 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-04-03 15:59:21 +0000
commit03fbb3db1e3dd767caebe176a368e0e52aeb68cb (patch)
tree953c0ab353a58c46e9b85ac72354d0b18801356e
parente73aeeaeeee456b58f3d45041d4169318c2b7130 (diff)
downloadrust-03fbb3db1e3dd767caebe176a368e0e52aeb68cb.tar.gz
rust-03fbb3db1e3dd767caebe176a368e0e52aeb68cb.zip
Expand parameters.
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/check_match.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index 534d236030b..de63e07b7d5 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -144,8 +144,8 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for MatchVisitor<'a, '_, 'tcx> {
             ExprKind::Let { box ref pat, expr } => {
                 self.check_let(pat, expr, self.let_source, ex.span);
             }
-            ExprKind::LogicalOp { op: LogicalOp::And, .. } => {
-                self.check_let_chain(ex, self.let_source);
+            ExprKind::LogicalOp { op: LogicalOp::And, lhs, rhs } => {
+                self.check_let_chain(self.let_source, ex.span, lhs, rhs);
             }
             _ => {}
         };
@@ -296,13 +296,17 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
     }
 
     #[instrument(level = "trace", skip(self))]
-    fn check_let_chain(&mut self, top_expr: &Expr<'tcx>, let_source: LetSource) {
+    fn check_let_chain(
+        &mut self,
+        let_source: LetSource,
+        top_expr_span: Span,
+        mut lhs: ExprId,
+        rhs: ExprId,
+    ) {
         if let LetSource::None = let_source {
             return;
         }
 
-        let ExprKind::LogicalOp { op: LogicalOp::And, mut lhs, rhs } = top_expr.kind else { bug!() };
-
         // Lint level enclosing the next `lhs`.
         let mut cur_lint_level = self.lint_level;
 
@@ -367,7 +371,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
                 self.lint_level,
                 let_source,
                 chain_refutabilities.len(),
-                top_expr.span,
+                top_expr_span,
             );
             return;
         }