Skip to content

Commit 302a423

Browse files
Update E0301 to the new format
1 parent f55ac69 commit 302a423

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/librustc_const_eval/check_match.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,10 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
11751175
_: LoanCause) {
11761176
match kind {
11771177
MutBorrow => {
1178-
span_err!(self.cx.tcx.sess, span, E0301,
1178+
struct_span_err!(self.cx.tcx.sess, span, E0301,
11791179
"cannot mutably borrow in a pattern guard")
1180+
.span_label(span, &format!("borrowed mutably in pattern guard"))
1181+
.emit();
11801182
}
11811183
ImmBorrow | UniqueImmBorrow => {}
11821184
}

src/test/compile-fail/E0301.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fn main() {
1212
match Some(()) {
1313
None => { },
1414
option if option.take().is_none() => {}, //~ ERROR E0301
15+
//~| NOTE borrowed mutably in pattern guard
1516
Some(_) => { }
1617
}
1718
}

0 commit comments

Comments
 (0)