]> git.lizzy.rs Git - rust.git/commitdiff
Unconditionally set SignalledError::SawSomeError.
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 28 Jul 2019 01:19:46 +0000 (03:19 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Tue, 30 Jul 2019 04:43:06 +0000 (06:43 +0200)
src/librustc_mir/hair/pattern/check_match.rs

index 47f31fa0a82b1e20f6b3bac0ea04544021d62e51..767e70e52df21d9c8269bb29c99e427fdc68db4e 100644 (file)
@@ -152,9 +152,8 @@ fn check_match(
             // Second, if there is a guard on each arm, make sure it isn't
             // assigning or borrowing anything mutably.
             if let Some(ref guard) = arm.guard {
-                if self.tcx.features().bind_by_move_pattern_guards {
-                    self.signalled_error = SignalledError::SawSomeError;
-                } else {
+                self.signalled_error = SignalledError::SawSomeError;
+                if !self.tcx.features().bind_by_move_pattern_guards {
                     check_for_mutation_in_guard(self, &guard);
                 }
             }
@@ -584,9 +583,8 @@ fn check_legality_of_move_bindings(
                 .span_label(p.span, "binds an already bound by-move value by moving it")
                 .emit();
         } else if has_guard {
-            if cx.tcx.features().bind_by_move_pattern_guards {
-                cx.signalled_error = SignalledError::SawSomeError;
-            } else {
+            cx.signalled_error = SignalledError::SawSomeError;
+            if !cx.tcx.features().bind_by_move_pattern_guards {
                 let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
                                             "cannot bind by-move into a pattern guard");
                 err.span_label(p.span, "moves value into pattern guard");