// 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);
}
}
.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");