-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, …
…r=petrochenkov Remove nondeterminism in multiple-definitions test Compare all fields in `DllImport` when sorting to avoid nondeterminism in the error for multiple inconsistent definitions of an extern function. Restore the multiple-definitions test. Resolves #87084.
- Loading branch information
Showing
7 changed files
with
91 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); } | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|