-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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)C-bugCategory: This is a bug.Category: This is a bug.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
(Splitting from https://github.com/rust-lang/rust/pull/59238/files/8477a04a72a6f8e0adb46be91a2628b07648c200#r266976217)
Consider the following (playground):
use std::arch::x86_64::__m128;
#[allow(improper_ctypes)]
extern "C" {
fn e(x: __m128);
}
which produces the following error (correctly):
error: use of SIMD type `__m128` in FFI is highly experimental and may result in invalid code
--> src/lib.rs:5:13
|
5 | fn e(x: __m128);
| ^^^^^^
|
= help: add `#![feature(simd_ffi)]` to the crate attributes to enable
But when we use it on struct (playground):
#[repr(transparent)] pub struct A(__m128);
#[repr(C)] pub struct B(__m128);
it just compiles fine on stable Rust, while we should gate it. We should eventually disallow it through a future incompat lint.
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)C-bugCategory: This is a bug.Category: This is a bug.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.