Skip to content

Commit 5940fa4

Browse files
committed
rewrite extern-fn-with-packed-struct to rmake
1 parent ec229d4 commit 5940fa4

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ run-make/extern-flag-disambiguates/Makefile
3030
run-make/extern-fn-generic/Makefile
3131
run-make/extern-fn-mangle/Makefile
3232
run-make/extern-fn-reachable/Makefile
33-
run-make/extern-fn-with-packed-struct/Makefile
3433
run-make/extern-fn-with-union/Makefile
3534
run-make/extern-multiple-copies/Makefile
3635
run-make/extern-multiple-copies2/Makefile

Diff for: tests/run-make/extern-fn-with-packed-struct/Makefile

-6
This file was deleted.

Diff for: tests/run-make/extern-fn-with-packed-struct/rmake.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Packed structs, in C, occupy less bytes in memory, but are more
2+
// vulnerable to alignment errors. Passing them around in a Rust-C foreign
3+
// function interface (FFI) would cause unexpected behavior, until this was
4+
// fixed in #16584. This test checks that a Rust program with a C library
5+
// compiles and executes successfully, even with usage of a packed struct.
6+
// See https://github.com/rust-lang/rust/issues/16574
7+
8+
//@ ignore-cross-compile
9+
// Reason: the compiled binary is executed
10+
11+
use run_make_support::{build_native_static_lib, run, rustc};
12+
13+
fn main() {
14+
build_native_static_lib("test");
15+
rustc().input("test.rs").run();
16+
run("test");
17+
}

0 commit comments

Comments
 (0)