Skip to content

Commit e8e5b09

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35331 - trixnz:update-error-130, r=jonathandturner
Update error format for E0130 Fixes rust-lang#35256 as part of rust-lang#35233 r? @jonathandturner
2 parents 56cc1fc + e2cc157 commit e8e5b09

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/librustc_passes/ast_validation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ impl<'a> Visitor for AstValidator<'a> {
183183
E0130,
184184
"patterns aren't allowed in foreign function \
185185
declarations");
186+
err.span_label(span, &format!("pattern not allowed in foreign function"));
186187
if is_recent {
187188
err.span_note(span,
188189
"this is a recent error, see issue #35203 for more details");

src/test/compile-fail/E0130.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
extern {
12-
fn foo((a, b): (u32, u32)); //~ ERROR E0130
12+
fn foo((a, b): (u32, u32));
13+
//~^ ERROR E0130
14+
//~| NOTE pattern not allowed in foreign function
1315
}
1416

1517
fn main() {

src/test/compile-fail/no-patterns-in-args.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
extern {
1212
fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
13-
//~^ NOTE this is a recent error
13+
//~^ NOTE pattern not allowed in foreign function
14+
//~| NOTE this is a recent error
1415
fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
16+
//~^ NOTE pattern not allowed in foreign function
1517
fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations
16-
//~^ NOTE this is a recent error
18+
//~^ NOTE pattern not allowed in foreign function
19+
//~| NOTE this is a recent error
1720
fn g1(arg: u8); // OK
1821
fn g2(_: u8); // OK
1922
// fn g3(u8); // Not yet

0 commit comments

Comments
 (0)