Skip to content

Update E0303 to new error format #37060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0007.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {},
}
}
8 changes: 6 additions & 2 deletions src/test/compile-fail/E0303.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {},
}
}