Skip to content

Commit 843a3e9

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 6556ffd + 4c672e0 commit 843a3e9

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/librustc_passes/ast_validation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ impl<'a> Visitor for AstValidator<'a> {
169169
self.check_decl_no_pat(decl, |span, is_recent| {
170170
let mut err = struct_span_err!(self.session, span, E0130,
171171
"patterns aren't allowed in foreign function declarations");
172+
err.span_label(span, &format!("pattern not allowed in foreign function"));
173+
172174
if is_recent {
173175
err.span_note(span, "this is a recent error, see \
174176
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)