Skip to content

Commit a4c628c

Browse files
Significant test improvements
1 parent 784d47b commit a4c628c

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

tests/run-make/issue-44282-questionmark-mangle/main.rs

-11
This file was deleted.

tests/run-make/issue-44282-questionmark-mangle/rmake.rs

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// This test ensures functions with an exported name beginning with a question mark
2+
// successfully compile and link.
3+
//
4+
// Regression test for <https://github.com/rust-lang/rust/issues/44282>
5+
6+
//@ build-pass
7+
//@ only-windows
8+
//@ only-x86
9+
// Reason: This test regards a linker issue which only applies to Windows.
10+
// Specifically, it only occurs due to Windows x86 name decoration, combined with
11+
// a mismatch between LLVM's decoration logic and Rust's (for `lib.def` generation)
12+
13+
#![crate_type = "cdylib"]
14+
15+
#[no_mangle]
16+
pub extern "C" fn decorated(a: i32, b: i32) -> i32 {
17+
1
18+
}
19+
20+
// This isn't just `?undecorated` because MSVC's linker fails if the decorated
21+
// symbol is not valid.
22+
#[export_name = "?undecorated@@YAXXZ"]
23+
pub extern "C" fn undecorated(a: i32, b: i32) -> i32 {
24+
2
25+
}

0 commit comments

Comments
 (0)