Rollup merge of #35644 - garekkream:update-E0302-new-error-format, r=jonathandturner

Update E0302 to the new format

Part of #35233.
Fixes #35523.

r? @jonathandturner
This commit is contained in:
Eduard-Mihai Burtescu 2016-08-14 20:29:52 +03:00 committed by GitHub
commit 50aa568709
2 changed files with 4 additions and 1 deletions

View File

@ -1187,7 +1187,9 @@ fn decl_without_init(&mut self, _: NodeId, _: Span) {}
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 => {}
}

View File

@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if { option = None; false } => { }, //~ ERROR E0302
//~| NOTE assignment in pattern guard
Some(_) => { }
}
}