Skip to content

Commit 5305c16

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 5d39638 commit 5305c16

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
@@ -1191,6 +1191,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11911191
};
11921192
}
11931193
}
1194+
// Scalable vectors are passed to C in their vector registers.
1195+
if def.repr().scalable() {
1196+
return FfiSafe;
1197+
}
11941198
if def.is_phantom_data() {
11951199
return FfiPhantom(ty);
11961200
}

0 commit comments

Comments
 (0)