Skip to content

Commit f9ec763

Browse files
committed
lint: scalable vectors are ffi-safe
Scalable vectors can be passed by register over the FFI boundary to C code, so they shouldn't be linted by `improper_ctypes`.
1 parent 95530d8 commit f9ec763

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_lint/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11921192
};
11931193
}
11941194
}
1195+
// Scalable vectors are passed to C in their vector registers.
1196+
if def.repr().scalable() {
1197+
return FfiSafe;
1198+
}
11951199
if def.is_phantom_data() {
11961200
return FfiPhantom(ty);
11971201
}

0 commit comments

Comments
 (0)