Consider all fields when comparing DllImports, to remove nondetermininsm in multiple-definitions test

This commit is contained in:
Richard Cobbe 2021-07-12 12:46:27 -07:00
parent b5a2ccee81
commit ce59f1aac5
7 changed files with 91 additions and 75 deletions

View file

@ -0,0 +1,19 @@
// only-i686-pc-windows-msvc
// compile-flags: --crate-type lib --emit link
#![allow(clashing_extern_declarations)]
#![feature(raw_dylib)]
//~^ WARN the feature `raw_dylib` is incomplete
#[link(name = "foo", kind = "raw-dylib")]
extern "C" {
fn f(x: i32);
}
pub fn lib_main() {
#[link(name = "foo", kind = "raw-dylib")]
extern "stdcall" {
fn f(x: i32);
//~^ ERROR multiple declarations of external function `f` from library `foo.dll` have different calling conventions
}
unsafe { f(42); }
}

View file

@ -0,0 +1,17 @@
warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/multiple-declarations.rs:4:12
|
LL | #![feature(raw_dylib)]
| ^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions
--> $DIR/multiple-declarations.rs:14:9
|
LL | fn f(x: i32);
| ^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted