Skip to content

Commit bba2e4c

Browse files
committed
Unconditionally set SignalledError::SawSomeError.
1 parent c4bf275 commit bba2e4c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
152152
// Second, if there is a guard on each arm, make sure it isn't
153153
// assigning or borrowing anything mutably.
154154
if let Some(ref guard) = arm.guard {
155-
if self.tcx.features().bind_by_move_pattern_guards {
156-
self.signalled_error = SignalledError::SawSomeError;
157-
} else {
155+
self.signalled_error = SignalledError::SawSomeError;
156+
if !self.tcx.features().bind_by_move_pattern_guards {
158157
check_for_mutation_in_guard(self, &guard);
159158
}
160159
}
@@ -584,9 +583,8 @@ fn check_legality_of_move_bindings(
584583
.span_label(p.span, "binds an already bound by-move value by moving it")
585584
.emit();
586585
} else if has_guard {
587-
if cx.tcx.features().bind_by_move_pattern_guards {
588-
cx.signalled_error = SignalledError::SawSomeError;
589-
} else {
586+
cx.signalled_error = SignalledError::SawSomeError;
587+
if !cx.tcx.features().bind_by_move_pattern_guards {
590588
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
591589
"cannot bind by-move into a pattern guard");
592590
err.span_label(p.span, "moves value into pattern guard");

0 commit comments

Comments
 (0)