Skip to content

Commit 9d36426

Browse files
committed
Update E0303 to new error format
1 parent 9d4d0da commit 9d36426

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/librustc_const_eval/check_match.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,10 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
12381238
match pat.node {
12391239
PatKind::Binding(.., ref subpat) => {
12401240
if !self.bindings_allowed {
1241-
span_err!(self.cx.tcx.sess, pat.span, E0303,
1242-
"pattern bindings are not allowed after an `@`");
1241+
struct_span_err!(self.cx.tcx.sess, pat.span, E0303,
1242+
"pattern bindings are not allowed after an `@`")
1243+
.span_label(pat.span, &format!("not allowed after `@`"))
1244+
.emit();
12431245
}
12441246

12451247
if subpat.is_some() {

src/test/compile-fail/E0007.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
//~^ ERROR E0007
1616
//~| NOTE binds an already bound by-move value by moving it
1717
//~| ERROR E0303
18+
//~| NOTE not allowed after `@`
1819
None => {},
1920
}
2021
}

src/test/compile-fail/E0303.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
fn main() {
1212
match Some("hi".to_string()) {
13-
ref op_string_ref @ Some(s) => {}, //~ ERROR E0303
14-
//~^ ERROR E0009
13+
ref op_string_ref @ Some(s) => {},
14+
//~^ ERROR pattern bindings are not allowed after an `@` [E0303]
15+
//~| NOTE not allowed after `@`
16+
//~| ERROR E0009
17+
//~| NOTE by-move pattern here
18+
//~| NOTE both by-ref and by-move used
1519
None => {},
1620
}
1721
}

0 commit comments

Comments
 (0)