From 5402d28fe77bbaee77d0087590ecc4c35ec8f1ee Mon Sep 17 00:00:00 2001 From: Krzysztof Garczynski Date: Sat, 13 Aug 2016 02:33:52 +0200 Subject: [PATCH] Update E0302 to the new format --- src/librustc_const_eval/check_match.rs | 4 +++- src/test/compile-fail/E0302.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 3e88dec8cb27a..88497ab66a804 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -1185,7 +1185,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 => {} } diff --git a/src/test/compile-fail/E0302.rs b/src/test/compile-fail/E0302.rs index 6a5ad40b10907..5ad74fd6cab05 100644 --- a/src/test/compile-fail/E0302.rs +++ b/src/test/compile-fail/E0302.rs @@ -12,6 +12,7 @@ fn main() { match Some(()) { None => { }, option if { option = None; false } => { }, //~ ERROR E0302 + //~| NOTE assignment in pattern guard Some(_) => { } } }