Skip to content

Commit

Permalink
Rollup merge of rust-lang#35331 - trixnz:update-error-130, r=jonathan…
Browse files Browse the repository at this point in the history
…dturner

Update error format for E0130

Fixes rust-lang#35256 as part of rust-lang#35233

r? @jonathandturner
  • Loading branch information
Jonathan Turner committed Aug 10, 2016
2 parents 56cc1fc + e2cc157 commit e8e5b09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/librustc_passes/ast_validation.rs
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
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
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

0 comments on commit e8e5b09

Please sign in to comment.