Rollup merge of #35331 - trixnz:update-error-130, r=jonathandturner

Update error format for E0130

Fixes #35256 as part of #35233

r? @jonathandturner
This commit is contained in:
Jonathan Turner 2016-08-11 06:33:57 -07:00 committed by GitHub
commit 260a379ba5
3 changed files with 9 additions and 3 deletions

View File

@ -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");

View File

@ -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() {

View File

@ -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