about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKrzysztof Garczynski <krzysztof.garczynski@gmail.com>2016-08-13 01:33:42 +0200
committerKrzysztof Garczynski <krzysztof.garczynski@gmail.com>2016-08-13 01:33:42 +0200
commit302a42304760ca5e52051d7c23d5ecd4a6758814 (patch)
treee9060c2af41c138a169c282e2017c21949b71333
parentf55ac6944a88d4da62b30a16cc95893ca050c328 (diff)
downloadrust-302a42304760ca5e52051d7c23d5ecd4a6758814.tar.gz
rust-302a42304760ca5e52051d7c23d5ecd4a6758814.zip
Update E0301 to the new format
-rw-r--r--src/librustc_const_eval/check_match.rs4
-rw-r--r--src/test/compile-fail/E0301.rs1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index 3e88dec8cb2..0e56f351c77 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -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 => {}
         }
diff --git a/src/test/compile-fail/E0301.rs b/src/test/compile-fail/E0301.rs
index 06e98289b0d..b7872509f54 100644
--- a/src/test/compile-fail/E0301.rs
+++ b/src/test/compile-fail/E0301.rs
@@ -12,6 +12,7 @@ fn main() {
     match Some(()) {
         None => { },
         option if option.take().is_none() => {}, //~ ERROR E0301
+        //~| NOTE borrowed mutably in pattern guard
         Some(_) => { }
     }
 }