Skip to content

Commit 0108116

Browse files
committed
Update rust-lang#5791 test case.
1 parent 902a2ef commit 0108116

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/test/ui/issues/issue-5791.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// run-pass
22
#![allow(dead_code)]
3+
#![warn(clashing_extern_decl)]
34
// pretty-expanded FIXME #23616
45

56
extern {
67
#[link_name = "malloc"]
78
fn malloc1(len: i32) -> *const u8;
89
#[link_name = "malloc"]
10+
//~^ WARN `malloc2` redeclares `malloc` with a different signature
911
fn malloc2(len: i32, foo: i32) -> *const u8;
1012
}
1113

src/test/ui/issues/issue-5791.stderr

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: `malloc2` redeclares `malloc` with a different signature
2+
--> $DIR/issue-5791.rs:9:5
3+
|
4+
LL | / #[link_name = "malloc"]
5+
LL | | fn malloc1(len: i32) -> *const u8;
6+
| |______________________________________- `malloc` previously declared here
7+
LL | / #[link_name = "malloc"]
8+
LL | |
9+
LL | | fn malloc2(len: i32, foo: i32) -> *const u8;
10+
| |________________________________________________^ this signature doesn't match the previous declaration
11+
|
12+
note: the lint level is defined here
13+
--> $DIR/issue-5791.rs:3:9
14+
|
15+
LL | #![warn(clashing_extern_decl)]
16+
| ^^^^^^^^^^^^^^^^^^^^
17+
= note: expected `unsafe extern "C" fn(i32) -> *const u8`
18+
found `unsafe extern "C" fn(i32, i32) -> *const u8`
19+

0 commit comments

Comments
 (0)