diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-28 03:19:46 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-30 06:43:06 +0200 |
| commit | bba2e4c3517a760ca8aaffbf1a8110c2a1417fbc (patch) | |
| tree | ed44857784d849fcd0fc17f7693c85bc2ac7a83f /src | |
| parent | c4bf275eca0099483916b8303b7fb700c879493a (diff) | |
| download | rust-bba2e4c3517a760ca8aaffbf1a8110c2a1417fbc.tar.gz rust-bba2e4c3517a760ca8aaffbf1a8110c2a1417fbc.zip | |
Unconditionally set SignalledError::SawSomeError.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/hair/pattern/check_match.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 47f31fa0a82..767e70e52df 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -152,9 +152,8 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // 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"); |
