File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
// run-pass
2
2
#![ allow( dead_code) ]
3
+ #![ warn( clashing_extern_decl) ]
3
4
// pretty-expanded FIXME #23616
4
5
5
6
extern {
6
7
#[ link_name = "malloc" ]
7
8
fn malloc1 ( len : i32 ) -> * const u8 ;
8
9
#[ link_name = "malloc" ]
10
+ //~^ WARN `malloc2` redeclares `malloc` with a different signature
9
11
fn malloc2 ( len : i32 , foo : i32 ) -> * const u8 ;
10
12
}
11
13
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments