Skip to content
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

Update error format for E0130 #35331

Merged
merged 2 commits into from
Aug 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
1 change: 1 addition & 0 deletions src/librustc_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ impl<'a> Visitor for AstValidator<'a> {
E0130,
"patterns aren't allowed in foreign function \
declarations");
err.span_label(span, &format!("pattern not allowed in foreign function"));
if is_recent {
err.span_note(span,
"this is a recent error, see issue #35203 for more details");
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0130.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
// except according to those terms.

extern {
fn foo((a, b): (u32, u32)); //~ ERROR E0130
fn foo((a, b): (u32, u32));
//~^ ERROR E0130
//~| NOTE pattern not allowed in foreign function
}

fn main() {
Expand Down
7 changes: 5 additions & 2 deletions src/test/compile-fail/no-patterns-in-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

extern {
fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
//~^ NOTE this is a recent error
//~^ NOTE pattern not allowed in foreign function
//~| NOTE this is a recent error
fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
//~^ NOTE pattern not allowed in foreign function
fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations
//~^ NOTE this is a recent error
//~^ NOTE pattern not allowed in foreign function
//~| NOTE this is a recent error
fn g1(arg: u8); // OK
fn g2(_: u8); // OK
// fn g3(u8); // Not yet
Expand Down