]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #35643 - garekkream:update-E0301-new-error-format, r=jonathandturner
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)
committerGitHub <noreply@github.com>
Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)
Update E0301 to the new format

Part of #35233.
Fixes #35522.

r? @jonathandturner

src/librustc_const_eval/check_match.rs
src/test/compile-fail/E0301.rs

index 3e88dec8cb27a0c31e8aec233937be99ead96c62..0e56f351c77c3d1d3e99763051ec7761db50388d 100644 (file)
@@ -1175,8 +1175,10 @@ fn borrow(&mut self,
               _: 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 => {}
         }
index 06e98289b0d57ab20c9b9aa481b16713fd00479d..b7872509f5408cdf929df0fa61d3532e211405dd 100644 (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(_) => { }
     }
 }