diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-10-11 17:51:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-11 17:51:26 +0200 |
| commit | ac94bde8032df16023e3cfe30205a9cc3e15b602 (patch) | |
| tree | 96e04f8b3184a47000dac11419a66108b3a68dd8 /src | |
| parent | 0ff115c507524c9c3b50a84365f1a5e4c115eedd (diff) | |
| parent | 9d364267d665aa684c11fc525e90aa0b6c16eaf5 (diff) | |
Rollup merge of #37060 - jfirebaugh:E0303, r=jonathandturner
Update E0303 to new error format Fixes #35790 r? @jonathandturner
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_const_eval/check_match.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/E0007.rs | 1 | ||||
| -rw-r--r-- | src/test/compile-fail/E0303.rs | 8 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 2bd4a4d3029..9281d8aa44a 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -1238,8 +1238,10 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> { match pat.node { PatKind::Binding(.., ref subpat) => { if !self.bindings_allowed { - span_err!(self.cx.tcx.sess, pat.span, E0303, - "pattern bindings are not allowed after an `@`"); + struct_span_err!(self.cx.tcx.sess, pat.span, E0303, + "pattern bindings are not allowed after an `@`") + .span_label(pat.span, &format!("not allowed after `@`")) + .emit(); } if subpat.is_some() { diff --git a/src/test/compile-fail/E0007.rs b/src/test/compile-fail/E0007.rs index 4be115b8afd..b72b5e3b280 100644 --- a/src/test/compile-fail/E0007.rs +++ b/src/test/compile-fail/E0007.rs @@ -15,6 +15,7 @@ fn main() { //~^ ERROR E0007 //~| NOTE binds an already bound by-move value by moving it //~| ERROR E0303 + //~| NOTE not allowed after `@` None => {}, } } diff --git a/src/test/compile-fail/E0303.rs b/src/test/compile-fail/E0303.rs index 67947fd087c..e631fe2a8a7 100644 --- a/src/test/compile-fail/E0303.rs +++ b/src/test/compile-fail/E0303.rs @@ -10,8 +10,12 @@ fn main() { match Some("hi".to_string()) { - ref op_string_ref @ Some(s) => {}, //~ ERROR E0303 - //~^ ERROR E0009 + ref op_string_ref @ Some(s) => {}, + //~^ ERROR pattern bindings are not allowed after an `@` [E0303] + //~| NOTE not allowed after `@` + //~| ERROR E0009 + //~| NOTE by-move pattern here + //~| NOTE both by-ref and by-move used None => {}, } } |
