-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-SIMDArea: SIMD (Single Instruction Multiple Data)Area: SIMD (Single Instruction Multiple Data)A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-simd_ffi`#![feature(simd_ffi)]``#![feature(simd_ffi)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Currently, repr(C, simd)
warns about "incompatible representation hints", but leaving off the repr(C)
triggers the FFI lint when the SIMD type is used in FFI.
Note that #[repr(C)] #[repr(simd)]
does not warn only due to #47094. Most uses of SIMD in FFI this in the Rust source tree use two separate repr attributes, which is why they didn't trigger this warning so far.
There's two ways to resolve this:
- Require
repr(C, simd)
for SIMD types used in FFI. - Say
repr(simd)
is sufficient for FFI (in principle -- there are other concerns that keep SIMD-FFI feature gated at the moment) and keep the warning aboutrepr(C, simd)
. It could optionally restricted to some simd types that are known to correspond to C types on the platform in question (e.g., permitf32x4
but notf32x3
).
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-SIMDArea: SIMD (Single Instruction Multiple Data)Area: SIMD (Single Instruction Multiple Data)A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-simd_ffi`#![feature(simd_ffi)]``#![feature(simd_ffi)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.