Rollup merge of #35643 - garekkream:update-E0301-new-error-format, r=jonathandturner

Update E0301 to the new format

Part of #35233.
Fixes #35522.

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

View File

@ -1175,8 +1175,10 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
_: LoanCause) {
match kind {
MutBorrow => {
span_err!(self.cx.tcx.sess, span, E0301,
struct_span_err!(self.cx.tcx.sess, span, E0301,
"cannot mutably borrow in a pattern guard")
.span_label(span, &format!("borrowed mutably in pattern guard"))
.emit();
}
ImmBorrow | UniqueImmBorrow => {}
}

View File

@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if option.take().is_none() => {}, //~ ERROR E0301
//~| NOTE borrowed mutably in pattern guard
Some(_) => { }
}
}