|
1 | | -use rustc_abi::{BackendRepr, ExternAbi, Float, Primitive}; |
| 1 | +use rustc_abi::{BackendRepr, Float, Primitive}; |
2 | 2 |
|
3 | 3 | use crate::abi::call::{ArgAbi, FnAbi, Reg}; |
4 | 4 | use crate::spec::HasTargetSpec; |
5 | 5 |
|
6 | 6 | // Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing |
7 | 7 |
|
8 | | -pub(crate) fn compute_abi_info<Ty>( |
9 | | - cx: &impl HasTargetSpec, |
10 | | - fn_abi: &mut FnAbi<'_, Ty>, |
11 | | - abi: ExternAbi, |
12 | | -) { |
| 8 | +pub(crate) fn compute_abi_info<Ty>(_cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { |
13 | 9 | let fixup = |a: &mut ArgAbi<'_, Ty>| { |
14 | 10 | match a.layout.backend_repr { |
15 | 11 | BackendRepr::Uninhabited | BackendRepr::Memory { sized: false } => {} |
@@ -48,16 +44,14 @@ pub(crate) fn compute_abi_info<Ty>( |
48 | 44 | // Windows ABIs do not talk about ZST since such types do not exist in MSVC. |
49 | 45 | // In that sense we can do whatever we want here, and maybe we should throw an error |
50 | 46 | // (but of course that would be a massive breaking change now). |
51 | | - // We try to match clang and gcc, so we make windows-gnu and the native |
52 | | - // Windows ABIs (i.e., everything except for `extern "C"`) pass ZST via |
53 | | - // pointer indirection. windows-msvc `extern "C"` still skips ZST. |
54 | | - if (cx.target_spec().os == "windows" && cx.target_spec().env == "gnu") |
55 | | - || !matches!(abi, ExternAbi::C { .. }) |
56 | | - { |
57 | | - arg.make_indirect_from_ignore(); |
58 | | - } |
| 47 | + // We try to match clang and gcc (which allow ZST is their windows-gnu targets), so we |
| 48 | + // pass ZST via pointer indirection. |
| 49 | + arg.make_indirect_from_ignore(); |
59 | 50 | continue; |
60 | 51 | } |
61 | 52 | fixup(arg); |
62 | 53 | } |
| 54 | + // FIXME: We should likely also do something about ZST return types, similar to above. |
| 55 | + // However, that's non-trivial due to `()`. |
| 56 | + // See <https://github.com/rust-lang/unsafe-code-guidelines/issues/552>. |
63 | 57 | } |
0 commit comments