about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-09-01 10:49:07 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-09-01 10:49:07 -0700
commitf53c2179ba2ae35bd241a28027fb703aec89139b (patch)
treeafcd9f61049afe0e20cfcbe1382a07ef52aad8d3
parentaae2b245e4c3958ca37d6eaa58b89d955d0b66e7 (diff)
downloadrust-f53c2179ba2ae35bd241a28027fb703aec89139b.tar.gz
rust-f53c2179ba2ae35bd241a28027fb703aec89139b.zip
review comments
-rw-r--r--src/librustc_typeck/check/_match.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 63d059bdf2a..7427ae9ce8d 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -117,14 +117,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 &arms[0].body,
                 &mut coercion,
             ) {
-                    tcx.types.err
+                tcx.types.err
             } else {
                 // Only call this if this is not an `if` expr with an expected type and no `else`
                 // clause to avoid duplicated type errors. (#60254)
-                let arm_ty = self.check_expr_with_expectation(&arm.body, expected);
-                all_arms_diverge &= self.diverges.get();
-                arm_ty
+                self.check_expr_with_expectation(&arm.body, expected)
             };
+            all_arms_diverge &= self.diverges.get();
             if source_if {
                 let then_expr = &arms[0].body;
                 match (i, if_no_else) {
@@ -188,6 +187,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     }
 
     /// Handle the fallback arm of a desugared if(-let) like a missing else.
+    ///
+    /// Returns `true` if there was an error forcing the coercion to the `()` type.
     fn if_fallback_coercion(
         &self,
         span: Span,