Skip to content

Commit 6925ce1

Browse files
committed
Don't warn about v128 in wasm ABI transition
This has other warnings if necessary and doesn't need extra warnings from this FCW. cc #138762
1 parent c580c49 commit 6925ce1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/rustc_monomorphize/src/mono_checks/abi_check.rs

+6
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ fn wasm_abi_safe<'tcx>(tcx: TyCtxt<'tcx>, arg: &ArgAbi<'tcx, Ty<'tcx>>) -> bool
9999
return true;
100100
}
101101

102+
// If this is a simd argument let other rustc warnings kick in and don't
103+
// provide extra warnings here
104+
if uses_vector_registers(&arg.mode, &arg.layout.backend_repr) {
105+
return true;
106+
}
107+
102108
// This matches `unwrap_trivial_aggregate` in the wasm ABI logic.
103109
if arg.layout.is_aggregate() {
104110
let cx = LayoutCx::new(tcx, TypingEnv::fully_monomorphized());

tests/ui/lint/wasm_c_abi_transition.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ add-core-stubs
44
//@ build-fail
55

6-
#![feature(no_core)]
6+
#![feature(no_core, repr_simd)]
77
#![no_core]
88
#![crate_type = "lib"]
99
#![deny(wasm_c_abi)]
@@ -39,3 +39,11 @@ pub fn call_other_fun(x: MyType) {
3939
unsafe { other_fun(x) } //~ERROR: wasm ABI transition
4040
//~^WARN: previously accepted
4141
}
42+
43+
// Don't warn about simd types
44+
#[repr(simd)]
45+
#[allow(non_camel_case_types)]
46+
pub struct v128([i32; 4]);
47+
#[target_feature(enable = "simd128")]
48+
#[allow(improper_ctypes_definitions)]
49+
pub extern "C" fn my_safe_simd(x: v128) -> v128 { x }

0 commit comments

Comments
 (0)