Skip to content

Commit

Permalink
Rollup merge of rust-lang#35644 - garekkream:update-E0302-new-error-f…
Browse files Browse the repository at this point in the history
…ormat, r=jonathandturner

Update E0302 to the new format

Part of rust-lang#35233.
Fixes rust-lang#35523.

r? @jonathandturner
  • Loading branch information
Jonathan Turner committed Aug 13, 2016
2 parents a7865b6 + 5402d28 commit 4b13676
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,9 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
fn mutate(&mut self, _: NodeId, span: Span, _: cmt, mode: MutateMode) {
match mode {
MutateMode::JustWrite | MutateMode::WriteAndRead => {
span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
.span_label(span, &format!("assignment in pattern guard"))
.emit();
}
MutateMode::Init => {}
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0302.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if { option = None; false } => { }, //~ ERROR E0302
//~| NOTE assignment in pattern guard
Some(_) => { }
}
}

0 comments on commit 4b13676

Please sign in to comment.