rewrite extern-fn-with-packed-struct to rmake

This commit is contained in:
Oneirical 2024-07-08 14:57:07 -04:00
parent bde91785dc
commit f7d67d6b68
3 changed files with 17 additions and 7 deletions

View File

@ -27,7 +27,6 @@ run-make/extern-flag-disambiguates/Makefile
run-make/extern-fn-generic/Makefile run-make/extern-fn-generic/Makefile
run-make/extern-fn-mangle/Makefile run-make/extern-fn-mangle/Makefile
run-make/extern-fn-reachable/Makefile run-make/extern-fn-reachable/Makefile
run-make/extern-fn-with-packed-struct/Makefile
run-make/extern-fn-with-union/Makefile run-make/extern-fn-with-union/Makefile
run-make/extern-multiple-copies/Makefile run-make/extern-multiple-copies/Makefile
run-make/extern-multiple-copies2/Makefile run-make/extern-multiple-copies2/Makefile

View File

@ -1,6 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all: $(call NATIVE_STATICLIB,test)
$(RUSTC) test.rs
$(call RUN,test) || exit 1

View File

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