-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a run-make test that checks our core::ffi::c_*
types against Clang
#133058
Comments
One tricky thing is that this would need to |
Remark: I don't think we would want to |
Yeah, I realized that limitation after writing this. Just copying |
Kind of? There's rust/tests/run-make/compiler-builtins/rmake.rs Lines 30 to 58 in 76fd471
-Z build-std=core which makes the test slow. The problem is I'm not sure we can trivially share the cache for that if the tests have different requirements.
|
I think we could totally skip
And wind up with a standalone file that works with Fixing up |
@rustbot claim |
It would be good to have a test that our C interop types are always compatible with C (
c_char
,c_long
,c_longlong
all vary to some extent). This will more or less be what @taiki-e did at #129945, just rolled into a run-make test rather than a shell script.The test will basically need to do the following:
Loop through each target string in the output of
rustc --print target-list
Map the rust target to a LLVM target if they aren't the same
Loop through a list of each
c_*
type available incore::ffi
Query
clang -E -dM -x c /dev/null -target LLVM_TARGET
to get a list of builtin definitions. Of note will be something like the following (comments added by me)Use the above to construct a simple Rust program that can verify the sizes and (when applicable) signedness line up at compile time. Probably do an assignment that will catch mismatched types plus a const assert for anything that doesn't have literals.
Run
rustc -Z no-codegen
and check success/failure against a list of xfail targets.run_make_support
hasclang
available, example usage: https://github.com/rust-lang/rust/blob/e84902d35a4d3039c794e139eb12fba3624c5ff1/tests/run-make/cross-lang-lto-clang/rmake.rs. There is probably some way we could check this on MSVC targets too.The text was updated successfully, but these errors were encountered: